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: 

move & move corresponding ?

Former Member
0 Kudos

what is difference between move & move corresponding ?

1 REPLY 1

Former Member
0 Kudos

Hi,

MOVE just move the values without looking at the field names. Meaning it just the moves the number of characters from the source to the target structure OR variable.

MOVE-CORRESPONDING looks for the corresponding field names in the target structure and move those values only..


DATA: BEGIN OF source,
matnr type matnr,
end of source.
 
DATA: BEGIN OF target,
vbeln type vbeln,
matnr type matnr,
end of target.
 
source-matnr = 'asdfasf'.
 
MOVE-CORRESPONDING source to target.
 
write: / 'vbeln- ', target-vbeln.
write: / 'matnr- ', target-matnr.
 
clear: target.
 
skip 1.
 
MOVE source to target.
write: / 'vbeln- ', target-vbeln.
write: / 'matnr- ', target-matnr.
 
* If you see the second output the value in matnr is moved to
* vbeln in target.

for MOVE the both structures should be same, becasue it startring copy first field of first structure to first field of second structure.

MOVE-CORRESPONDING will look for fields with similar names in both the structures and move only those fields which have same name.

move means same like

a = b.

move b to a. ( shuld be type matched)

Regards,

Gaurav

<b>Reward points if helpful</b>