2019 Sep 19 7:05 PM
Hi,
In the logic that I built, I have to loop , and for each item
1. Goods Issue(GI) using BAPI_GOODSMOVEMENT_CREATE, and if successful commit it.
2. If GI created create Transfer requirement(TR) for GI. Commit if successful. (Question)
3. If TR is created, create Transfer Order for TR. If error (Question).
Question: If there is error creating TR , I would have to reverse the Goods movement which would create another MIGO document. So if I use BAPI_TRANSACTION_ROLLBACK, will it reverse all the previous created/commited GI/TR/TO as all these are in the same LUW?
2019 Sep 20 12:12 AM
Hi,
No,BAPI_TRANSACTION_ROLLBACK will not reverse previous commits.
You should use BAPIs in first 2 steps to know if there are any errors. Based on that, call BAPI_TRANSACTION_COMMIT at the end of third step. Then all the 3 steps will be in one LUW and that's how it should be done.
Regards
GK
2019 Sep 20 12:12 AM
Hi,
No,BAPI_TRANSACTION_ROLLBACK will not reverse previous commits.
You should use BAPIs in first 2 steps to know if there are any errors. Based on that, call BAPI_TRANSACTION_COMMIT at the end of third step. Then all the 3 steps will be in one LUW and that's how it should be done.
Regards
GK
2019 Sep 20 5:17 AM
check out the errors after BAPI_GOODSMOVEMENT_CREATE by filtering Return bapi Internal table for Errors.. if error don't commit the results.
Regards,
Abinath
2019 Sep 20 5:20 AM
The Logic is simple:
All the transactions that are committed Cannot be Rolled back. In Your Case you are trying to roll back transactions that are committed already which is not possible and correct too.
Probably you can alter your Logic as below:
1) Do not commit any transactions until your complete Cycle is completed successfully.
2) In case if there is failure at any step of the cycle then you Roll back (Without committing any transaction up front), this could be favorable for your scenario.
Regards,