I’m trying to show a warning in SAP MIRO when certain criteria are met. I used the ‘INVOICE_UPDATE’ BADI with the ‘CHANGE_AT_SAVE’ method. But the warning doesn’t show up even though my BADI is called.
I saw some code that checks if it’s in dialog mode before showing messages. Is there another way to make warning messages appear for the user? Maybe a different user exit?
Here’s a similar code example I found:
IF result_code <> 0.
IF invoice_type <> 'DIALOG'.
CALL FUNCTION 'DISPLAY_MESSAGE'
EXPORTING
message_id = l_msgid
message_type = l_msgty
message_v1 = l_msgv1
message_v2 = l_msgv2
message_v3 = l_msgv3
message_v4 = l_msgv4.
ELSE.
PERFORM store_message USING l_msgid l_msgty l_msgv1 l_msgv2 l_msgv3 l_msgv4.
ENDIF.
ENDIF.
Any ideas on how to make this work? Thanks for your help!
I’ve encountered a similar issue with SAP MIRO warning messages not appearing. In my experience, the ‘INVOICE_UPDATE’ BADI might not always be the best choice for displaying warnings to users during the MIRO process.
Instead, I found success using the ‘MIRO_INVOICE_VERIFICATION’ user exit. This exit provides more control over the message display timing and ensures the warning appears when needed.
To implement this, you’ll need to enhance the standard function module MRM_INVOICE_POST_CHECK. Within this enhancement, you can add your custom logic to check the criteria and raise the warning message.
Here’s a general approach I used: 1. Create a function module for your custom checks, 2. Implement the user exit MIRO_INVOICE_VERIFICATION, 3. Call your custom function from within the user exit, 4. Use MESSAGE statements to display warnings.
This method proved more reliable in my projects, consistently showing warnings to users when specific conditions were met during invoice verification. It might be worth exploring this approach if you’re still facing issues with the BADI method.