Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Submit program after database commit of MIGO

alexandreourth
Active Participant
0 Likes
2,490

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

1 ACCEPTED SOLUTION
Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
2,248

Hello alexandreourth

Use MB_DOCUMENT_UPDATE. It's definitely called after COMMIT WORK.

Best regards

Dominik Tylczynski

8 REPLIES 8
Read only

Marco_Flamm
Active Participant
0 Likes
2,248

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

Read only

0 Likes
2,248

The user-exit and the BAdI here work pretty much the same.

Read only

0 Likes
2,248

Thanks Marco for your time.

I'll try that too.

Have a great day

Read only

Dominik_Tylczynski
SAP Champion
SAP Champion
2,249

Hello alexandreourth

Use MB_DOCUMENT_UPDATE. It's definitely called after COMMIT WORK.

Best regards

Dominik Tylczynski

Read only

0 Likes
2,248

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

Read only

2,248

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.

Read only

RaymondGiuseppi
Active Contributor
2,248

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.

Read only

0 Likes
2,248

Hi Raymond Thanks a lot.

Yes i think i need to read it again ^^

Have a great day.