ABAP - Keyword Documentation →  ABAP - Programming Language →  Processing External Data →  ABAP Database Access →  Data Consistency →  SAP LUW → 
Mail Feedback

ROLLBACK WORK

Short Reference

Syntax

ROLLBACK WORK.

Effect

The statement ROLLBACK WORK closes the current SAP LUW and opens a new one. This cancels all changes requests made by the current SAP LUW. To do this, ROLLBACK WORK performs the following actions:

  1. Executes all subroutines registered using PERFORM ON ROLLBACK.
  2. Deletes the registrations of all subroutines registered using PERFORM ON COMMIT.
  3. Raises an internal event in the Object Services that ensures that the attributes of persistent objects are initialized.
  4. Deletes all update function modules registered with CALL FUNCTION ... IN UPDATE TASK from the DDIC database tables VB... and deletes all Remote Function Calls registered with CALL FUNCTION ... IN BACKGROUND UNIT or CALL FUNCTION ... IN BACKGROUND TASK (obsolete) from the DDIC database tables ARFCSSTATE and ARFCSDATA.
  5. Removes all SAP locks set in the current program for which the formal parameter _SCOPE of the lock function module was set to the value 2.
  6. Triggers a database rollback on all currently open database connections, which also ends the current database LUW.

After the statement ROLLBACK WORK is completed, the event TRANSACTION_FINISHED from the system class CL_SYSTEM_TRANSACTION_STATE is raised. Here, the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>ROLLBACK_WORK.

Hints



Example

The statement ROLLBACK WORK deletes the registration of update function modules using the statements CALL FUNCTION IN UPDATE TASK and calls the subroutine cleanup.

PERFORM cleanup ON ROLLBACK.

...

CALL FUNCTION 'DEMO_UPDATE_DELETE' IN UPDATE TASK.

...

FINAL(values) = VALUE demo_update_tab(
  ( id = 'X' col1 = 100 col2 = 200 col3 = 300 col4 = 400 )
  ( id = 'Y' col1 = 110 col2 = 210 col3 = 310 col4 = 410 )
  ( id = 'Z' col1 = 120 col2 = 220 col3 = 320 col4 = 420 ) ).

CALL FUNCTION 'DEMO_UPDATE_INSERT' IN UPDATE TASK
  EXPORTING
    values = values.

...

ROLLBACK WORK.

...

FORM cleanup.
  ...
ENDFORM.

Executable Example

The example Demonstrating the SAP LUW demonstrates the SAP LUW, covering the ROLLBACK WORK statement.

Exceptions

Uncatchable Exceptions