‎2021 Jun 17 9:35 AM
Hello experts,
I need to submit a standard program (V_V2 tcode) after a material document is created (MIGO/MB1B).
I know BADI like MB_DOCUMENT_BADI could be a good place to do that

But how can i be sure to submit my program after the database COMMIT of the MIGO/MB1B?
Thanks a lot for your time.
Regards,
Alexandre
‎2021 Jun 17 10:34 AM
‎2021 Jun 17 10:20 AM
Hello Alexandre,
Would the User-Exit EXIT_SAPLMBMB_001 (of MB_CF001) be an option for you? It is called within MB_DOCUMENT_UPDATE. Please try to implement it and check via Debugger, if the data you need is written to the Database already at this point.
Please make sure to activate „Update Debugging“ in the settings of the Debugger, otherwise Debugger will not open within MB_DOCUMENT_UPDATE or EXIT_SAPLMBMB_001.
Best Regards
Marco
‎2021 Jun 17 10:32 AM
‎2021 Jun 17 2:23 PM
Thanks Marco for your time.
I'll try that too.
Have a great day
‎2021 Jun 17 10:34 AM
‎2021 Jun 17 12:58 PM
Hello Dominik,
Thanks for your answer.
The description of this method annoyes me "When writing a document" => I expected something like "after writing" like the first method which has "Exit after writing a material document" but the associated method is MB_DOCUMENT_BEFORE_UPDATE 🙂 This confuses me, It must be according to a certain context/logic but clearly not mine.
I thought there were so kind of an instruction to submit a program after the current process.
Thanks again
‎2021 Jun 17 1:12 PM
To be sure, do a simple test by implementing BADI with only a
break-point instruction and process MIGO in debug mode to stop execution
at COMIT WORK instruction...! 😉
Else, a solution to do some
action after standard updates are finished is to encapsulate your code
in a Z function called in update with start delayed mode 2.
‎2021 Jun 17 1:55 PM
Wrap your code in a RFC enabled FM, call this FM with the option in background task or unit.
CALL FUNCTION 'Z_XXXXX' IN BACKGROUND TASK
EXPORTING...
This FM will be executed after the V1 update task and the database commit of their data. You can register your call anywhere before the COMMIT WORK statement.
Hint: Read first SAP online documentation on statement COMMIT WORK.
‎2021 Jun 17 2:22 PM
Hi Raymond Thanks a lot.
Yes i think i need to read it again ^^
Have a great day.