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

ROLLBACK after failure

Former Member
0 Likes
990

I am calling the following FMs in the sequence:

1. BAPI_GOODSMVT_CREATE using movement type 261

2. BAPI_GOODSMVT_CREATE using movement type 101

3. COMMIT WORK to generate a handling unit number.

4. A FM L_TO_CREATE_SINGLE (that unpacks and repacks handling units) uses the handling unit number of step 3.

-


My requirement is that if the BDC in the 4th step fails, then steps 1, 2 should be be ROLLBACKed.

To my understanding if I have a ROLLBACK work after step 4, then the COMMIT work in step 3 prevents the ROLLBACK of steps 1 and 2.

I cannot remove the COMMIT in step 3 as the HU number is not being generated (which I need in step 4) in case I remove the COMMIT WORK.

-


I tried calling the FM in step 4 in UPDATE TASK, but no luck.

Please help, how to go about this problem.

1 ACCEPTED SOLUTION
Read only

mithun_shetty4
Contributor
0 Likes
791

if you cannot generate the Handling unit number with out commit work then probably u need to do a reversal ( ie post with the reversal movement type for 261 and 101) when the 4th step fails

3 REPLIES 3
Read only

mithun_shetty4
Contributor
0 Likes
792

if you cannot generate the Handling unit number with out commit work then probably u need to do a reversal ( ie post with the reversal movement type for 261 and 101) when the 4th step fails

Read only

Former Member
0 Likes
791

Thank you for replying.

I find that idea as a potential solution to my problem.

If I use your approach, I believe a system log will be created showing the information about the reversal. However since the whole process takes place behind a online program, I do not want information of the reversal from getting logged for every time the repack unpack fails due to (say) wrong input from user.

Is there any way to delete the information in the log, that would not allow it getting logged every time in the intermediate phase?

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
791

You are using commit work before step 4 because you step 4 is dependent on data provided from previous steps.

My requirement is that if the BDC in the 4th step fails, then steps 1, 2 should be be ROLLBACKed.

Commit work is the last state of a transaction flow and you cannot rollback the previous step. The only way I see is to call BAPI_GOODSMVT_CANCEL and reverse the goods movement.

Please let me know what do you mean by logs exactly. Is it the change documents or something else ?

Kesav