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: 

Round Off

Former Member
0 Kudos

Hi Experts,

I'm calculating the value & storing it in variable as LV_VAR. I would like to round off the value i.e. if LV_VAR = 0.265 then it should be 1.0, if 1.236 then it should be 2 like that.

Can anybody will suggest me how to do that?

Thanks,

Neha

10 REPLIES 10

former_member181962
Active Contributor
0 Kudos

use ceil function

data val type i.

val = ceil( lv_val ).

Regards,

Ravi

Former Member
0 Kudos

Hi Neha,

use the FM J_1I6_ROUND_TO_NEAREST_AMT

that pass your value to the I_AMOUNT you will get output in E_AMOUNT..

like that you have 5 fields you can use any of them in that FM.

Thanks

Former Member
0 Kudos

hello, Try this :


data : l_var type f.
l_var = '1.265'.
l_var = ceil( l_var ).

Former Member
0 Kudos

Hi,

U can define the Variable as integer or can use FM 'ROUND'. I hope this will solve your purpose.

Thanks

Amish.

0 Kudos

erm assigning 1,256 to an integer will give you 1 and not 2 like needed...

former_member226203
Active Contributor
0 Kudos

check this link which has the same requirement:

Former Member
0 Kudos

hi,

you can use FM 'ROUND'

0 Kudos

Hi,

Just use the following code in your program.

l_var = ceil( <calculation that you are doing> ).

and you will get the desired output

Former Member
0 Kudos

try the following code --

data: ft type f VALUE '1.23'.

DATA: i TYPE i.

i = CEIL( ft ).

WRITE / i.

0 Kudos

Hi,

use the statement 'ciel' it will work.

close the thread if you got ur solution.

regards,

jayaram