Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

regarding move and move-corresponding

Former Member
0 Kudos

Hi,

Can anybody tell me about move and move-corresponding functionality ie here i had a confussion about them is in which case

-


Attempt should be made to move entire internal table headers in a single shot, rather than moving the fields one by one.

whether it is in case of move or move-corresponding.

please reply it will help me a lot.

regards,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

MOVE <itab1> To <itab2>.

OR

<itab1> = <itab2>.

To copy entire contents of one table into another in one execution

>>Copies the entire contents of one table into another in one execution.

>>Original data in target table overwritten.

>>For tables with header line use [] to distinguish it from work area since both have the same name.

MOVE-CORRESPONDING <itab1> TO <itab2>-

>> Executes the statement for their header lines.

>>Searches for the sub-fields which occur both in itab1 and itab2 and then generates, for all relevant field pairs which correspond to the sub-fields ni , statements of the form

MOVE itab1-ni TO itab2-ni.

>> The other fields remain unchanged.

hope your doubt get cleared

thanks

Sachin

Edited by: Sachin Gupta on Oct 14, 2008 7:56 AM

9 REPLIES 9

Former Member
0 Kudos

Hi,

When you use MOVE it will move the contents of one structure to another structure in the same order.

But when you say MOVE-CORRESPONDING, it will transfer values to the same fields from one structure to another even though they are not in the same order.

Regards,

Pramod

Former Member
0 Kudos

Hi,

if ur target internal table has same structure as the source internal table u can use

loop at <source>.

move-corresponding <source> to <target>.

append target.

endloop.

if structure is different or in case if u wish to only send some fields that needs to be displayed in the report then use just move.

loop at <source>.

move <source>-<fieldname> to <target>-<fieldname>.

append <target>.

endloop.

Regards,

Amit

madan_ullasa
Contributor
0 Kudos

Hi,

when you say move, the values are moved form same row-column to samr row-column...

eg.. itab1 row1 col1 to itab2 row1 col1. Now say that the values to be moved are in different columns and rows in 2 itabs... but they have the same field names... then you use move-corresponding....

eg... you have itab1 - field1 field2 field3 and itab2 - field2 field3 field1.... if you use move corresponding it moves itab1-field1 to itab2-field2....

when u want to move the whole tables use...

move itab1[ ] to itab2[ ].... the columns should be in the same sequence..thats is it should have the same sequence..

regds,

Madan...

0 Kudos

Thanks for your reply but what my doubt is in which case Attempt should be made to move entire internal table headers in a single shot, rather than moving the fields one by one.

0 Kudos

You should make an attempt to move the entire structure when the type is same...both are declared using one structure/table it self....and have same fields..

Move-corresponding is used..when not all the fields in itab1 are there in itab2...then only the fields which are there are moved(field names should be same).

Regards,

Vishwa.

Former Member
0 Kudos

Thanks for your reply but what my doubt is in which case Attempt should be made to move entire internal table headers in a single shot, rather than moving the fields one by one.

0 Kudos

Hi,

if you have the same struct...

eg...

itab1 with fields f1(10) type c,

f2(20) type c,

f3 type p.

and,

itab2 with fields f1(10) type c,

f2(20) type c,

f3 type p.

then you can just move one header to another or one whole body to another...

eg... itab1 = itab2 -> (if the tables have header)

itab1[ ] = itab2 [ ] --> ( whole body )

Former Member
0 Kudos

hi,

MOVE <itab1> To <itab2>.

OR

<itab1> = <itab2>.

To copy entire contents of one table into another in one execution

>>Copies the entire contents of one table into another in one execution.

>>Original data in target table overwritten.

>>For tables with header line use [] to distinguish it from work area since both have the same name.

MOVE-CORRESPONDING <itab1> TO <itab2>-

>> Executes the statement for their header lines.

>>Searches for the sub-fields which occur both in itab1 and itab2 and then generates, for all relevant field pairs which correspond to the sub-fields ni , statements of the form

MOVE itab1-ni TO itab2-ni.

>> The other fields remain unchanged.

hope your doubt get cleared

thanks

Sachin

Edited by: Sachin Gupta on Oct 14, 2008 7:56 AM

0 Kudos

Hi,

Thanks for your reply now iam able to understand the exact meaning of them

thank you very much

problem solved.

thanks and regards,

phaneendra.