ABAP for Cloud Development
AS ABAP Release 914, ©Copyright 2024 SAP SE. All rights reserved.
ABAP - Keyword Documentation → ABAP RAP Business Objects → RAP - Behavior Definitions → RAP - BDL for Behavior Definitions → RAP - Managed and Unmanaged Behavior Definitions → RAP - EntityBehaviorDefinition → RAP - EntityBehaviorBody → RAP - RAP BO Operations → RAP - Non-Standard Operations → RAP - action →
RAP - save action
Syntax
internalstatic factory
save(finalize adjustnumbers finalize, adjustnumbers) action
(
features: global
precheck
authorization:none
authorization:global
authorization:instance
)
ActionName external 'ExternalName'
InputParameter
OutputParameter ;
{default function GetDefaultsForActName external 'GetDefaultsForExtName' ;}
Description
Defines a RAP save action. RAP save actions are RAP actions that can only be called during a specified RAP saver method in the RAP save sequence. Any call during the RAP interaction phase leads to a short dump.
Save actions are characterized by the syntax addition save
. The name of the RAP saver method during which the action can be executed is specified in brackets. finalize
, adjustnumbers
, or both can be specified in brackets to indicate the saver method during which the action can be called.
Non-factory actions and factory actions (instance-bound and static) can be defined as save action. A default factory action, however, cannot be a save action. The respective syntax rules of the kind of action apply (non-factory, static factory, instance-bound factory).
The following RAP BDL operation additions are allowed for save actions:
internal
to make the respective action accessible only from within the business object implementation.- Global feature control with
(features:global)
enables or disables the action depending on BO-external preconditions. precheck
prevents unwanted changes from reaching the application buffer.authorization:none
excludes the operation in question from authorization checks.authorization:global
replaces the authorization control that is specified in the authorization master entity and applies global authorization checks instead.authorization:instance
replaces the authorization control that is specified in the authorization master entity and applies instance authorization checks instead.- Input parameters
InputParameter
and output parametersOutputParameter
can optionally be added to the action signature. default function
defines a RAP default values function for the action in question. It is an optional addition that can be used to default values for the input parameter of the action. As a prerequisite, the action must specify an input parameter.
Calling RAP Save Actions
A RAP save action can be called in the following contexts:
- From an external RAP BO consumer.
- In the ABAP behavior pool, from a
finalize
oradjust_numbers
RAP saver method, according to the specification in brackets. - A
save(finalize)
action can be called from the implementation of a RAP determinationon save
. - Note: This does not apply to
save(adjustnumbers)
actions.save(adjustnumbers)
actions must not be called in determinationson save
. Any attempt to do so results in a short dump. - Caution: If a determination
on save
is executed as part of a RAP BO determine action, the execution takes place during the interaction phase. Therefore, if a RAP save action is called in a determinationon save
and the determination is executed as part of a determine action, a short dump occurs.
RAP save actions must not be called in the following contexts:
- A RAP saver method other than the one specified in brackets. For example, a
save(finalize)
action must not be called during the RAP saver methodadjust_numbers
. Any attempt to do so leads to a syntax check error. - In the implementation of a RAP determination
on modify
. If this is done, a short dump occurs. - If called from the implementation of any other RAP handler method, a short dump occurs.
- Note: Save actions cannot be called from other save actions of the same saver method. For example, a
save(adjustnumber)
cannot call anothersave(adjustnumber)
action. Any attempt to do so results in a short dump.
Availability
- Managed RAP BO
- Unmanaged RAP BO
- In a projection BO, save actions from the base BDEF can be reused. For details on reuse, see topic RAP -
use
, Projection and Interface BDEF. - In a RAP BO interface, save actions from the base BDEF can be reused. For details on reuse, see topic RAP -
use
, Projection and Interface BDEF.
Hints
- Save actions without a RAP saver method specification are obsolete. The following syntax is not valid:
save action MySaveAction
. Existing save actions that do not specify a RAP saver method in brackets are automatically interpreted assave(finalize)
. - RAP save actions are required for the RAP representation of certain existing functionality which does not maintain a transactional buffer but (from a RAP perspective) only has a save phase.
Further Information
Development guide for the ABAP RESTful Application Programming Model, section about Actions.