10-16-2008 4:33 PM
Hi I need a FM to round quantity to the highest 10's.
for eg if I have 11, it should make it to 20.
if i have 27, it should make it to 30.
Any FM.
Ster.
10-16-2008 4:35 PM
No FM required.
divide by 10, use CEIL, multiply by 10.
data: value1 type i value 11,
value2 type p DECIMALS 1.
value2 = CEIL( value1 / 10 ).
value1 = value2 * 10.
write: / value1.
or if you want to do it in one go, with an integer
DATA: value1 TYPE i VALUE 11.
value1 = ( ( value1 + 4 ) / 10 ) * 10.
WRITE: / value1.
10-16-2008 4:35 PM
No FM required.
divide by 10, use CEIL, multiply by 10.
data: value1 type i value 11,
value2 type p DECIMALS 1.
value2 = CEIL( value1 / 10 ).
value1 = value2 * 10.
write: / value1.
or if you want to do it in one go, with an integer
DATA: value1 TYPE i VALUE 11.
value1 = ( ( value1 + 4 ) / 10 ) * 10.
WRITE: / value1.
10-16-2008 4:37 PM
try to use system function floor (Largest integer number that is not larger than the value of the argument arg. ) or ceil (Smallest integer number that is not smaller than the value of the argument arg).
Ex:
l_amount = ceil ( l_amount1 ).
Edited by: Joyjit Ghosh on Oct 16, 2008 5:37 PM
10-16-2008 4:37 PM
I wonder if such FM exists, I think a small workaorund is necessary:
DATA : p TYPE p DECIMALS 1.
p = quantity / 10.
p = CEIL( p ).
quantity = p * 10.