SAP BDL FIELD ABSTRACT



Get Example source ABAP code based on a different SAP table
  


• FIELD ABAP_BDL_ABSTRACT
• SUPPRESS ABAP_BDL_ABSTRACT
• MANDATORY EXECUTE ABAP_BDL_ABSTRACT

ABAP_RAP - Field Characteristics, Abstract BDEF

ABAP_SYNTAX
... field(suppress) Field1, Field2, ...;
$| (mandatory:execute) Field1, Field2, ...;

ABAP_VARIANTS:
1 ... field(suppress) Field1, Field2, ...
2 ... field(mandatory:execute) Field1, Field2, ...

What does it do?
This topic lists field attributes for the fields of an abstract BDEF.
Commas can be used to classify multiple fields in the same way. Example: field(suppress) Field1, Field2, Field3;.

ABAP_VARIANT_1 ... field(suppress) Field1, Field2, ...

What does it do?
Removes a field from all derived types generated for the BDEF. In particular, the redundancy is avoided in the TYPE TABLE FOR HIERARCHY / TYPE STRUCTURE FOR HIERARCHY types.
This is possible for all fields except for key fields and fields used by the current BDEF.



Latest notes:

A typical use case for field(suppress) was to exclude foreign-key fields used in the ON condition of the to-parent association to appear redundantly in the hierarchical type. This was particularly useful when it was still mandatory to define an ON condition in to-parent associations of CDS abstract entities. However, since release ABAP_785 , the ON condition can be left out.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The following abstract BDEF suppresses one field from its derived type.
BDEF DEMO_CDS_SCALAR_ROOT_3
ABAP_EXAMPLE_END

ABAP_VARIANT_2 field(mandatory:execute) Field1, Field2, ...

What does it do?
Declares a field of an abstract BDEF as mandatory. Whenever the hierarchical type is used as input parameter for a RAP action or a RAP function, a value must be supplied. Otherwise, a runtime error occurs.
As a prerequisite, the addition with hierarchy must be used in the behavior definition header and ABAP Alternative 1@1@>with control must be specified for the entity behavior definition in question. Moreover, BDEF strict mode must be enabled.



Latest notes:

When using IN LOCAL MODE, mandatory:execute does not have any effect.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The following abstract BDEF defines the field NUM1 as mandatory:execute. It fulfills the mandatory prerequisites and uses both the additions with hierarchy and with control.
BDEF DEMO_ABSTRACT_ROOT
This abstract BDEF is used as input parameter for the action ACTION_DEEP_PARAM in the managed BDEF DEMO_MANAGED_HIERARCHY .
BDEF DEMO_MANAGED_HIERARCHY
The ABAP class CL_DEMO_MANDATORY_EXECUTE executes the action ACTION_DEEP_PARAM. It supplies a value for the field NUM1 and sets the %control structure for this field to if_abap_behv=>mk-on.
Code Snippet:
ABEXA 01724
The following code results in a runtime error, since the %control structure for field NUM1 is set to if_abap_behv=>mk-off.
Code Snippet:
ABEXA 01725
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
An executable example is available in topic Using TYPE TABLE /TYPE STRUCTURE FOR HIERARCHY.
ABAP_EXAMPLE_END