Skip to Content
avatar image
Former Member

move-corresponding itab1 to itab2

Hi guys,

is it possible for a move-corresponding to transfer all entries of itab1 to itab2 by just using this code:

move-corresponding itab1 to itab2????

or move-corresponding is only for one entry? thanks a lot!

always,

mark

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 23, 2008 at 05:25 AM

    Hi,

    Move-corresponding will move all the fields from one internal table to another.

    So to transfer all entries into another internal table we can have move-corresponding itab1 to itab2.

    or u can use itab1[ ] = itab2[ ].

    If we take into account the performance the itab1[] = itab2 is much faster than move-corresponding, as move-corresponding has the bottle neck to search all fields of similar name.

    Hope this helps you,

    Thanks,

    Dhanashri.

    Edited by: Dhanashri Pawar on Jun 23, 2008 7:25 AM

    Edited by: Dhanashri Pawar on Jul 31, 2008 7:57 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2008 at 01:55 AM

    Hi

    Try Using

    itab1 [ ] = itab2 [ ]

    if you want to copy the whole internal table to second table

    Regards,

    Nikhil

    Edited by: Nikhil A Chitre on Jun 23, 2008 11:55 AM

    Edited by: Nikhil A Chitre on Jun 23, 2008 11:56 AM

    Edited by: Nikhil A Chitre on Jun 23, 2008 11:56 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2008 at 02:02 AM

    Hi

    Move-corresponding: transfer the data from a structure to another one in according to the name of the fields.

    move-corresponding itab1 to itab2

    So u can use above code to move all data from one internaltable to other internal table

    U can also use

    itab1[] =  itab2[]

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2008 at 02:04 AM

    Hi Mark,

    Yes it is possible! but make sure that the availble fields is the same as you pass the data to another table. Try using itab1[] = itab2[] , it is much faster than the syntax move-corresponding . Be sure to have the same format of the itab.

    Regards,

    Mark

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2008 at 02:25 AM

    syntax : move-corresponding itab1 to itab2

    this syntax is most faster : itab2[ ] = itab1[ ].

    Link:[Abap Tips|http://abap4beginner.blogspot.com]

    Edited by: anuar jusoh on Jun 23, 2008 4:25 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2008 at 05:33 AM

    Hi

    Hi

    Move: transfer the data from a structure to another one in according to the length of original structure;

    Move-corresponding: transfer the data from a structure to another one in according to the name of the fields, so in your case:

    data: begin of t_cash, "cash transactions

    D1(08), "Post Date

    D2(40), "Employee Name

    D3(40), "Employee Vendor Id

    end of t_cash.

    data: begin of t_card, "card transactions

    D1(08), "Post Date

    D2(40), "Employee Name

    D4(25), "Merchant Name

    end of t_card.

    If you use MOVE, u shoudl consider T_CARD is shorter than T_CASH: the last field D4 is long 25 CHAR, but the last field D3 is long 40 char. So u'll loose the last 15 digit of T_CASH

    MOVE T_CASH TO T_CARD.

    is like

    T_CARD = T_CASH(73).

    If you use MOVE-CORRESPONDING, u'll transfer only the information of the field D1 and D2:

    MOVE-CORRESPONDING T_CASH TO T_CARD.

    is like

    T_CARD-D1 = T_CASH-D1.

    T_CARD-D2 = T_CASH-D2.

    Now the problem is ECC 6.00 is unicode release, so the statament MOVE-CORRESPONDING can't be used if the original and destination variable have a different structure.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 23, 2008 at 05:34 AM

    Hi,

    You can use statments below :

    
    append lines of itab1 to itab2.
    
    OR
    
    itab2 [  ]  = itab1 [  ].
    
    

    Use above for better performance.

    Thanks,

    Sriram Ponna.

    Add comment
    10|10000 characters needed characters exceeded