ABAP for Cloud Development
AS ABAP Release 914, ©Copyright 2024 SAP SE. All rights reserved.
ABAP - Keyword Documentation → ABAP RAP Business Objects → ABAP for RAP Business Objects → ABAP for Providing RAP Business Objects → ABAP Behavior Pools (ABP) → RAP Saver Class and Methods → RAP Saver Methods →
save_modified, RAP Saver Method
Syntax
Declaration part:
CLASS lsc_bdef DEFINITION INHERITING FROM base_class ...
...
METHODS save_modified REDEFINITION.
...
ENDCLASS.Implementation part:
CLASS lsc_bdef IMPLEMENTATION.
...
METHOD save_modified.
...
ENDMETHOD
...
ENDCLASS.
Description
RAP saver method that is declared as part of a RAP saver class lsc_bdef
in the CCIMP include of an ABAP behavior pool. The predefined saver method must be redefined.
base_class
stands for the base class from which the RAP saver class inherits, for example, CL_ABAP_BEHAVIOR_SAVER
.
The following points are relevant for this RAP saver method:
- Its use is mandatory.
- It is only available for managed scenarios that include an additional or unmanaged save implementation. In this case, the RAP saver method
save
cannot be used. See the BDEF prerequisites in RAP -SavingOptions
. - It is responsible for saving the current state of the transactional buffer, i.e. all RAP BO instances (including instances from cross-BO relationships) from within the current RAP transaction, to the database. However, the method is only called if each of the previous RAP saver methods has been processed successfully without any failures.
- It has the following implicit, predefined
IMPORTING
parameters: create
: Includes information on instances that have been created within the current RAP transaction. It is of typeTYPE REQUEST FOR CHANGE
.update
: Includes information on instances that have been updated within the current RAP transaction. It is of typeTYPE REQUEST FOR CHANGE
.delete
: Includes information on instances that have been deleted within the current RAP transaction. It is of typeTYPE REQUEST FOR DELETE
.- It has the following implicit, predefined
CHANGING
parameters when usingCL_ABAP_BEHAVIOR_SAVER
as base classbase_class
from which the RAP saver class inherits: reported
: RAP response parameter that is of typeTYPE RESPONSE FOR REPORTED LATE
.
Hints
- After persisting data to the database, it is recommended that the transactional buffer is cleared (using the RAP saver method
cleanup
if it is available and can be user-implemented) because the same ABAP session might be used for more than one RAP transaction and any remaining changes in the transactional buffer could lead to inconsistencies. - The method is part of the RAP late save phase.
Further Information
Development guide for the ABAP RESTful Application Programming Model, section Save Sequence Runtime.
Executable Example
- The example ABAP EML -
TYPE REQUEST FOR
in a Managed RAP BO with Additional Save demonstrates thesave_modified
method in the context of a simple managed RAP BO whose BDEF is specified withwith additional save
. - The example ABAP EML -
TYPE REQUEST FOR
in a Managed RAP BO with Unmanaged Save demonstrates thesave_modified
method in the context of a simple managed RAP BO whose BDEF is specified withwith unmanaged save
.