The statement ROLLBACK WORK closes the current
SAP LUW and opens a new one.
This cancels all change requests made by the current SAP LUW. To do this, ROLLBACK WORK carries out the following actions:
After the statement ROLLBACK WORK is completed, the event TRANSACTION_FINISHED
from the system class CL_SYSTEM_TRANSACTION_STATE is triggered. Here, the parameter KIND has the value of the constant CL_SYSTEM_TRANSACTION_STATE=>ROLLBACK_WORK.
Notes
All open database cursors
in the database connections concerned are closed during ROLLBACKs, which
means that a runtime error occurs when the system attempts to continue a SELECT
loop after a ROLLBACK. For the same reason, a
FETCH after a ROLLBACK on the cursor that is now closed also causes
a runtime error. Make sure that cursors that are still open are no longer used after the ROLLBACK.
After a ROLLBACK statement, sy-subrc is always
zero. It is not necessary to query whether sy-subrc is not equal to zero after ROLLBACK.
ROLLBACK must not be used during
updates
(CALL FUNCTION ... IN UPDATE TASK) or during the execution of subroutines
that were registered with PERFORM ... ON COMMIT or PERFORM ... ON ROLLBACK are running.
The statement ROLLBACK WORK must not be executed in units or LUWs that are managed by background RFC calls
(bgRFC and the (obsolete)
tRFC or qRFC).
The ROLLBACK WORK statement is executed implicitly if a
message of type A is handled
by the addition error_message when calling a function module with CALL FUNCTION.