Skip to content

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

Method SAVE

The method save of the local saver class is the fourth method of the saver sequence of the behavior implementation of a business object. It is called to save all data of the business object instance from the transactional buffer to the database.

The method save does not have any output parameters and does not return any failed keys or messages.

The implementation of the method save is mandatory.

Once the data is saved to the database, the transactional buffer is deleted. This is because the same ABAP session is potentially used for more than one LUW and any remaining changes in the transactional buffer can cause inconsistencies.

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 save, 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 save REDEFINITION.

ENDCLASS.
CLASS lcl_travel_saver IMPLEMENTATION.

  METHOD save.
    CALL FUNCTION '/DMO/FLIGHT_TRAVEL_SAVE'.
  ENDMETHOD.

ENDCLASS.
FUNCTION /dmo/flight_travel_save.
  /dmo/cl_flight_legacy=>get_instance( )->save( ).
ENDFUNCTION.