2017 Feb 16 5:52 AM
Hi,
I'm deleting all records from a custom table as the very first statement. After some 1000 line of codes I'm doing COMMIT WORK. If my program dumps in between I want all records in table as it is(NOT DELETED), but i find that my table is empty. Here is sample code below.
DELETE FROM ztest.
*****Some thousand line of codes.*** My program may dump here in between
IF sy-subrc eq 0.
COMMIT WORK.
ENDIF.
Please help me how to roll back custom table changes, if my report dumps in between.
2017 Feb 16 6:39 AM
Look in your code for any Implicit Database Commits, are you able to remove those, in this case a database rollback will reverse the delete (e.g. call FM DB_ROLLBACK)
If not, then you can no longer reverse the changes so consider moving the delete and following insert open-sql statements to some update function module called IN UPDATE TASK, so they won't be executed before the COMMIT-WORK.
Else you could load ZTST initial values in an internal 'old' table, remove the open-sql statements in the code, replace by adding records in an internal 'new' table and just before the COMMIT, update the database table.
Regards,
Raymond