I need some guidance on how to call my custom function module whenever an invoice gets posted through MIRO or FB60 transactions. I attempted to trace the events but couldn’t find any default function module that gets triggered during this process. This makes it difficult for me to identify the proper event details I need. I’m looking for a way to hook into the posting process so my custom logic can run automatically. Has anyone successfully implemented something similar? What approach would work best for intercepting invoice posting events in these transactions? Any help or suggestions would be greatly appreciated.
check out BADI FI_VENDOR_INVOICE - i used it for the same thing. works perfectly with MIRO and FB60. just implement the interface methods and your custom code runs right after posting. way easier than manually tracing events. just make sure you handle exceptions properly or the posting will bomb.
you could also try substitution rules in OB28 - way simpler than coding. just create a substitution that calls your function module when the document posts. works for both MIRO and FB60, so you don’t need separate implementations. only downside is you can’t access as much data as with BADIs, but it’s much faster to set up if your logic isn’t too complex.
I ran into this exact issue a few months ago and BTEs (Business Transaction Events) solved it perfectly. You’ll want BTE 00002020 - it triggers during MIRO and FB60 posting. Create a function module that matches the BTE interface, then register it via FIBF. What’s great about this approach is it catches the posting event right when the document gets created, so you have access to all the invoice data. BTEs beat user exits here because they’re built specifically for financial document events and integrate better with standard posting workflows. Just test the hell out of it in dev first - if your custom function breaks, it can block the entire posting process.
You could also use user exits - specifically MRMH0001 for MIRO transactions. I did this last year when we needed custom validations during invoice verification. The exit fires before final posting and gives you the complete document structure. You’ll need SMOD to find the exit components, then implement your logic in CMOD. The big advantage over BTEs is you can actually block the posting if your checks fail - we needed that for compliance. Downside is it only covers MIRO, so you’d need separate exits for FB60. Performance was solid in production with ~500 invoices daily.
SE80 enhancement framework is worth checking out too. Used it for a client who needed custom workflow triggers when invoices posted. Just create an enhancement spot in the posting function modules - set breakpoints during MIRO/FB60 to find the right ones. You get way more control over when your code runs in the posting chain. Takes longer than BTEs but it’s more flexible for complex stuff. We hooked it up to external systems and it’s been rock solid for two years. Just heads up - SAP upgrades can break your enhancements, so document everything.
This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.