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 - Abstract Behavior Definitions →
RAP - Behavior Definition Header, Abstract BDEF
Syntax
abstract;
strict (version) ;
extensible;
with hierarchy like entity ;
entity behavior definition ...
Description
The RAP behavior definition header of an abstract BDEF can define the attributes listed below. The implementation type is mandatory; strict
and (version)with hierarchy
are strongly recommended for the following reasons: strict mode ensures that no outdated syntax can be used. When leaving out with hierarchy
, the abstract BDEF represents the same BDEF derived type as a single CDS abstract entity and does not offer any additional value.
abstract
: An abstract BDEF must have the implementation typeabstract
.strict
(version): It is strongly recommended that the most recent version of BDEF strict mode is used.- extensible: If specified, BDEF extensions are allowed. As a prerequisite, BDEF strict mode must be switched on using the keyword
extensible
. For more details, see the topic RAP -extensible
. with hierarchy
: like entity- The optional addition
with hierarchy
causes the construction of a new kind of BDEF derived type for the entities that are part of the BDEF: starting from the RAP BO root entity, such a type contains all entity fields, plus a component for each CDS composition. For a composition with a unique target cardinality, i.e.TO ONE
orTO EXACT ONE
, this component is a structure; otherwise, the component is a table. The type of the component (or its line type) is defined recursively in the same way, down to the leaf level in the CDS composition hierarchy. - The addition
like entity
can optionally be used in combination withwith hierarchy
. It guarantees that the hierarchical BDEF derived type that is constructed from the abstract BDEF is equivalent to the underlying CDS type that is derived from the abstract entity. The additionwith hierarchy like entity
enforces the following additional syntax rules: - - The abstract BDEF in question must not contain any CDS compositions in its BDEF derived type.
- - The field attribute
suppress
is not allowed, as this would create a difference in BDEF derived types between the underlying abstract entity and the abstract BDEF. - - The field attribute
mandatory:execute
is not allowed. - - The optional addition
with control
is not allowed.
The behavior definition header is followed by an entity behavior definition.
Hints
- The addition
with hierarchy
is a precondition for the following components of an abstract BDEF: - The addition
with hierarchy like entity
ensures that the derived type of the behavior definition is equivalent to the structure type of the underlying abstract entity. This ensures compatibility between the BDEF type and the CDS type. The advantage of the BDEF (over using the CDS type) is that it allows additional type mappings to be defined.