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: 

Function Module for Rounding Off to the Nearest Value of th given Value

Former Member
0 Kudos

Hi Friends,

Is there any Function Module for Rounding Off the given Value.

For Example.....

Say v_variable contains the value 2.81

Now the decimal is more than 50 paise.. so it should round off to 3.00

Say if the variable v_variable contains the value 2.41

Now the decimal is less than the 50 paisa.. so it should round off to 2.00

How i am doing.

First every thing i am moving to charater format ( Charater Data Type )

after that SPLITTING at decimal positions into two variable like v_rupees and v_paise.

Checking the variable v_paise greater than or equal to 50 paise.

v_variable = CEIL( v_variable)

else.

v_variable = FLOOR(v_variable)

Here my problem is every thing i have to move into charactes data type..

So i am looking for a Function Module..

Please check this and let me help regarding this.

Thanks & Regards:

Sridhar.J

1 ACCEPTED SOLUTION

kiran_k8
Active Contributor

Sridhar,

J_1I6_ROUND_TO_NEAREST_AMT----161.40 will be 161- 161.50 will be 162

K.Kiran.

6 REPLIES 6

Former Member
0 Kudos

Use FM ROUND

Former Member
0 Kudos

Hi Sridhar,

Function Module is ROUND.

CALL FUNCTION 'ROUND'

EXPORTING

  • DECIMALS = 0

input = v_data

  • SIGN = ' '

IMPORTING

OUTPUT = v_data.

Also check the Funciton Modules:

ROUND_AMOUNT

FI_ROUND_AMOUNT

FM HR_IN_ROUND_AMT

Hope this helps you.

Regards,

Chandra Sekhar

kiran_k8
Active Contributor

Sridhar,

J_1I6_ROUND_TO_NEAREST_AMT----161.40 will be 161- 161.50 will be 162

K.Kiran.

Former Member
0 Kudos

hai kiran k  it is help full for me.

thank q .

regards,

uday.

Former Member

Hi All,

No need of Function modules use the below one line code

data(lv_round) = round( val = '5678.65800341' dec = 0 ).


Now the value of lv_round will be 5679


Thanks,

Murugan

0 Kudos

You solved my problem, thanks.