Application Development and Automation 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: 
Read only

Is 'Commit Work' statement necessary?

Former Member
0 Likes
1,283

Is it mandatory to issue 'Commit Work' statement to terminate the program in SAP LUW? If not provided would the program go into infinite loop?

7 REPLIES 7
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,041

First of all COMMIT WORK doesn't terminate the program in SAP LUW rather it terminates the LUW.

If you don't use an explicit COMMIT at the end of the program an implicit COMMIT occurs. Read SAP documentation on COMMIT WORK, SAP Logical Unit of Work.

BR,

Suhas

Read only

Former Member
0 Likes
1,041

No, COMMIT WORK is intended to flush update queues and allow SAP dispatcher to then assign the data to update processes that write the data to the database tables. If one is doing an update from a customer program, generally one writes a COMMIT WORK at the appropriate point(s) in the code.

Edited by: BreakPoint on Aug 19, 2010 5:25 PM

Correct my statement about program ending.

Read only

0 Likes
1,041

I will give you a while to explain about update debugging before locking the thread (special exception for you...

But generally if the OP has shown no inclination to do a basic search then answering it is spoon-feeding.

The question also appears to be 1: 1 copy&pasted from an interview catalogue.....

Cheers,

Julius

Read only

0 Likes
1,041

every time a dialog (dynpro) is closed, automatically triggers a commit work!

When you use:

CALL TRANSACTION

LEAVE TO TRANSACTION

Automatically triggers a commit work..

You dont need to use COMMIT WORK, at least, that want to implement advanced update techniques (Asynchronus, update function modules, etc)

Read only

0 Likes
1,041

... just before the thread gets locked:

There is no such thing as an implicit commit work. The implicit commit is a database commit, that means after every process interruption as i.e. processing of any screen and the end of program execution all database activities are committed, they can not be rolled back.

The explicit ABAP statement COMMIT WORK will termiante the current LUW and, additionally start execution of all asynchronous database operations (Call function in update task), start all PERFORM ON COMMIT routines.

Most BAPI calls need a subsequent COMMIT WORK, better issued by function Call BAPI_TRANSACTION_COMMIT.

The documentation has more information. One major truth is: In 'simple' programs that do some INSERTS, UPDATES and MODYFYs on database tables, you do not need any COMMIT WORK. And if screen processing happens afterwards, you can not ROLL BACK.

Regards,

Clemens

Read only

0 Likes
1,041

Hi Julius,

Exercise your right & do it

Keshav

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,041

Please read the SAP documentation of commit work.