SAP PERFORM SUBR ABAP Statements

Get Example source ABAP code based on a different SAP table
  



PERFORM - ON COMMIT, ROLLBACK

Short Reference
• PERFORM ON ABAP Statement
• ON COMMIT PERFORM
• ON ROLLBACK PERFORM


ABAP Syntax PERFORM subr ON { {COMMIT [LEVEL idx]} | ROLLBACK
}.

ABAP Addition
... LEVEL idx

What does it do? 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 non-local update in the update work process.

ABAP_PGL No implementations in function modules and subroutines

Latest notes: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 coding.
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. During the processing of a registered subroutine after COMMIT WORK using CALL FUNCTION ... IN UPDATE TASK, registered booking function modules are still registered for the current SAP-LUW.
INTHINT During the execution of a subroutine that was
INTHINT registered with ON COMMIT,
INTHINT the internal system field sy-oncom
INTHINT has the value 'P'. Instead of sy-oncom the system class
INTHINT CL_SYSTEM_TRANSACTION_STATE should be used in programs.
• LEVEL PERFORM ON

ABAP Addition

What does it do? In the case of subroutines registered for COMMIT, the execution sequence can be controlled using the addition LEVEL , whereby for idx a data object of the type i is expected. 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 that same as idx or if there is no specification, the sequence of execution is the same as the registration sequence. A subroutine registered multiple times for COMMIT or ROLLBACK is executed once in each case.

Return to menu