2009 Apr 21 11:39 AM
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
2009 Apr 21 11:41 AM
use ceil function
data val type i.
val = ceil( lv_val ).
Regards,
Ravi
2009 Apr 21 11:41 AM
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
2009 Apr 21 11:43 AM
hello, Try this :
data : l_var type f.
l_var = '1.265'.
l_var = ceil( l_var ).
2009 Apr 21 11:44 AM
Hi,
U can define the Variable as integer or can use FM 'ROUND'. I hope this will solve your purpose.
Thanks
Amish.
2009 Apr 21 11:45 AM
erm assigning 1,256 to an integer will give you 1 and not 2 like needed...
2009 Apr 21 11:47 AM
2009 Apr 21 11:52 AM
2009 Apr 21 12:00 PM
Hi,
Just use the following code in your program.
l_var = ceil( <calculation that you are doing> ).
and you will get the desired output
2009 Apr 22 12:05 PM
try the following code --
data: ft type f VALUE '1.23'.
DATA: i TYPE i.
i = CEIL( ft ).
WRITE / i.
2009 Apr 22 12:09 PM
Hi,
use the statement 'ciel' it will work.
close the thread if you got ur solution.
regards,
jayaram