I’m currently working on a custom validation process in transaction MIRO using the BADI MRM_HEADER_CHECK. My goal is to display an error message when a ‘reference’ field has been previously used, but I also need to ensure that users can edit certain fields to correct their inputs.
The issue arises when I display an error message of type E, as this disables all fields on the screen, preventing any corrections. I need to keep two specific fields enabled so that users can make changes.
Here’s what I’ve attempted so far:
I tried using the statement MESSAGE <msg> TYPE 'S' DISPLAY LIKE 'E', but it didn’t function as expected.
I also utilized LOOP AT SCREEN in my BADI code, but it doesn’t recognize the field names I want to disable.
During debugging, I checked SY-DINNR and found it equals 6000 at the breakpoint.
Parameters to consider:
I need to display an E-type error message to block most fields.
I cannot alter the PAI/PBO modules that are outside my BADI.
I cannot modify the CHAIN structure in the following format:
* This field symbol has the input values.
ASSIGN ('(SAPLMR1M)RBKPV') TO <fs_rbkpv>.
IF <fs_rbkpv>-XBLNR = lwa_bkpf-xblnr.
MESSAGE lc_message TYPE 'E'.
ENDIF.
Any suggestions on how to achieve this? I appreciate your help in advance.
try setting screen-input = 1 for those fields right after your MESSAGE statement. I had the same issue and LOOP AT SCREEN WHERE name = ‘your_field’ fixed it in my badi implementation. just do it before the message triggers.
This is how SAP works by design. When you throw a TYPE ‘E’ message, the system automatically locks all screen fields to display-only. Don’t fight it - use a two-stage validation instead. Throw a TYPE ‘W’ message with a custom dialog to mimic the error behavior but keep fields editable. Try POPUP_TO_CONFIRM_STEP or similar function modules to force user acknowledgment. I’ve had success validating at a different BADI point that fires earlier in the process. MRM_HEADER_CHECK2 or MRM_ITEM_CHECK might work for your case. You can also hack the CHAIN validation by dynamically tweaking field attributes with GET_GLOBALS_FROM_SLVC_FULLSCR to bypass the standard screen control logic. Just test this thoroughly - it’s version-dependent and can break.
SAP BADIs are a pain when you need this kind of screen control. The issue is you’re trapped in SAP’s rigid framework where error messages freeze everything.
You need to break free from this completely. Don’t fight SAP’s screen behavior - pull this validation logic outside of SAP.
I’ve hit similar problems where business rules needed more flexibility than standard SAP transactions could handle. My solution was creating a validation service that runs before the SAP transaction.
Build a workflow that catches the data entry, validates the reference field against your database, then only sends clean data to MIRO. Users get a proper interface where they can fix mistakes without SAP’s error message lockdown.
Your validation layer can show friendly error messages while keeping all fields editable. Once validation passes, data flows smoothly into SAP.
Latenode makes this setup easy. You can create HTTP endpoints that validate reference fields, connect to SAP, and build a custom interface that gives users the editing flexibility they actually need.