Ansicht
Dokumentation

ABENBDL_DEFINE_BEH_ABSTRACT - BDL DEFINE BEH ABSTRACT

ABENBDL_DEFINE_BEH_ABSTRACT - BDL DEFINE BEH ABSTRACT

BAL Application Log Documentation   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

- Entity Behavior Definition, Abstract BDEF

${${ define behavior for AbstractEntity $[alias AliasName$] $[with control$]
  {
   entity behavior body
  }
$}
$| scalar entity AbstractEntity field FieldName $}

$[behavior for ChildEntity1$]$[, behavior for ChildEntity2$]$[, ...
$]


Alternatives:

1. ... define behavior for

2. ... scalar entity ...

Effect

Defines the behavior for a CDS abstract behavior definition in the CDS 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.

Example

The following example shows an abstract BDEF with two nodes, one of them being a scalar entity.

Alternative 1

... define behavior for ...


Effect

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.

Note

Entity behavior characteristics can't be specified for abstract BDEFs.

Alternative 2

... scalar entity ...


Effect

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.

As a prerequisite to use with control, the abstract BDEF must use the addition with hierarchy.






CPI1466 during Backup   General Material Data  
This documentation is copyright by SAP AG.

Length: 7406 Date: 20240512 Time: 025831     sap01-206 ( 86 ms )