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 - action, factory →
RAP - Default Factory Action
Syntax
internal static default factory action
(
features: global
precheck
authorization:none
authorization:global
)
ActionName external 'ExternalName'
InputParameter
[cardinality]
{default function GetDefaultsForActName external 'GetDefaultsForExtName' ;}
Description
Exactly one static factory action per RAP BO entity can be defined as default static factory action using the syntax addition default
. The same rules apply as for factory actions, see topic RAP - action
, factory
.
The addition default
is evaluated by consuming frameworks, such as OData. These frameworks use the default factory action as standard action in certain scenarios.
Possible RAP BO operation additions to default factory actions:
Availability
- Managed RAP BO
- Unmanaged RAP BO
- For projection BOs, the following rules apply:
- The default factory action from the base BDEF can be reused. For details on reuse, see topic RAP -
use
, Projection and Interface BDEF. - It is also possible to specify a new default factory action in the projection layer. If the default factory action from the base BO is reused, and at the same time, a new default factory action is defined in the projection BDEF, the default factory from the projection is considered to be the default. It overwrites the default factory action from the base BDEF. Further details on actions and functions in projection BDEFs are described in topic RAP BDL - Actions and Functions.
- In RAP BO interfaces, default factory action from the base BDEF can be reused. For details on reuse, see topic RAP -
use
, Projection and Interface BDEF.
Example
The following example shows a managed BDEF which defines a static default factory action:
managed
implementation in class bp_demo_rap_default_factory_a unique;
strict ( 2 );
define behavior for DEMO_RAP_DEFAULT_FACTORY_A alias Root
persistent table demo_dbtab_root
lock master
authorization master ( global )
{
create;
update;
delete;
field(readonly:update) key_field;
static default factory action sdfa [1..*];
static factory action sfa [0..1];
}
The projection BDEF reuses the static default factory action from the base BDEF and specifies a new static default factory action. Consuming frameworks consider the static default factory action from the projection BDEF as default.
projection
implementation in class bp_demo_rap_dfa_pv unique;
strict ( 2 );
define behavior for DEMO_RAP_DFA_PV alias RootProjection
{
use create;
use update;
use delete;
use action sdfa;
use action sfa;
static default factory action sdfa_proj [1];
}