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: 

Need to carry all the calculations to the fourth decimal place

Former Member
0 Kudos

Dear All,

I need to carry all the calculations to the fourth decimal place.

When the calculation value is more than 0.00005 than round up to the next 0.0001 (to the next fourth decimal place value). Otherwise, round down to the next 0.0001 (to the next forth decimal place value).

Will you kindly provide me some code for this?

Thanks in Advance,

KCRanjan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

chk this

REPORT  ychatest                                .

data : p_amy type p decimals 4.

p_amy = '123.13567'.

write : p_amy.

7 REPLIES 7

Former Member
0 Kudos

Hii

You can declare the variable type P decimals 4.

Move this value to a variable of type p decimals 4.

<b>data: v_round type p decimals 4.

v_round = v_dec.

write:/v_round

</b>

otherwise

use FM 'ROUND'.

or

'HR_IN_ROUND_AMT' .

regards

Naresh

Former Member
0 Kudos

Hi,

declare the variable whatever is storing that decimal value as type p decimal4.

Regards,

Aswin

Former Member
0 Kudos

hi

data : num1 type p decimals 5,

num2 type p decimals 5,

sum num type p decimals 5.

sum = num1 + num2.

rahulkavuri
Active Contributor
0 Kudos

Use the FM <b>HR_NZ_ROUNDING_DECIMALS</b>

Former Member
0 Kudos

Try this..

data: p type p decimals 5 value '123456.00005'.

write:/ p decimals 4 .

Former Member
0 Kudos

hi,

chk this

REPORT  ychatest                                .

data : p_amy type p decimals 4.

p_amy = '123.13567'.

write : p_amy.

Former Member
0 Kudos

Hi ,

You can use the FM

<b>HR_IN_ROUND_AMT</b> for achieving your requirement.

Regards,

SP.