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 and roll back

Former Member
0 Likes
454

hi all,

can u please expalin me wat is commit work and roll back

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
429

<b>COMMIT WORK</b>

The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the current SAP LUW in the process.

<b>ROLLBACK</b>

The statement ROLLBACK WORK closes the current SAP-LUW and opens a new one. In doing so, all change requests of the current SAP-LUW are canceled. To do this, ROLLBACK WORK carries out the following actions:

Executes all subprograms registered with PERFORM ON ROLLBACK.

Deletes all subprograms registered with PERFORM ON COMMIT.

Raises an internal exception in the Object Services that makes sure that the attributes of persistent objects are initialised.

Deletes all update function modules registered with CALL FUNCTION ...IN UPDATE TASK from the VBLOG database table and deletes all transactional remote Function Calls registered with CALL FUNCTION ... IN BACKGROUND TASK from database tables ARFCSSTATE and ARFCSDATA.

Removal of all SAP locks set in the current program in which the formal parameter _SCOPE of the lock function module was set to the value 2.

Triggers a database rollback, which also ends the current database-LUW.

2 REPLIES 2
Read only

Former Member
0 Likes
430

<b>COMMIT WORK</b>

The statement COMMIT WORK completes the current SAP LUW and opens a new one, storing all change requests for the current SAP LUW in the process.

<b>ROLLBACK</b>

The statement ROLLBACK WORK closes the current SAP-LUW and opens a new one. In doing so, all change requests of the current SAP-LUW are canceled. To do this, ROLLBACK WORK carries out the following actions:

Executes all subprograms registered with PERFORM ON ROLLBACK.

Deletes all subprograms registered with PERFORM ON COMMIT.

Raises an internal exception in the Object Services that makes sure that the attributes of persistent objects are initialised.

Deletes all update function modules registered with CALL FUNCTION ...IN UPDATE TASK from the VBLOG database table and deletes all transactional remote Function Calls registered with CALL FUNCTION ... IN BACKGROUND TASK from database tables ARFCSSTATE and ARFCSDATA.

Removal of all SAP locks set in the current program in which the formal parameter _SCOPE of the lock function module was set to the value 2.

Triggers a database rollback, which also ends the current database-LUW.

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
429

Hi Suprith

During a program execution, when you change the database, that new data is not immediately written to the database..

When we use COMMIT WORK, it updates the database.. if it is successfull the sy-subrc value is 0.. if it fails we use ROLL-BACK.

ROLLBACK reverts back everything.. means all database changes that were tried in the last commit.

Thanks and Best Regards,

Sree