SAP BDL ACTION NONFACTORY



Get Example source ABAP code based on a different SAP table
  



ABAP_RAP - action, Non-Factory

ABAP_SYNTAX
$[internal$] $[static$] $[repeatable$] action
$[(
$[features: ${instance $| global$}$]
$[precheck$]
$[ authorization:none$]
$[ authorization:update$]
$[lock:none$]
)$]
ActionName $[external 'ExternalName'$]
$[InputParameter$]
$[OutputParameter $]

ABAP Addition
1 ... lock:none
2 ... external

What does it do?
Defines a RAP action which offers non-standard behavior. The custom logic must be implemented in the RAP handler method FOR MODIFY. An action per default relates to a RAP BO entity instance and changes the state of the instance.
If the optional keyword static is used, the action is defined as static action. Static actions are not bound to any instance of a RAP BO entity but relate to the complete entity. The default is that an action is related to an instance , so the keyword static overwrites the default.
The optional addition repeatable declares a non-factory, instance-bound action as RAP repeatable action. A repeatable action can be executed multiple times on the same RAP BO entity instance within the same ABAP EML or OData request. A RAP action without the addition repeatable must not be executed multiple times on the same entity instance within the same request. Otherwise, a runtime error occurs. For further details, see topic TITLE .
The following RAP BDL operation additions are possible:
internal to make the respective action accessible only from within the business object implementation.
Dynamic feature control with (features:instance). This enables or disables the action depending on preconditions within the business object. For example, the action Accept_Order might be offered only if the status is not Rejected already.
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. ABAP_NOTE For static actions, the addition authorization:none is available only in case of global authorization.
authorization:update delegates the authorization control to the authorization check that is implemented for the update operation.
Input parameters InputParameter and output parameters OutputParameter can optionally be added to the action signature.

ABAP_AVAILABILITY
Managed RAP BO
Unmanaged RAP BO
In a projection BO, actions from the base BDEF can be reused. For details on reuse, see topic TITLE . It is also possible to specify new actions as described in topic RAP BDL - actions and functions, projection BDEF.
ABAP_AVAILABILITY_END

ABAP_FURTHER_INFO
Development guide for the ABAP RESTful Application Programming Model, section about Actions.

ABAP_EXAMPLE_VX5
The following example shows a managed BDEF based on the CDS root view entity DEMO_CDS_PURCH_DOC_M. The business object represents a purchase order with purchase order items. If an employee wants to order equipment, the manager can approve or reject this purchase. Therefore, the two actions Approve_Order and Reject_Order are defined.
BDEF DEMO_CDS_PURCH_DOC_M
The actions are implemented in behavior pool BP_DEMO_CDS_PURCH_DOC_M . The class CL_DEMO_CDS_PURCHASE accesses the business object using EML and performs the Approve_Order action on one entity instance.
Result: column Status of the respective instance is filled with A for Accepted.
IMAGE ABDOC_ACTION.png 305 114
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
The example above is explained in detail in the executable example RAP BDL - action.
ABAP_EXAMPLE_END

ABAP Addition

What does it do?
Prevents the locking mechanism for the entity instance for which an action is executed. Since static actions are not related to a specific instance, they are non-locking by definition and this syntax element is not applicable.
ABAP_NOTE The locking mechanism is only prevented for the action itself. Possible modify calls in the action implementation are not affected by the non-locking specification in the action definition. Consequently, an instance is locked if it is modified by an action even if the action is defined as non-locking.

ABAP Addition

What does it do?
The optional addition external can be used to provide an alias name for the action for external usage. This external name is exposed in the OData metadata, but it is not known by ABAP. It can be much longer than the actual action name.