Documentation View

We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!

ABAPEML_CORRESPONDING - EML CORRESPONDING

ABAPEML_CORRESPONDING - EML CORRESPONDING

Addresses (Business Address Services)   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

CORRESPONDING, Type Mapping for

    ${ ntype = CORRESPONDING ${dtype$|#$}( in_d_type MAPPING FROM ENTITY ) $}
  $| ${ out_d_type = CORRESPONDING ${dtype$|#$}( ntype MAPPING TO ENTITY ) $}
  $| ${ ntype = CORRESPONDING ${dtype$|#$}( in_d_type USING CONTROL ) $}
  $| ${ ntype = CORRESPONDING ${dtype$|#$}( in_d_type MAPPING FROM ENTITY USING CONTROL ) $}
  $| ${ in_d_type = CORRESPONDING ${dtype$|#$}( ntype CHANGING CONTROL ) $}.


Variants:

1. ntype = CORRESPONDING ${dtype$|#$}( in_d_type MAPPING FROM ENTITY ).

2. out_d_type = CORRESPONDING ${dtype$|#$}( ntype MAPPING TO ENTITY ).

3. ntype = CORRESPONDING ${dtype$|#$}( in_d_type USING CONTROL ).

4. ntype = CORRESPONDING ${dtype$|#$}( in_d_type MAPPING FROM ENTITY USING CONTROL ).

5. in_d_type = CORRESPONDING ${dtype$|#$}( ntype CHANGING CONTROL ).

Effect

The variants of the CORRESPONDING operator are used for creating structures or internal tables with type mapping in ABAP in the context of RAP. The type mapping functionality is targeted at applications that have, on the one hand, RAP BOs based on CDS entities and, on the other hand, further types that are typically older and implement the behavior of the RAP BOs or parts of it. It is especially relevant for the implementation type unmanaged that incorporates existing functionality into RAP. Yet, it can also be relevant for managed, for example, when using code for determinations or validations that already exists but which is based on older, non-RAP types, i. e. types that are not derived from the BDEF.

RAP requires BDEF derived types for the communication of RAP BO providers and RAP BO consumers. When including non-BDEF-derived types, the variants of the CORRESPONDING operator are responsible for matching them to the input (for example, TYPE TABLE FOR UPDATE) and output (for example, TYPE TABLE FOR READ RESULT) of BDEF derived types. A type mapping is needed if the types include field names that differ from the RAP BO or if the control information (%control) is available in non-BDEF-derived types. Instead of having many individual specifications using the CORRESPONDING operator, the variants with the additions for the type mapping help boost the maintenance and reduce errors.

As a prerequisite, the mapping must be specified in the BDEF. For more information, see the CDS BDL documentation on Mapping.

Notes on the syntax:

  • ntype: Types that are not derived from the BDEF.
  • #: It is a symbol for the operand type. This specification is only possible if the data type required in an operand position is unique and completely identifiable. The operand type must be a structure type or a table type.
  • out_d_type: Output BDEF derived type, for example, TYPE TABLE FOR READ RESULT or TYPE STRUCTURE FOR READ RESULT.
  • in_d_type: Input BDEF derived type, for example, TYPE TABLE FOR UPDATE or TYPE STRUCTURE FOR UPDATE.

Variant 1

ntype = CORRESPONDING ${dtype$|#$}( in_d_type MAPPING FROM ENTITY ).


Effect

The output window shows the one line of the internal table as well as the %control structure for the derived type that is created. Likewise, the internal tables for the partner type and the type with the control information is displayed demonstrating the effect of applying the CORRESPONDING operator variant. The field that is disabled in the %control structure is consequently left blank in the table typed with the partner control type.

Variant 2

out_d_type = CORRESPONDING ${dtype$|#$}( ntype MAPPING TO ENTITY ).


Effect

Used for the mapping of a non-BDEF derived type (ntype) to an output BDEF derived type (out_d_type). As a prerequisite, the mapping for the non-BDEF derived type must be specified in the BDEF.

Variant 3

ntype = CORRESPONDING ${dtype$|#$}( in_d_type USING CONTROL ).


Effect

Type mapping variant that respects the %control component of BDEF derived types. in_d_type must be a BDEF derived type that includes the %control component. Only those fields for which the corresponding %control field have been marked as enabled are respected by the mapping, i. e. if a specific %control field is marked as disabled (e. g. the field is initial) in in_d_type, the mapping is not applied to it on the non-BDEF-derived type ntype. There is no mapping required for the non-BDEF derived type in the BDEF if its components have the same field names as the ones from the BDEF-derived type.

Variant 4

ntype = CORRESPONDING ${dtype$|#$}( in_d_type MAPPING FROM ENTITY USING CONTROL ).


Effect

Type mapping variant that takes the %control component of BDEF derived types into consideration. in_d_type must be a BDEF derived type that includes the %control component. Only those fields for which the corresponding %control field have been marked as enabled are considered for the mapping, i. e. if a specific %control field is marked as disabled (e. g. the field is initial) in in_d_type, the mapping is not applied for it on the non-BDEF-derived type ntype. The variant is used if the components of the non-BDEF derived type have different field names than the ones from the BDEF-derived type. Thus, a mapping is required for the non-BDEF derived type in the BDEF with the notation control.

Variant 5

in_d_type = CORRESPONDING ${dtype$|#$}( ntype CHANGING CONTROL ).


Effect

Type mapping variant that fills the %control structure of a BDEF-derived type based on a non-BDEF-derived type that does not include control information, i. e. if a field of ntype is left initial, the statement leaves the corresponding %control component of the field initial (00). Vice versa, if a field of ntype is provided with a value, the statement sets the corresponding %control component of in_d_type as enabled (01).

There is no mapping required for non-BDEF derived types in the BDEF if their components have the same field names as the ones from the BDEF-derived types. If non-BDEF derived types have different field names and a mapping from non-BDEF-derived types to input BDEF-derived types is required, a mapping in the BDEF must be defined (with the notation control) and a second CORRESPONDING statement with the addition MAPPING TO ENTITY must precede the statement with CHANGING CONTROL. In doing so, the first CORRESPONDING statement with the addition MAPPING TO ENTITY takes care of mapping the field names, the second statement with CHANGING CONTROL takes care of filling the %control structure. This mapping variant is only possible for input BDEF-derived types since all of them include %control structures.

The example - CORRESPONDING, Type Mapping demonstrates the different variants with a simple managed RAP BO.






BAL Application Log Documentation   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 10712 Date: 20221127 Time: 034750     sap01-206 ( 185 ms )