Application Development and Automation 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: 
Read only

Difference between 'move to' and 'write to'

Former Member
0 Likes
1,180

Hi,

Please help with these two questions:

1. what is the difference between 'Move x to y' and 'write x to y' ?

I want to assigen a sales order (along with leading zeroes) to a character field using 'Write to' type,,but after assigning, the leading zeroes are missing.

2. What can I do so that I should be able to use 'Write to' as well as leading zeroes not missing?

Thanks in advance,

I appreciate,

Krishen

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
861

Hi,

Basically both commands will do the same, however with "WRITE TO" conversion routines are used and it's possible to use edit masks:

See the following example:

REPORT ztest.
 
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

Hope this will help.

Regards,

Ferry Lianto

Hi,

Please help with these two questions:

1. what is the difference between 'Move x to y' and 'write x to y' ?

I want to assigen a sales order (along with leading zeroes) to a character field using 'Write to' type,,but after assigning, the leading zeroes are missing.

2. What can I do so that I should be able to use 'Write to' as well as leading zeroes not missing?

Thanks in advance,

I appreciate,

Krishen

5 REPLIES 5
Read only

Former Member
0 Likes
861

Hi,

Why don't you use CONVERSION_EXIT_ALPHA_INPUT

eg:

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = v_Sales1 " having value without 0s

IMPORTING

OUTPUT = v_sales2. " this will have Sales order as per SAP.

Hope this helps.

Manish

Message was edited by:

Manish Kumar

Read only

Former Member
0 Likes
862

Hi,

Basically both commands will do the same, however with "WRITE TO" conversion routines are used and it's possible to use edit masks:

See the following example:

REPORT ztest.
 
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

Hope this will help.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
861

Hi,

1) 'Move to ' is just to move the number characters from the source to target...

'Write to' will trigger the conversion routines based on the data type of the source..

For example..

DATA: V_VBELN TYPE VBELN VALUE '0010001234'.

DATA: V_TARGET(10).

WRITE: V_VBELN TO V_TARGET.

The conversion routine in the data type VBELN is triggered..The conversion routine will remove the leading zeroes..

2) If you want leading zeroes use MOVE TO..

Thanks,

Naren

Read only

0 Likes
861

Thanks to you all!

I am actually writing a subroutine for a sapscript.

I want to use 'Write to' because I need to assign a variable var_vbeln like this in a subroutine:

WRITE: temp_zvbeln TO output_table-value.

When I put breakpoint to see the value, it is going to dump. However, with out breakpoint, I could print the sapscript.

Please give your input reg. the above.

Thanks.

Read only

Former Member
0 Likes
861

Hi,

What is the dump you are getting??

Thanks,

Naren