10-24-2007 5:11 AM
Hi all good morning.
is there any keyword to roundup the value to nearest one.
ex: 123.46 output must be 123.00.
if its 123.67 then value must be 124.00
Regards.
Prajwal.k
10-24-2007 5:14 AM
10-24-2007 5:14 AM
10-24-2007 5:16 AM
Hi Prajwal,
Check below SAP help
Function func Return value
abs Absolute value of the argument arg
sign Plus/minus sign of the argument arg: -1, if the value of arg is negative; 0 if the value of arg is 0; 1 if the value of arg is positive.
ceil Smallest integer number that is not smaller than the value of the argument arg.
floor Largest integer number that is not larger than the value of the argument arg.
trunc Value of the integer part of the argument arg
frac Value of the decimal places of the argument arg
Regards,
Atish
10-24-2007 5:16 AM
HI,
ROUND function is u can use that
<b>example</b>
data:num TYPE p value '5789.7'.
WRITE num NO-GROUPING ROUND 0 DECIMALS 2.
rgds,
bharat.
10-24-2007 5:16 AM
10-24-2007 5:19 AM
Hi,
Try this..
data: v_amount type netpr value '123.46'.
data: v_mod type i.
v_amount = v_amount * 100.
v_mod = v_amount mod 100.
v_amount = v_amount / 100.
if v_mod > 50.
Use the ceil function to round it up.
v_amount = ceil( v_amount ).
write: / v_amount.
else.
Use the floor function to round it down.
v_amount = floor( v_amount ).
write: / v_amount.
endif.
Thanks
Naren
10-24-2007 5:20 AM
Hi,
Try this code -
DATA P TYPE P.
P = abs( 10 / 3 ).
write:/ p.
If value is 10, it will return P = 3 and value = 11, it will return P = 4.
Hope this helps.
ashish
10-24-2007 5:23 AM
Hi
Copy Paste and Execute
DATA n TYPE p DECIMALS 2.
DATA m TYPE p DECIMALS 2 VALUE '-5.55'.
n = abs( m ). WRITE: 'ABS: ', n.
n = sign( m ). WRITE: / 'SIGN: ', n.
n = ceil( m ). WRITE: / 'CEIL: ', n.
n = floor( m ). WRITE: / 'FLOOR:', n.
n = trunc( m ). WRITE: / 'TRUNC:', n.
n = frac( m ). WRITE: / 'FRAC: ', n.
Check the value for CEIL now.
Hope it helps.
Praveen
10-24-2007 6:06 AM