Skip to Content
0
Feb 15, 2006 at 11:33 PM

move TYPE C varibale to TYPE N -

479 Views

Hi

I just have a doubt which I need to clear. We’re using some code logic in which we are passing some "C" variables value to FM and return the value and replace (<b>.</b>) by Some Character ( A,b,c,d) . After that perform_call I am doing something like

Data:vari_n(11) type N,

vari_c(13) type c.

The value in vari_c is like '000000002224D'.

<b> MOVE Vari_c+2(11) TO vari_N.</b>

I was expecting that after move statement the value in Vari_n should be like '0000002224D' but in fact its not its like '00000002224'.

<b>It was working correct before , why its not working now ?</b>

Now I made a change into code and write code like

<b> write Vari_c+2(11) TO vari_N.</b>

But my question is that why its not working with move statement.

Please give your input/suggestions.

Thanks

*----


I read Move help and its says that ---

If the field types or lengths differ, the system automatically carries out type conversion. Type I fields are handled like type P fields. If you select the fixed point arithmetic attribute for an ABAP program, type P fields are either rounded according to the number of decimal places or filled with zeros.

See: Conversion Table for the MOVE Statement

If the assignment is allowed but the source field type cannot be converted to the target field type, the contents of the target field are undefined. This would be the case, if you were to assign a C field containing 'ABCD' to a type D or T field.

<b>The operation is terminated only if the target field is a numeric type ( I, P or F).</b>

If the target field has type C, you must decide between MOVE and WRITE TO. The MOVE statement is intended for assignments within a program, and it generates a standard display that is compatible with the source type. This can be converted back into the original value using MOVE again, as long as it was not truncated in the assignment. For this reason, the period (.) is always used as the decimal sign, and dates cannot be converted, regardless of the user defaults.

You use the WRITE TO statement to generate a readable ('external') display for the value of the source field. The target field is usually displayed on a screen or in a list, after further processing if necessary. Unlike MOVE, WRITE TO has several formatting options, which, for some data types, are user-defined. A conversion exit may be called implicitly.

**----


Message was edited by: Saquib Khan