Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  Data Consistency →  SAP LUW 


Quick Reference

Other versions: 7.31 | 7.40 | 7.54




... LEVEL idx


This statement registers the subroutine directly specified using subr in the same program. The subroutine is not executed immediately, but a flag is set for execution when one of the statements COMMIT WORK or ROLLBACK WORK is reached.

The registered subroutines are executed if the statement COMMIT WORK or ROLLBACK WORK is executed in their work process and before update function modules registered using CALL FUNCTION ... IN UPDATE TASK. Subroutines that are registered during execution of an update function module for COMMIT are executed at the end of the update. In non-local updates, this takes places in the update work process and in local updates in the current work process.

Programming Guideline

Do not implement in function modules and subroutines


  • Creating subroutines is obsolete. If new subroutines are required for PERFORM subr ON COMMIT or PERFORM subr ON ROLLBACK, they should only be used as wrapping for a method call and must not contain any other functional code.
  • Registered subroutines cannot have any parameter interface. Therefore, data can only be passed through external interfaces - for example, the ABAP memory. Subroutines that are executed in COMMIT WORK or ROLLBACK WORK are thus more suitable for management tasks, such as cleanup work at the end of a SAP LUW, than for database changes.
  • During processing of a registered subroutine after COMMIT WORK or ROLLBACK WORK, the statements PERFORM ... ON COMMIT, PERFORM ... ON ROLLBACK, COMMIT WORK, or ROLLBACK WORK must not be executed. Type "A" messages caught using the predefined exception error_message in function module calls execute the statement ROLLBACK WORK implicitly and are therefore also forbidden.
  • If, during the processing of a registered subroutine after COMMIT WORK, update function modules are registered using CALL FUNCTION ... IN UPDATE TASK, this registration still applies to the current SAP LUW.


... LEVEL idx


In the case of subroutines registered for COMMIT, the order of execution can be controlled using the addition LEVEL, where idx expects a data object of the type i. The execution then takes place, sorted according to ascending value of idx. idx has the value 0, if a value is not explicitly specified. If the value is the same as idx or if no value is specified, the order of execution is the same as the order of registration. A subroutine registered multiple times for COMMIT or ROLLBACK is executed once in each case.


Registers a subroutine insert of the same program for execution in the statement COMMIT WORK. The data is passed using the ABAP memory.

DATA(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 ) ). 

EXPORT values = values TO MEMORY ID 'INS'. 


FORM insert. 
  DATA values TYPE demo_update_tab. 
  IMPORT values = values FROM MEMORY ID 'INS'. 
  IF sy-subrc = 0. 

Executable Example