What does it do? Defines the behavior for a RAP abstract behavior definition> in the RAP BDL >. The abstract behavior definition must be based on a root CDS abstract entity> AbstractEntity> and it can define the behavior for one or more of the nodes of the CDS composition tree>. For each node of the CDS composition tree, there are two possibilities how to include them in the behavior definition:
A node can be integrated into the hierarchical type as a structured type using the syntax define behavior for>. In this case, an entity behavior body> is mandatory.
A node can be integrated into the hierarchical type as a scalar type using the syntax scalar entity>. Both alternatives are described with their additions below.
ABAP_EXAMPLE_VX5 The following example shows an abstract BDEF with two nodes, one of them being a scalar entity. BDEF DEMO_CDS_SCALAR_ROOT_1 ABAP_EXAMPLE_END
ABAP Alternative 1 ... define behavior for ...>
What does it do? Entity behavior definition> for a CDS abstract entity. It can consist of the following additions and components:
alias>: an alias name can be specified using the keyword alias >. The length of an alias name AliasName> is restricted to 30 characters.
with control> is an optional addition that adds a %control>> structure to the corresponding derived type structure. That means that for each component of the hierarchical type, stemming either from an entity field or from an association, an identically named component of the built-in ABAP type x(1)> > is added as part of the structure %control> which is appended at the end. As a result, all or some levels of the hierarchical types contain %control> components which may be used by applications to indicate the provisioning of the equally named payload components. As a prerequisite to use with control>, the abstract BDEF must use the addition with hierarchy>>.
An entity behavior body> is mandatory and it can define field characteristics, associations, or type mapping. Transactional behavior is not possible in an abstract BDEF.
Latest notes: Entity behavior characteristics> cannot be specified for abstract BDEFs. NON_V5_HINTS ABAP_HINT_END • SCALAR ENTITY ABAP_BDL_ABSTRACT • FIELD ABAP_BDL_ABSTRACT , SCALAR ENTITY
ABAP Alternative 2 ... scalar entity ...>
What does it do? An entity in the CDS composition tree can be integrated into the hierarchical type not as a structured type, but as a scalar type, for example, an integer or a character. This is often defined for leaf entities>. For a scalar type, the following syntax must be used instead of the usual define behavior for> syntax: ... scalar entity AbstractEntity field FieldName;> The specified field FieldName> of the scalar entity AbstractEntity> is taken for the scalar type. All other entity fields are ignored. Suppressing unwanted fields and type mappings are irrelevant. It is also possible to declare the root node as scalar entity. Then the complete hierarchical type turns into one scalar type. This enables entity-based action parameter types which are elementary> or internal tables> with elementary line types>.