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

COMMIT WORK

Former Member
0 Likes
1,104

Hi,

what exactly commitwork will do in programme?if i write commitwork and stop wat will do?

thanks

5 REPLIES 5
Read only

Former Member
0 Likes
829

Hi..,

<b>Commit work makes the data base changes permenant !!

what ever the changes u have done to the database till this commit work are stored temperarly in LUW.. when this statement is executed all the changes are made permanent !! some statements internally issues COMMIT WORK like WAIT statement etc..</b>

The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the currenta SAP LUW in the process. In this case, COMMIT WORK performs the following actions:

It executes all subroutines registered using PERFORM ON COMMIT.

It triggers an internal event in Object Services that ensures the registration of changes in persistent objects as the last update function module, as well as the subsequent initialization of persistent object attributes.

It initiates the processing of all registered update function modules in the update work process.

This executes all high-priority update function modules registered using CALL FUNCTION ... IN UPDATE TASK in the order of their registration and in a common database LUW. If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating). If you specify the addition AND WAIT, however, program processing after COMMIT WORK will not continue until the update work process has executed the high-priority update function modules (synchronous updating).

If all high-priority update function modules are completed successfully, the statement executes the low-priority update function modules together in a common database LUW.

In parallel, it also executes the individual function modules registered using CALL FUNCTION ... IN BACKGROUND TASK DESTINATION in a separate database LUW for each destination.

It handles all SAP locks set in the current program according to the value of the formal parameter _SCOPE of the corresponding lock function modules.

It triggers a database commit that also terminates the current database LUW.

The completion of statement COMMIT WORK triggers the event TRANSACTION_FINISHED of the system class CL_SYSTEM_TRANSACTION_STATE, where the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>COMMIT_WORK.

If the statement COMMIT WORK is executed by calling special programs, be aware of the following:

In a program executed using batch input, or if you have called the program using the USING addition of the statement CALL TRANSACTION, COMMIT WORK terminates the batch input processing when using the corresponding settings.

regards,

sai ramesh

Read only

Former Member
0 Likes
829

Hi Ramakrishna,

This statement will apply any outstanding database updates and wait until they have actually been put on the database before proceeding to the next statement.

An ordinary commit work will initiate the process to update the databases in a separate task and will press on in your abap.

COMMIT WORK: ( Asynchronous)

Your program does not wait for any acknowledgement. it just start executing the next statment after COMMIT WORK.

From SAP HELP :

COMMIT WORK

This is the standard form, which specifies asynchronous processing. Your program does not wait for the requested functions to finish processing.

COMMIT WORK AND WAIT

This form specifies synchronous processing. The commit statement waits for the requested functions to finish processing. Control returns to your program after all high priority (V1) function modules have run successfully.

The AND WAIT form is convenient for switching old programs to synchronous processing without having to re-write the code. Functionally, using AND WAIT for update-task updates is just the same as dialog-task updates with PERFORM ON COMMIT.

Commit work means suppose if u want to update all the changes up to certain level to DB then u can explicitly use this statement. If any thing will wrong automatically roll back will be takes place, means all the updations will be roll back.

Please refer to following links for commit work.

http://www.sap-img.com/fu018.htm

http://help.sap.com/saphelp_nw04/helpdata/en/d2/7849b8bec911d4b2e80050dadfb92b/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/content.htm

Hope this resolves your query.

Reward all the helpful answers.

Regards

Read only

Former Member
0 Likes
829

hi RamaKrishna,

Executes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) (see also Transaction processing ). This means that

all database changes are made irrevocable and cannot be reversed with ROLLBACK WORK and

all database locks are released.

go through this..

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/commit.htm

regards,

Chakri

Read only

Former Member
0 Likes
829

hi

commit work is used for if u did any modifications after tat u used commit work that can be save into data base. it can,t show the previous data

praveen

Read only

Former Member
0 Likes
829

Executes a database commit and thus closes a Logical Unit of Work ( LUW) This means that

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

all database locks are released.

COMMIT WORK also

calls the subroutines specified by PERFORM ... ON COMMIT,

executes asynchronously any update requests (see CALL FUNCTION ... IN UPDATE TASK) specified in these subroutines or started just before,

processes the function modules specified in CALL FUNCTION ... IN BACKGROUND TASK,

closes all open database cursors (see OPEN CURSOR) and

resets the time slice counter to 0.

Never Use Commit work in a select... endselect .. program dumps