‎2009 May 29 1:05 PM
Hi Friends,
I need some help on Rollback
I have a header table and an Item table
First data is inserted in Header table and then the related item records are updated in Item table
Assume a scenario where the Header records gets updated successfully and the item records
insertion fails for some reason
So in this case the header records should be rolledback , please give some inputs on this
Thanks
Chandra
Edited by: Chandrasekhar Jagarlamudi on May 29, 2009 2:10 PM
‎2009 May 29 1:18 PM
Your header and item updates would be one LUW (logical unit of work). Once everything is done without errors, you send a COMMIT WORK. Before that, you can use ROLLBACK WORK to undo the changes to the header table, should there be a problem with the items update.
Thomas
‎2009 May 29 1:21 PM
Thanks Thomas
Can you please let me know how can we make the 2 tables as one LUW as i am new to this
Do we have to maintain it at database level or program level
Thanks
Chandra
‎2009 May 29 1:25 PM
The keywords I mentioned are ABAP statements, the LUW logic is inside your program code. Check the online help for these keywords in the ABAP editor, it's all being explained there.
Thomas
‎2009 May 29 1:32 PM
‎2009 May 31 1:40 PM
Hi,
You may write your code in the following fashion:
INSERT zhead FROM TABLE i_zhead.
IF sy-subrc EQ 0.
INSERT zitem FROM TABLE i_zitem.
IF sy-subrc NE 0.
ROLLBACK WORK.
ENDIF.
ENDIF.
Regards,
Firoz.