How to keep specific fields editable 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 in use, 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 fields become disabled and users cannot make any changes. I need to keep two specific fields active so users can fix the validation error.

Here’s what I’ve already tried:

  • Using MESSAGE <text> TYPE 'S' DISPLAY LIKE 'E' - this approach didn’t work
  • Checking SY-DINNR at breakpoint shows value 6000
  • Using LOOP AT SCREEN inside my BADI code doesn’t show the field names I want to control
  • I cannot modify standard SAP code outside my BADI implementation

My current BADI implementation:

*Getting input field values
ASSIGN ('(SAPLMR1M)HEADER_DATA') TO <field_structure>.
IF <field_structure>-REFERENCE = existing_reference.
  MESSAGE custom_error TYPE 'E'.
ENDIF.

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

I had the same MIRO validation issue - the standard error handling is way too restrictive. Here’s what actually works: forget trying to control field availability in the validation BADI itself. Instead, use the MRM_SCREEN_MODIFY BADI for custom screen modifications. When your validation fails, store the error state in a global variable. Then use that info during screen processing to enable only the fields you need. In your validation BADI, just set a flag instead of throwing the error right away. Then in MRM_SCREEN_MODIFY, check that flag and modify the screen fields before showing your error message. This respects SAP’s screen flow but gives you control over which fields stay available. Timing matters here - you need to modify screen properties after detecting the error but before the screen locks everything down. I’ve used this method successfully across different SAP versions.

This happens because of how MIRO handles validation errors. When MRM_HEADER_CHECK throws a type E message, SAP locks the entire screen by default - it’s a security thing. But there’s a workaround using MRM_DIALOG_BADI with your validation logic. Don’t throw the error right away. Instead, capture your validation result in a global variable. Then use the SCREEN_MODIFY method in MRM_DIALOG_BADI to enable specific fields by checking their screen-name property. Set those fields to screen-input = 1 and screen-output = 1 after setting your validation flag. Only then display your error message. You’ll need to coordinate between two BADIs, but it keeps fields editable even with error messages. The trick is catching the screen modification cycle before SAP applies its default field locking. I’ve used this pattern in several MIRO customizations where users needed to fix validation errors without losing all their input.

This is tricky in Miro because of how SAP handles screen flow. Try a warning message instead - MESSAGE custom_error TYPE ‘W’. Warnings let users keep editing while showing the validation issue. Not as strict as an error but keeps fields active so they can fix the reference number.