Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  ABAP RESTful Programming Model →  Behavior Implementations →  Saver Class 

CLEANUP method

The cleanup method is called when an error has occurred during the execution of the methods finalize and check_before_save. During the cleanup process, all calculations and data modifications are discarded and the transactional buffer is deleted.

The cleanup method is also called at the end of a successful saver sequence to delete the transactional buffer. Since the same ABAP session is likely to be used for more than one LUW, remaining changes in the transactional buffer can lead to inconsistencies.

The cleanup method does not have any parameters and does not return errors or messages.

Other versions: 7.31 | 7.40 | 7.54


Example

In the following example, the data from the ABAP flight data reference scenario (or flight data scenario for short) is used. It represents a legacy business logic that can be used to create and edit flight bookings. The root entity Travel represents the business object for managing flight trips. The underlying data model and the behavior of the root entity Travel are described in ABAP BDL - Example.

In the method cleanup, the function module of the legacy business logic /DMO/FLIGHT_TRAVEL_SAVE is called.

CLASS lcl_travel_saver DEFINITION
    INHERITING FROM cl_abap_behavior_saver.

  PROTECTED SECTION.
    METHODS cleanup REDEFINITION.

ENDCLASS.
CLASS lcl_travel_saver IMPLEMENTATION.

  METHOD cleanup.
    CALL FUNCTION '/DMO/FLIGHT_TRAVEL_INITIALIZE'.
  ENDMETHOD.

ENDCLASS.
FUNCTION flight_travel_initialize.
  /dmo/cl_flight_legacy=>get_instance( )->initialize( ).
ENDFUNCTION.