ROLLBACK WORK

Short Reference

Variants:

1. ROLLBACK WORK.

2. ROLLBACK CONNECTION con.

Effect

Terminates a SAP-LUW without storing the changes.

Variant 1

ROLLBACK WORK.

Effect

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:

  1. Executes all subprograms registered with PERFORM ON ROLLBACK.

  2. Deletes all subprograms registered with PERFORM ON COMMIT.

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

  4. 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.

  5. 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.

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

After completion of the statement COMMIT WORK, the event TRANSACTION_FINISHED of the system class CL_SYSTEM_TRANSACTION_STATE is raised, in which the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>ROLLBACK_WORK.

Variant 2

ROLLBACK CONNECTION con.

Note

This statement is for internal use only.
It cannot be used in application programs.

Effect

The ROLLBACK-statement is not executed on the standard database but only on the secondary database connection, specified through con. con is the name of the database connection as it was specified in table DBCON in column CON_NAME. The database connection con can also be specified dynamically in the form (source_text), in which the field source_text contains the name of the database connection. The field source_text must be of the type C or STRING.

Notes

  1. As all opened database cursors on the respective database connections are closed at ROLLBACK, the attempt to continue a SELECT-loop after a ROLLBACK, leads to a runtime error. Due to the same reason, a FETCH after a ROLLBACK to the then closed cursor, leads to a runtime error. You have to make sure that cursors that are still open, are no longer used after ROLLBACK.

  2. After execution of the statement ROLLBACK, SY-SUBRC is always equal to 0. It is not necessary to check if SY-SUBRC is unequal to 0 after ROLLBACK.

  3. ROLLBACK must not be used during update (CALL FUNCTION ... IN UPDATE TASK) or during the execution of FORMs, which were registered with PERFORM ... ON COMMIT resp. PERFORM ...ON ROLLBACK.

  4. The statement ROLLBACK WORK is implicitly executed if a message of the type A is treated with the addition ERROR_MESSAGE when calling a function module with CALL FUNCTION.


Exceptions

Non-Catchable Exceptions