‎2009 Oct 30 2:48 PM
Hi Friends,
I have a requirement where i need to read data from 4 standard tables then write the entries to 4 Ztables then delete the entries from the standard tables.
the sequence is read a standard table write it to ztable then delete the entries from standard table.
this occurs 4 times since 4 table are read and written into a ztable.
but all work should rollback if an error occur.
but currently when the 3rd table write fails when executed rollback work the 1st and 2nd table work has not been rollbacked is there anyway that i can achieve this requirement
Thanks
Nafran
‎2009 Oct 30 2:52 PM
Are you using any ABAP statements inbetween that leave the internal session, e.g. SUBMIT, CALL TRANSACTION and the likes?
These would invoke a database commit.
Thomas
‎2009 Oct 30 3:06 PM
no nothing like that is used.
the code is in bellow sequence
select data from table 1
updated ztable1
if successful
delete table 1 entries
if successful
select data from table 2
updated ztable2
if successful
delete table 2 entries
‎2009 Oct 30 3:19 PM
This could be done with internal tables, saving the records to delete from each table, and only deleting them when the 4 conditions checked. This way you won't depend on rollbacks.
‎2009 Oct 30 3:28 PM
Hi,
For situations like this we should always use the concept of LUW.
Read this lik carefully:
[http://help.sap.com/saphelp_nw70/helpdata/EN/41/7af4bfa79e11d1950f0000e82de14a/content.htm]
The database update statements should be written in Special function modules called as UPDATE FUNCTION MODULE or
PERFORM xyz ON COMMIT and then commit should be executed when the Update FMs for all your transactions have been completed.
I am sure this is what you need.
Thanks,
Prakash Pandey
‎2009 Oct 30 3:35 PM
but this is written in report program which makes it a single LUW
‎2009 Oct 30 4:33 PM
‎2009 Oct 30 6:49 PM
Commit should be used after all the 4 update .
if error occurs
rollback .
else.
commit work.
endif.