Move Corresponding new ABAP syntax

Sample program for move corresponding

*&---------------------------------------------------------------------*
*& Report ymove_corresponding
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT ymove_corresponding.

types : begin of it_demo,
        col1 type C,
        col2 type C,
        end of IT_DEMO,

        begin of it_demo2,
        col1 type C,
        col2 type C,
        col3 type C,
        end of IT_DEMO2,

        begin of it_demo3,
        col1 type C,
        col2 type C,
        col3 type C,
        end of IT_DEMO3.


 DATA : itab1 type STANDARD TABLE OF it_demo,
        itab2 type STANDARD TABLE OF it_demo2,
        itab3 type STANDARD TABLE OF it_demo3.

 itab1 = value #( ( col1 = 'A' col2 = 'B' )
                 ( col1 = 'P' col2 = 'Q' )
                 ( col1 = 'N' col2 = 'P' )  )  .

 itab2 = CORRESPONDING #( itab1 ).
 itab3 = CORRESPONDING #( itab2 EXCEPT col3 ).

 itab3 = CORRESPONDING #(  itab1 mapping col3 = col2 except col2 ).

LET keyword in new ABAP

      types : begin of it_demo,
        name type char10,
        id       type char10,
        end of IT_DEMO.
        
   data(ls_sam) = value it_demo(     name = 'anubhav'      
                                                           id = 'A001' ). 
                                       
       data(ls_Sam2) = value it_demo( LET x = 'priya'
                                    y = 'P001'
                                IN  name = x
                                      id = y    
                                   ).     

## 2nd way

         data : ls_sam1 TYPE it_demo.  

         ls_sam1 = value #( name = 'Bijoy' 
                                       id = 'b001' ).       
                                   

Leave a comment