Understanding the CORRESPONDING Operator in SAP ABAP

Description:

This variant of the CORRESPONDING component operator constructs a result with the target type specified using dtype or # from the components of a parameter structure (struct) or internal table (itab).

  • If the target type is a structured type, a structure (struct) must be used as a parameter. The expression creates a structure of the target type. This structure is either initialized by default or assigned the value of base, optionally using the BASE addition as the starting value.
  • If the target type is a table type, an internal table (itab) must be used as a parameter. The expression creates an internal table of the target type. This table is either initialized by default or assigned the value of base, optionally using the BASE addition as the starting value.

Syntax:

{ CORRESPONDING dtype|#( [DEEP]
                             [BASE ( base )]
                             struct|{itab [ duplicates]} ) }
  | { CORRESPONDING dtype|#( [BASE ( base )]
                             struct|{itab [ duplicates]}
                             mapping ) }

Example:

"Data declarations
TYPES: BEGIN OF ty_vbak,
         vbeln TYPE vbeln,
         erdat TYPE erdat,
         auart TYPE auart,
       END OF ty_vbak,
       tt_vbak TYPE STANDARD TABLE OF ty_vbak.

DATA: lt_vbak TYPE TABLE OF ty_vbak.

lt_vbak = VALUE #( ( vbeln = 1
                     erdat = '07.07.2025'
                     auart =  'ZSSO')
                    ( vbeln = 2
                     erdat = '07.07.2025'
                     auart = 'ZSSO' ) ).

DATA(lt_vba) = CORRESPONDING tt_vbak( lt_vbak ).

Thanks for visiting!

Sangeeta Singh

Leave a Reply

Discover more from HANAxABAP

Subscribe now to keep reading and get access to the full archive.

Continue reading