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

General

Former Member
0 Likes
734

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

7 REPLIES 7
Read only

former_member189059
Active Contributor
0 Likes
711

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.

Read only

Former Member
0 Likes
711

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.

Read only

Former Member
0 Likes
711

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

Read only

Former Member
0 Likes
711

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.

Read only

Former Member
0 Likes
711

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.

Read only

Former Member
0 Likes
711

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

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
711

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