ABAP - Keyword Documentation → ABAP RAP Business Objects → RAP - Behavior Definitions → RAP - BDL for Behavior Definitions → RAP - Abstract Behavior Definitions → RAP - Entity Behavior Definition, Abstract BDEF → RAP - Entity Behavior Body, Abstract BDEF → 

    RAP - Mapping, Abstract BDEF

    Syntax Forms


    Type Mapping

    ... mapping for PartnerType ...

    Deep Mapping

    ... deep mapping for NestedDeepDDICType [corresponding [extensible]] 
       {
          EntityComp1 = PartnerComp1
         [...] 
         [sub _Compos1 = Partnersub1][,
          sub _Compos2 = Partnersub2] 
         [...] 
        }
    ...

    Description


    RAP type mapping maps data types of the abstract BDEF to DDIC partner types. If the DDIC partner type is a flat structure and only elementary data types are mapped, flat type mapping can be used. If the DDIC partner type is a nested or deep structure, deep mapping can be used. It defines a mapping for nested table components or substructures.

    Alternative 1


    mapping for PartnerType ...

    Description


    To map elements to flat DDIC structures, type mapping using the syntax mapping for PartnerType can be used. The syntax is the same as for managed and unmanaged RAP BOs and it is described in topic RAP BDL - type mapping.

    Alternative 2


    deep mapping for NestedDeepDDICType ...

    Description


    In an abstract BDEF with hierarchy, mappings can be defined between the generated hierarchical derived types and nested or deep DDIC types. These mappings must be introduced with the keyword deep.

    The optional addition sub can be used for sub specifications. Child entities with a composition cardinality > 1 can be mapped to nested table components. If the composition cardinality is <= 1, a mapping to a substructure can be defined.

    Syntax for sub specification:

    sub _Compos1 = Partnersub1

    The left-hand side of a sub equation sub _Compos1 contains the name of a composition association of the entity. The right-hand side contains the name of a component PartnerComp1 of the nested or deep partner type NestedDeepDDICType. The components that are mapped onto each other must match, both must be either tables or structures. To cover the full hierarchical derived type, such a mapping must be defined for every entity in the abstract composition hierarchy and its corresponding partner type, with sub specifications for child entities at each level.

    The optional addition extensible enables BDEF extensions for the type mapping in question. That means that RAP BO consumers are allowed to add extension fields to that particular type mapping. extensible can only be used in combination with corresponding, so that components with the same name are automatically mapped to each other.

    Example: deep mapping for NestedDeepDDICType corresponding extensible;.

    For details on extensibility enabling, see topic RAP - Extensibility Enabling for Abstract BDEFs.

    Example


    The following abstract BDEF defines the behavior for three nodes of a CDS composition tree. For each entity, a mapping to a partner type is defined.

    abstract;
    strict(2);
    with hierarchy;

    define behavior for DEMO_CDS_ABSTRACT_ROOT alias Root
    {
      field ( suppress ) Dummy;

      deep mapping for DEMO_CDS_ABSTRACT_STRUC
      {
        char10 = char_10;
        Integer4 = integer_4;
        sub _itemStructure = struktur;
        sub _itemTable = tabelle;
      }

      association _itemTable;
      association _itemStructure;
    }

    define behavior for DEMO_CDS_ABSTRACT_ITEMSTRUCT alias ItemStructure
    {
      field ( suppress ) Dummy, ToRoot;

      deep mapping for DEMO_ABSTRACT_ITEMSTRUCT
      {
        Char10 = char_10;
        Integer4 = integer_4;
      }

      association _parent;
    }

    define behavior for DEMO_CDS_ABSTRACT_ITEMTABLE alias ItemTable
    {
      field ( suppress ) Dummy, ToRoot;

      deep mapping for DEMO_ABSTRACT_ITEMTABLE corresponding
      {
        Char10 = char_10;
        Integer4 = integer_4;
      }

      association _parent;
    }