How to keep specific fields enabled after displaying error message in MIRO transaction?

I’m working on custom validation logic in MIRO transaction using BADI MRM_HEADER_CHECK. When I detect that a reference number is already being used, I need to show an error message but still allow users to edit certain fields to correct the issue.

The problem is that when I display an error message with type E, all input fields become disabled and users cannot modify the reference field to fix the duplicate value.

I need to keep two specific fields editable while blocking all others when the error occurs.

What I’ve already tried:

  • Using MESSAGE <text> TYPE 'S' DISPLAY LIKE 'E' but this doesn’t provide the blocking behavior I need
  • Checking SY-DINNR which shows value 6000 at breakpoint
  • Using LOOP AT SCREEN in my BADI but it doesn’t show the field names I want to control

I cannot modify the standard SAP code outside of my BADI implementation, so solutions involving PAI/PBO modifications won’t work.

Here’s my current BADI implementation:

*Getting input values from screen
ASSIGN ('(SAPLMR1M)INVOICE_DATA') TO <field_symbol>.
IF <field_symbol>-REF_DOC = existing_reference.
  MESSAGE validation_msg TYPE 'E'.
ENDIF.

Is there a way to selectively enable certain fields after showing an error message in this context?

This limitation with MIRO’s field behavior can indeed be frustrating. A workaround I’ve found effective is implementing a two-step validation process. Instead of immediately displaying the error when detecting a duplicate reference, set a flag in your custom structure. Only show the error message after a second validation pass if the reference remains unchanged. This allows users to make corrections without locking up the fields.

Additionally, consider utilizing enhancement spots within MRM_HEADER_CHECK to adjust the timing of screen modifications. Specifically, check out the enhancement point VENDOR_INVOICE_HEADER to manage field accessibility prior to standard error handling. Another option is employing a custom popup for duplicate references, which can convey the error message without triggering MIRO’s built-in field locking, keeping the fields editable for corrections.

The issue you’re experiencing is common with MIRO’s handling of error messages. One effective approach is to utilize the BADI MRM_SCREEN_MODIFY if it’s available in your SAP version. Instead of using TYPE ‘E’ messages, which trigger field locking, assess the conditions first and use a warning message with TYPE ‘I’ to inform users of the duplicate reference. This maintains field editability while still alerting the user to correct the issue. Implementing validation flags can further enhance user experience by providing real-time feedback without locking down the interface.

The problem is MIRO automatically disables screen elements when it hits TYPE ‘E’ messages. Here’s what worked for me: don’t trigger the error right away in the BADI. Instead, store your validation result in a global variable and wait to show the error message until after you’ve tweaked the screen properties. Check that validation state in your next method call, then use MODIFY SCREEN to set INPUT = 1 for the fields you need. Timing’s everything here - you’ve got to catch that window between validation and when the standard error processing kicks in. This way you keep your fields editable but still handle errors properly.

I’ve had the same problem. Try LOOP AT SCREEN but run it at a different time - put it in METHOD CHECK_HEADER after your validation runs but before the message pops up. You can tweak screen-input selectively there. Also check if you can hit the screen fields through dynamic assignment like you’re doing with invoice_data, but target the screen table directly instead.