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: 

Convert float to a numeric with 3 decimals

Former Member
0 Kudos

Hi,

How can I convert a float number to a numeric number with 3 decimals?

Tks,

Daniela

1 ACCEPTED SOLUTION

Former Member

hi Daniela,

Declare it as type <b>P</b>

i.e,

Data : v_float type f,

v_dec type p decimals 3.

v_dec = v_float.

write : v_float, v_dec.

Regards,

Santosh

8 REPLIES 8

Former Member

hi Daniela,

Declare it as type <b>P</b>

i.e,

Data : v_float type f,

v_dec type p decimals 3.

v_dec = v_float.

write : v_float, v_dec.

Regards,

Santosh

0 Kudos

Santosh

I tried to do that but it happens a sintaxe error when I use MOVE Command "v_test muat be a character-type field".

regards,

Daniela

Former Member
0 Kudos

HI,

data: var1 type p decimals 3.

Regards

Laxmi.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Just move from f to p type fields.



data: f type f value '12345.13254'.
data: p type p decimals 3.

p = f.

write:/ p.


Regards,

Rich Heilman

0 Kudos

hi Daniela,

I have tried here and i have pasted the code it was not giving me any error did you declare the parameters as i have mentioned above.

0 Kudos

Santosh

It works!

Thak you very much!

Former Member
0 Kudos

hi daniela,

data f1 type f value 180.

data f2 type p decimals 3.

move f1 to f2.

write: / f1, f2.

antony_paul2
Active Participant
0 Kudos

Hi santhosh,

Thanks for your help, its working for me..

Regards.

Antony