ROLLBACK (SAP ABAP Keyword)

ROLLBACK is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.

ROLLBACK

Basic form
ROLLBACK WORK.

Effect
Closes a logical processing unit by reversing all database changes made since the last COMMIT .

You use this statement if you cannot be certain that all the database changes have been executed correctly.

The update routines are not performed.

ROLLBACK WORK belongs to the Open SQL command set.

Note
If
the ROLLBACK statement occurs within a SELECT loop, the processing
cannot continue because the database cursor is invalid. After the
ROLLBACK statement, you should therefore ensure that all SELECT
processing has been explicitly terminated.

Note
Runtime errors

ROLLBACK_IN_PERFORM_ON_COMMIT : ROLLBACK WORK is not allowed in a FORM called with PERFORM … ON COMMIT .
ROLLBACK_IN_POSTING : ROLLBACK WORK is not allowed in the update task.