‎2007 Apr 17 10:21 PM
Hi All,
I have some questions regarding 'Commit Work'.
1) What is the purpose of Commit Work?
2) If I modify a record of an Infotype, what difference does it make to the entire system by using an explicit 'Commit Work' after that statement? How would this scenario differ by not using a Commit Work?
3) Under what conditions should one use Commit Work?
Cheers,
Ravi
‎2007 Apr 18 10:03 AM
Hi Ravi,
<b>COMMIT WORK.</b>
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.
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 ,
cancels all existing locks (see SAP locking concept ) if no update requests exist,
closes all open database cursors (see OPEN CURSOR ) and
resets the time slice counter to 0.
COMMIT WORK belongs to the Open SQL command set.
Return code value
The SY-SUBRC is set to 0.
Also check this info.
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
http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/commit-work-and-rollback-work-871915
http://www.sapgenie.com/abap/fieldexits.htm
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 17 10:26 PM
hi,
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.
~~Guduri
‎2007 Apr 18 10:03 AM
Hi Ravi,
<b>COMMIT WORK.</b>
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.
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 ,
cancels all existing locks (see SAP locking concept ) if no update requests exist,
closes all open database cursors (see OPEN CURSOR ) and
resets the time slice counter to 0.
COMMIT WORK belongs to the Open SQL command set.
Return code value
The SY-SUBRC is set to 0.
Also check this info.
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
http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/commit-work-and-rollback-work-871915
http://www.sapgenie.com/abap/fieldexits.htm
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 18 11:14 AM
Commit work means the database is updated. Before a commit work a 'rollback' is possible. Also check the sap help around rollback.
‎2007 Apr 18 1:14 PM
Hi,
here is some useful info about Commit Work.
When to use commits ?
On reports (read only programs) running longer than one minute, let's call it the "one minute rule". This is what we call the commits that need to be set for DB2 to release the read locks. It's what this document is all about. For most abappers this is new.
On single dialog update programs (transactions) at the end of a transaction. This is known as the normal commit.
On programs that perform mass updates or archive. Most abappers already used commits here at a certain number of updates. Maybe the amount of commits should be increased a bit for DB2.
When sending out an outbound ALE IDoc and calling function 'MASTER_IDOC_DISTRIBUTE' otherwise your IDoc will never be created in the receiving SAP system.
When, in general, not to use commits (exceptions could occur):
In reports than will never run longer than one minute: an automatic commit is always done at the end of the program and this would just mean extra work.
In user exits or field exits: can be very dangerous !
In function modules: could be set if the calling program(s) can handle a commit. This needs to be checked case by case.
In programs that don't perform database read/writes: e.g. file transfers only
In transaction processing commits should only be used for saving (no DB2 performance commits here)
thanks,
sksingh