Get Example source ABAP code based on a different SAP table
• ASSOCIATION ABAP_BDL_ABSTRACT • WITH HIERARCHY ABAP_BDL_ABSTRACT , ASSOCIATION
ABAP_RAP - Associations, Abstract BDEF
ABAP_SYNTAX ... association _Assoc $[with hierarchy$];>
What does it do? Includes a CDS association> in the hierarchical BDEF derived type>. The keyword association> is used for associations, compositions>, and to-parent associations>. An entity whose child entity is included in the same abstract BDEF> must > specify the respective composition using the keyword association >. If no behavior is defined for a subnode, then the respective composition must not> be specified. The optional addition with hierarchy> can be used for associations only if with hierarchy>> is also specified in the BDEF header. It can be used for to-parent associations and for cross-BO associations>. An association with this addition is handled like a composition: the target type is integrated (as structure or table, depending on the cardinality) into the source type. As a result, the association in question is included several times in the type structure. The definable structure thus generalizes from type tree to DAG (directed acyclic graph). The association target> of an association with the addition with hierarchy> must be covered by an abstract BDEF with hierarchy>. Typically, to-parent associations with hierarchy> are used for local sub-structures, while cross-BO associations serve reuse. Type mappings> to other DDIC types continue to be defined in the BDEF containing the respective entity. Thus, if a hierarchical type is defined with cross-BO associations, its mapping to a hierarchical DDIC type spreads out across multiple abstract BDEFs.
ABAP_EXAMPLE_VX5 The following abstract BDEF defines behavior for four nodes, including intra- and cross-BO associations. BDEF DEMO_CDS_SCALAR_ROOT ABAP_EXAMPLE_END