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 - BDEF Extension → RAP - Abstract BDEF Extension →
RAP - extension for abstract
Syntax
extension for abstract;
extensible;
define behavior for ...
extend behavior for ...
scalar entity ...
...
Description
Extends an existing abstract behavior definition using an abstract BDEF extension in the RAP BDL. An abstract behavior definition can have one or more abstract BDEF extensions. The number of extensions is not limited.
An abstract BDEF extension can have the following components:
extensible
: if specified, extension layering is allowed. For details, see RAP - Extensibility Enabling for Abstract BDEF Extensions.define behavior for
: Adds a new node to the hierarchical type of the abstract BDEF using the statementdefine behavior for
.extend behavior for
: Extends an existing node using the statementextend behavior for
.scalar entity
: Adds a new scalar entity to the hierarchical type.
Example
The abstract BDEF extension DEMO_RAP_ABSTRACT_X
extends the abstract behavior definition DEMO_RAP_ABSTRACT_ROOT
.
- It extends the behavior of the root node.
- It adds the scalar entity
DEMO_RAP_ABSTRACT_5
. - It adds the extension node
DEMO_RAP_ABSTRACT_4
using the syntaxdefine behavior for
.
extension for abstract;
extensible;
extend behavior for DEMO_RAP_ABSTRACT_ROOT
{
association _item3;
extend deep mapping for demo_rap_struc_x
{
sub _Item3 = sub_3;
}
}
scalar entity DEMO_RAP_ABSTRACT_5 field comp3;
extend behavior for DEMO_RAP_ABSTRACT_1
{
association _x1;
}
define behavior for DEMO_RAP_ABSTRACT_4
with control
extensible
{
field ( suppress ) comp1, comp2;
}
Alternative 1
... define behavior for ...
Prerequisites
- As a prerequisite, the original abstract behavior definition must explicitly allow BDEF extensions as described in topic RAP - Extensibility Enabling for Abstract BDEFs.
- The extension node must be added to the RAP data model via RAP data model extensions.
Description
An extension node adds a new node to the hierarchical type of the abstract BDEF using the statement define behavior for
. Field characteristics, associations, and type mappings can be specified for the extension node in the same way as for abstract BDEFs. There is only one difference: the attribute mandatory:execute
is not available in abstract BDEF extensions, neither for fields, nor for associations.
For details, see the topic RAP - Entity Behavior Body, Abstract BDEF.
Alternative 2
... extend behavior for ...
Description
Extends an existing node of an abstract BDEF. As a prerequisite, extensions must be explicitly enabling as described in the topic RAP - Extensibility Enabling for Abstract BDEFs.
Options:
- The field characteristic
suppress
can be specified for extension fields. - Associations that have an extension node as association target can be added.
- An existing type mapping can be extended. As a prerequisite, the original type mapping must explicitly allow extensions as described in the topic RAP - Extensibility Enabling for Abstract BDEFs.
- A new RAP type mapping to a partner type can be added. This type mapping can only contain extension fields. It must not contain any fields from the original data model. The syntax is exactly the same as for abstract BDEFs, see topic RAP - Mapping, Abstract BDEF.
Alternative 3
... scalar entity ...
Description
A new scalar entity can be integrated into the hierarchical type as scalar type. This scalar entity must be an extension node, which means it must be added to the data model via RAP data model extensions. The syntax is exactly the same as for abstract BDEFs, see the topic RAP - Entity Behavior Definition, Abstract BDEF.