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: 

Rounding Decimals

Former Member
0 Kudos

Hi all,

I need to Round off Only decimals in a Value

Eg:- 4715987.247898

So the result required is

4715987.25

can anyone suggest any technique or Function Module.

Regards,

AJ

1 ACCEPTED SOLUTION

peter_ruiz2
Active Contributor
0 Kudos

hi anurag,

declare a variable of type p decimals 2 then pass the value.

ex.


constant: v_val1 type p decimals 6 value '4715987.247898'.
data: v_val2 type p decimals 2.

v_val2 = v_val1.

regards,

Peter

7 REPLIES 7

Former Member
0 Kudos

assign a variable like this

data: num type p decimals 2.

prasanth_kasturi
Active Contributor
0 Kudos

hi

use write statemnt addition

data f1 type p decimals 7 value '4715987.247898'.

write f1 DECIMALS 2 .

reward if helpful

prasanth

Former Member
0 Kudos

Hi,

Try using FM ROUND or ceil ( ) statement.

Thanks,

Sriram Ponna.

Former Member
0 Kudos

Hi,

Use function module ROUND.

or

MOve this value to a variable of type p decimals 2.

data: v_dec type p decimals 2.

v_dec = v_char.

Regards,

Raj.

Former Member
0 Kudos

Hi,

You can a declare a variable of p with decimals 2.

OR

type wrbtr.

Thanks,

Sriram Ponna.

Former Member
0 Kudos

Hi,

Declare one variable with datatype as P with decimals place 2. Then assign your input number to that variable and it automatically round-off to the 2 decimal places.

But note that the input number format is "4715987,247898" and not as you given "4715987.247898".

If you want to given as your wish then you need change the user settings.

Regards,

Raghu

peter_ruiz2
Active Contributor
0 Kudos

hi anurag,

declare a variable of type p decimals 2 then pass the value.

ex.


constant: v_val1 type p decimals 6 value '4715987.247898'.
data: v_val2 type p decimals 2.

v_val2 = v_val1.

regards,

Peter