Execute custom function when posting invoices in FB60 or MIRO

I need to run my own function module whenever someone creates an invoice posting through FB60 or MIRO transactions. I attempted to use event tracing to figure this out, but I couldn’t find any default function modules being triggered during the process. This makes it difficult for me to understand which events I should be hooking into. Has anyone successfully implemented something similar? I’m looking for guidance on the best approach to automatically execute custom logic during invoice posting. Any suggestions on user exits, BADIs, or enhancement spots that might work for this scenario would be really helpful.

try enhancement point in include LMRMFUXX - thats where miro processing happens. for fb60 look at user exit RFUMSV00. both get triggered during document creation before posting. worked for me when i needed to validate vendor data automatically.

Check out user exit MV50AFZ1 combined with workflow event linkage. I had success triggering custom functions by setting up a workflow event that fires when invoice documents hit status changes. The trick is catching the right timing - you want to hook into the commit work phase rather than during validation. I found that creating a custom class implementing IF_WORKFLOW_EVENT and then linking it to object type BUS2081 worked better than trying to find existing function modules. The event container gives you access to all the document data you need. Make sure to test thoroughly in development because the timing can be tricky if you need to modify any data during the posting process.

Have you considered using enhancement spot MM_INVOICE_POSTING? I ran into the same issue about two years back when implementing automatic duplicate invoice checks. The enhancement spot gives you multiple implementation options and works reliably for both transactions. Another approach that worked well for me was implementing at the document level using BADI FI_DERIVE_NEW which gets called during the posting process. The timing is perfect since it executes right before the final commit. You might also want to check table BKPF change documents if you need to capture the posting after it completes rather than during the process. The enhancement spot approach gave me the most control over when exactly my custom code executed.

i’d recommend looking into BADI INVOICE_UPDATE too! it triggers for fb60 and miro. user exit RFEBBU01 is another good one, fires on document save. i used INVOICE_UPDATE last yr for similar stuff, pretty solid.