Execute custom function module during MIRO invoice posting

I need to run my own function module whenever a user posts an invoice through MIRO or FB60 transaction. I’ve been looking into this for a while now and tried different approaches but nothing seems to work properly.

I attempted to trace the events that happen during the posting process, but I noticed that no function module gets created by default in the system. This makes it really difficult for me to figure out which events are being triggered and when exactly they occur.

Has anyone dealt with this kind of requirement before? What would be the best way to hook into the invoice posting process? I’m open to any suggestions or alternative methods that might work for this scenario.

Try using substitution rules in transaction OBBH. This lets you intercept the posting process and run custom logic without touching core SAP code. Create a substitution that triggers during invoice posting and calls your function module from there. Substitutions are well-supported by SAP and give you a clean integration point. I’ve used this approach for similar requirements where we needed extra validations and data updates during MIRO postings. Just identify the right document type and posting key combination for your scenario, then configure the substitution.

I faced a similar challenge when trying to implement custom logic during MIRO invoice postings. Instead of relying on standard function modules, it’s more effective to explore user exits and BADIs. Specifically, you might want to look into BADI MRM_WORKFLOW_AGENTS_DETERM and user exit MRMH0001, as they provide hooks at different stages of the posting process. Additionally, the enhancement spot MRM_HEADER_CHECK is activated right before posting—this can be particularly useful. Make sure to test these options in your development environment to determine the best point for your custom logic.

hey bellagarcia, have u tried looking into the user exits or BADIs for MIRO? there’s enhancement options available, and checking them via SPRO might save u some time instead of digging through those function modules directly.