04-27-2010 4:05 PM
Gurus,
Please help with decimal issue.
My sending field type is packed decimal and has a value of 11.88 and I defined receiving field as Numeric text with size 10. I am expecting 0000001188 in my receiver field after the move. But I am getting 0000000012 in my receiver field.
My requirement is to have 0000001188 in my receiver field. Can you please guide me how to do this?
Thanks for your time!
Best regards,
Pavan
04-27-2010 4:14 PM
04-27-2010 4:14 PM
04-27-2010 4:24 PM
Hi DK,
Thanks for your reply,
I didn't got your answer. Can you please explain in detail?
Thanks again for your time!
Best regards,
Pavan
04-27-2010 4:27 PM
pavan,
what chee means to say is, convert that packed field to string first and then pass it to your final field
04-27-2010 4:30 PM
Hi,
The earlier post has correct direction. Here is the sample implementation
data lv_num TYPE p DECIMALS 2 VALUE '11.88'.
data : lv_char TYPE c LENGTH 10.
data : lv_string TYPE string.
data : lv_neum TYPE n LENGTH 10.
lv_char = lv_num. " Value is 11.88
lv_string = lv_num. " Value is 11.88
lv_neum = lv_num. " Value is 12
lv_neum = lv_string. " Value is 11.88
lv_neum = lv_char. " Value is 11.88
WRITE lv_string.
So, based on the implicit type casting you can use the following logic.
Hope this helps.
Thanks,
Samantak.
04-27-2010 4:38 PM
Hi Samantak
Thanks!
I don't need decimal in my result field it should read as 0000001188. How can I get in that way? My sender field value is 11.88.
Thanks for your time!
Best regards,
Pavan
04-27-2010 5:05 PM
Hi Pavan,
In the sample code, the fourth assignment statement is returning the data the way you want.
lv_neum = lv_char. " Value is 0000001188
Hope this will help.
Thanks,
Samantak.
04-27-2010 5:09 PM
data : p1 type p decimals 2 value '11.88',
p2 type string,
p3 type n LENGTH 10.
p3 = p2 = p1.
write p3.