‎2007 Jun 13 12:27 PM
‎2007 Jun 13 12:29 PM
hi,
You use move command to assing data from one variable to another.
Example.
DATA: var1 TYPE c VAULE 'A',
var2 TYPE c.
MOVE var1 to var2.
You use moe-corresponding to move the data from one structure where the definition of both the strucutre are not same.
Example.
DATA: BEGIN OF lst_struct1,
field1,
field2,
field3,
field4,
END OF lst_struct1.
DATA: BEGIN OF lst_struct2,
field2,
field3,
END OF lst_struct2.
MOVE-CORRESPONDING lst_struct1 TO lst_struct2.
Here, you want to populate the data in lst_struct2 from lst_struct1. But both contains the fields in different order. You can not just do lst_struct2 = lst_struct1. Since fields are out of order, you use MOVE-CORRESPONDING
Regards
‎2007 Jun 13 12:33 PM
Hi,
1. Move assigns the value to the specified field.
It is just like a = b.
2. Whereas
3. MOVE-CORRESPONDING STRUCT1 TO STRUCT2
means,
ALL FIELDS HAVING THE SAME NAME,
WILL BECOME EQUAL.
(Rest fields, which do not have same name,
will be ignored)
4. Suppose have a struct1 has 5 fields,
struct 2 has 9 fields,
so instead of giving 5 different lines,
STRUCT2-FIEDL1 = STRUCT1-FIELD1
STRUCT2-FIEDL2 = STRUCT1-FIELD2
STRUCT2-FIEDL3 = STRUCT1-FIELD3
STRUCT2-FIEDL4 = STRUCT1-FIELD4
STRUCT2-FIEDL5 = STRUCT1-FIELD5
We just use MOVE-CORRESPONDING STRUCT1 TO STRUCT2.
Regards,
Priyanka.
‎2007 Jun 13 12:34 PM
Hi,
Move Statement is used to move a variable or a record from one work area to another. it moves data in a order i.e. field by field the order of fields in in both tables should be same otherwise we will get an error.
Example.
DATA: var1 TYPE c VAULE 'A',
var2 TYPE c.
MOVE var1 to var2.
Move Corresponding moves data from one table to another with respect to names of fields. i.e no sequence is maintained . it automatically searches for field names and moves data acoordingly.
Example.
DATA: BEGIN OF lst_struct1,
field1,
field2,
field3,
field4,
END OF lst_struct1.
DATA: BEGIN OF lst_struct2,
field2,
field3,
END OF lst_struct2.
MOVE-CORRESPONDING lst_struct1 TO lst_struct2.
Generally, Move works faster than Move Corresponding.
If u move the order in both tables i.e sequence in both tables r same go for move otherwise use move-corresponding.
Regards,
Padmam.
‎2007 Jun 13 12:40 PM
<b>MOVE</b>
Assigns values.
Syntax
MOVE <f1> TO <f2>.
<b>Assigns the contents of the data object <f1> to the variable <f2>, with automatic type conversion if necessary. Equivalent to <f2> = <f1>.</b>
<b>MOVE-CORRESPONDING</b>
Assigns values between identically-named components of structures.
Syntax
MOVE-CORRESPONDING <struc1> TO <struc2>.
<b>Moves the contents of the components of structure <struc1> to the components of <struc2> that have identical names.</b>
reward points if it is usefull ..
Girish