Application Development and Automation 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: 
Read only

Tolerance + -

Former Member
0 Likes
896

Hi ,

How to write a logic for the following scenario.

For ex : value = 55.95 or 56.01 need to 56 like that..it may be 89.95 etc

set this to the closest number

e.g. if it is between 55.85 to 55.99 make it 56.

Or if it is between 55.1 to 55.15 make it 55.

Please let me know how to write it.

Thanks in Advance

R

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
870

Try to use fm


CALL FUNCTION 'ROUND'
  EXPORTING
    decimals      = 2
    input         = v_num
    sign          = '+'
  IMPORTING
    output        = v_out.

a®

5 REPLIES 5
Read only

former_member194669
Active Contributor
0 Likes
871

Try to use fm


CALL FUNCTION 'ROUND'
  EXPORTING
    decimals      = 2
    input         = v_num
    sign          = '+'
  IMPORTING
    output        = v_out.

a®

Read only

Former Member
0 Likes
870

Hi Ramesh,

[Round the value to the nearest value|]

Regards!

Read only

Former Member
0 Likes
870

hi,

please search first

Use This FM ROUND

Refer This Link

thanks

Read only

former_member156446
Active Contributor
0 Likes
870

try to move the value to Type N ( if you donnot have a decimal)... and type i (with decimals) or Round FM is better ..

Read only

Former Member
0 Likes
870

Hi,

If you make the data type as 'i' then it will give you the round of value of the variable,moreover above mentioned function module will also result in the same thing.

Pooja