Application Development 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: 

LEAVE PROGRAM, no commit?

Former Member
0 Kudos

  DELETE FROM zvfnvrd.

* Check if delete ís OK
  SELECT COUNT(*)
         FROM zvfnvrd.
  IF sy-subrc = 0.
    WRITE:/ 'Try again'.
<<<<<<<HERE>>>>>>>>>>>
  ENDIF.

Hi,

How to leave program without COMMIT WORK.

If I use LEAVE PROGRAM, commit work is stil done.

Adibo.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Use [ROLLBACK WORK|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=rollbackWORK&cat=sdn_all] before [LEAVE PROGRAM|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=leavePROGRAM&adv=false&sortby=cm_rnd_rankvalue].

Regards

5 REPLIES 5

Former Member
0 Kudos

commit work

Executes a database commit and thus closes a Logical Unit of Work

All database updates are made irrevocable and cannot be reversed with ROLLBACK WORK

Former Member
0 Kudos

Hi,

Once the records are deleted from database table they cannot be rolled back.

You can give appropriate error message for the same.

Regards,

Saba

raymond_giuseppi
Active Contributor
0 Kudos

Use [ROLLBACK WORK|https://www.sdn.sap.com/irj/sdn/advancedsearch?query=rollbackWORK&cat=sdn_all] before [LEAVE PROGRAM|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=leavePROGRAM&adv=false&sortby=cm_rnd_rankvalue].

Regards

0 Kudos

Hi,

ROLLBACK WORK before LEAVE PROGRAM is not working.

So if I have database table with lets say 20 records.

When calling DELETE FROM table, if 10 record have been deleted and 10 have NOT been deleted I can't ROLLBACK?

Its strange.

When I'am in DEBUGGING MODE and have called DELETE FROM table an then I execute program bij simply closing the window, I get all the records back. So nothing is deleted!!

Adibo

0 Kudos

If ROLLBACK WORK does not work, you have perform a database commit (implicitly or explicitly) Some instructions close the current database LUW, so its then too late to undo the database changes.

Look at [Database Logical Unit of Work (LUW)|http://help.sap.com/erp2005_ehp_03/helpdata/EN/41/7af4bca79e11d1950f0000e82de14a/frameset.htm] where you will found information on implicit database commit triggering.

Regards