2005 Jul 27 4:20 AM
What is the difference between MOVE and WRITE TO ?
I have gone thr std help but unable to get it exactly. What is peculiarity about type c ?
The documentation says " In contrast to MOVE, the format of the target field g is the same as when outputting to a list with WRITE. The field type C is always used, regardless of the actual data type. "
Regards,
Nitin
2005 Jul 28 5:26 AM
hi,
While using the MOVE statement the source field & the target field should be of the same type or should be type convertible & compatible.
example ;
data : source type i value 100,
target type i.
move source to target.
In the case of WRIE TO the source field can be of any type but the target field should always be a character type.
example ;
data : source type i value 200,
target(10) type c.
write source to target.
What is the difference between MOVE and WRITE TO ?
I have gone thr std help but unable to get it exactly. What is peculiarity about type c ?
The documentation says " In contrast to MOVE, the format of the target field g is the same as when outputting to a list with WRITE. The field type C is always used, regardless of the actual data type. "
Regards,
Nitin
2005 Jul 27 5:15 AM
Hi Nitin,
Have you found the answer to this qustion ?
Regards,
Anand Mandalika.
2005 Jul 27 5:30 AM
Hi Nitin,
I believe the difference is this:
Though both are used to transfer contents of a variable, we should use 'write to' when we need the effect of outputting the variable to list output. (well thats what the documentation says).
U might wonder what the difference is.. suppose we use these methods on a field with conversion exit, it will be clear. Using 'write to', the value is converted using the conversion exit while it is not the case with move.
regards,
Pavan.
2005 Jul 27 6:54 AM
Hi Nitin,
Try this...
REPORT ztestak.
data: test1(10) type c,
test2(10) type c.
START-OF-SELECTION.
move sy-datum to test1.
write sy-datum to test2.
write 😕 'With MOVE :', test1.
write 😕 'With WRITE:', test2.
Output:
With MOVE : 20050726
With WRITE: 07/26/2005
2005 Jul 27 9:24 PM
when you are using 'MOVE' it will try to cast the value according to the target variable.
And also sy-subrc behaves differently
if sy-subrc eq 2 casting done with some adjustments
sy-subrc eq 4
u got some other values u can find them in online documentaion.
Hope This helps
Ismail
2005 Jul 27 9:25 PM
Re: Difference between MOVE and WRITE TO
Posted: Jul 27, 2005 4:24 PM Reply E-mail this post
when you are using 'MOVE' it will try to cast the value according to the target variable.
And also sy-subrc behaves differently for move statement
if sy-subrc eq 2 casting done with some adjustments
sy-subrc eq 4
u got some other values u can find them in online documentaion.
Hope This helps
Ismail
2005 Jul 28 5:26 AM
hi,
While using the MOVE statement the source field & the target field should be of the same type or should be type convertible & compatible.
example ;
data : source type i value 100,
target type i.
move source to target.
In the case of WRIE TO the source field can be of any type but the target field should always be a character type.
example ;
data : source type i value 200,
target(10) type c.
write source to target.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |