‎2007 Jul 31 5:52 AM
hi to all viewers,
what is commit work, what task performed and how. please give me example.
thanks in advance and reward also.
regard : deep
‎2007 Jul 31 5:54 AM
To apply the changes made to the runtime objects of persistent classes to the actual persistent objects in the database, execute the COMMIT WORK statement
Commit work is used when you code directly in ABAP and make changes in the database and want to commit the database.
Commit work can be used when you trigger a workflow event by using Function module (swe_event_create) in your program.
‎2007 Jul 31 5:55 AM
Hi,
commit work we will use in case of update tasks
see this simple example
REPORT ZTESTYD01.
TABLES : ZYDTABLE01.
DATA: IT_TAB01 LIKE ZYDTABLE01
OCCURS 0 WITH HEADER LINE.
IT_TAB01-ZTEXT01 = 'DAVID'.
IT_TAB01-ZTEXT02 = 'VVVVV'.
APPEND IT_TAB01.
*MODIFY ZYDTABLE01 FROM IT_TAB01.
UPDATE ZYDTABLE01
SET: ZTEXT02 = 'UPDATEDONE'
WHERE ZTEXT01 LIKE 'BG1'.
INSERT INTO ZYDTABLE01 VALUES IT_TAB01.
IF SY-SUBRC = 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
ENDIF.
see this link for more help.
http://help.sap.com/saphelp_nw2004s/helpdata/en/d2/7849b8bec911d4b2e80050dadfb92b/content.htm
<b>reward if helpful</b>
rgds,
bharat.
‎2007 Jul 31 5:55 AM
hi,
<u>
COMMIT WORK</u>
This is the standard form, which specifies asynchronous processing.
Your program does not wait for the requested functions to finish processing.
Rgds
Reshma
‎2007 Jul 31 5:56 AM
Hi deep,
Commit Work - Executes a database commit and thus closes a logical processing unit or Logical Unit of Work ( LUW ) .
This means that all database changes are made irrevocable and cannot be reversed with ROLLBACK WORK and all database locks are released.
Hope this helps.
‎2007 Jul 31 5:57 AM
working with BAPIS I usually have the same problem, when the BAPI generates a SAP document and after calling BAPI COMMIT WORK, with parameter WAIT set to X.
update database.
‎2007 Jul 31 5:57 AM
After performing the database updates(SAP LUW) You could use the ABAP Statement COMMIT WORK to confirm your database updates.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.
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.
Also refer to these threads
Hope these are helpful
Neerja
‎2007 Jul 31 5:59 AM
Hi,
When ever you execute any database statement like UPDATE or MODIFY or DELETE
the changes are not written to Database until you cimmit the cnages, this is due to the fact the there will be generally 2 or more steps when you do changes to Database, and all of the make sense only when all are a success so you wait untill all the statements are done and then say COMMIT WORK so that all the changes are done in Database if some failure occurs you will do ROLL BACK so that you go back to the status how it was before you have executed these DB statements.
Regards,
Sesh