SAP BDL TYPE MAPPING



Get Example source ABAP code based on a different SAP table
  


• MAPPING FOR ABAP_BDL_BODY
• CORRESPONDING ABAP_BDL_BODY
• CONTROL ABAP_BDL_BODY
• EXCEPT ABAP_BDL_BODY
• PARAMETER ABAP_BDL_BODY , MAPPING FOR

ABAP_RAP - Type Mapping

ABAP_SYNTAX
... mapping for PartnerType $[control ControlType$]
${$[corresponding $[ extensible$] $[except Comp1, Comp2, ...$]$]$}
{
EntityComp1 = PartnerComp1 $[control ControlComp$];
$[EntityComp2 = PartnerComp2 $[control ControlComp$];$]
$[parameter Param1 = PartnerComp;$]
$[... ;$]
}
$| mapping for PartnerType $[control ControlComp$]
corresponding $[ extensible$]$[except Comp1, Comp2, ...$];
...

ABAP Addition
1 ... control
2 ... corresponding $[except$]
3 ... corresponding extensible

What does it do?
RAP type mapping maps data types of the data model that is defined in CDS for a RAP BO to other data types that do not the match BDEF derived type component pattern. Type mapping is useful for applications whose business object implements existing types or existing functions. The mapping connects a BDEF derived type to an existing DDIC type in the behavior definition of a business object.
PartnerType is the name of a DDIC structure. Within curly brackets, components that correspond to each other but do not have the same name are mapped to each other.
It is also possible to map the input parameters of actions and functions to existing types. Within the curly brackets, the keyword parameter must be used. Param1 is the name of an input parameter of an action or function.
If the names of the fields of the DDIC structure and in the current data model are exactly the same, no mapping is required. Otherwise, it is mandatory (syntax check warning).
No implementation in an ABAP behavior pool is required.

ABAP_AVAILABILITY
Managed RAP BOs
Unmanaged RAP BOs
Projection BOs
Abstract BDEFs
ABAP_AVAILABILITY_END

ABAP_FURTHER_INFO
Development guide for the ABAP RESTful Application Programming Model, topic Using Type and Control Mapping.

ABAP_EXAMPLE_VX5
The following example shows a managed BDEF based on the CDS root view entity DEMO_RAP_MANAGED_ASSOC_ROOT. A type mapping from the fields of the database table to the fields of the BO entities is defined. This is required since the fields of the CDS view entities have alias names and therefore differ from the field names of the database table.
ABAP_NOTE This example does not fully meet the requirements of the RAP BO contract. It is intentionally kept short and simple and serves demonstration purposes only. See more information on the RAP BO contract in the Development guide for the ABAP RESTful Application Programming Model.
BDEF DEMO_RAP_MANAGED_ASSOC_ROOT
ABAP_EXAMPLE_END

ABAP Addition

What does it do?
control maps a type of the RAP business object to a control structure. A control structure has the same components as PartnerType with the difference that all components have the built-in ABAP type c(1) or x(1). Its function is to indicate which of the fields are accessed by an operation. The control structure works analogous to the %control structure in derived types. A mapping can be done simultaneously for a main type PartnerType and for a control type ControlType.
In a standard use case, the field names of the main and the control types should be identical. If this is not the case, fields can be mapped to each other using the addition control.
If a component of the main structure is missing in the control structure , this is tolerated and leads to two independently executable mappings.

ABAP Addition

What does it do?
The optional addition corresponding defines that components with the same name are automatically mapped to each other. The addition except can be specified together with corresponding to exclude components with identical names from the automatic mapping.
Example: mapping for PartnerType corresponding;.

ABAP Addition

What does it do?
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: mapping for PartnerType corresponding extensible;.
For details on extensibility enabling, see topic TITLE .