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: 

Decimal issue please help

former_member1312574
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Pavan,

p -> string -> n

this should work.

Regards,

DK

7 REPLIES 7

Former Member
0 Kudos

Hi Pavan,

p -> string -> n

this should work.

Regards,

DK

0 Kudos

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

0 Kudos

pavan,

what chee means to say is, convert that packed field to string first and then pass it to your final field

0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos
data : p1 type p decimals 2 value '11.88',
       p2 type string,
       p3 type n LENGTH 10.

p3 = p2 = p1.

write p3.