‎2007 Oct 15 6:32 PM
Hi all,
I need help on this urgently.
I have value as follow to be rounded up , eg:
941 rounded to 940,
98 rounded to 100,
934 rounded to 930.
thanks!!
‎2007 Oct 15 6:44 PM
hi pompougnia,
U can use MOD too, like this.
data:
num(10) value '943',
module(2).
module = num mod 10.
case module.
when 0.
...
when 1.
num = num - 1.
when 2.
num = num - 2.
when 3.
num = num - 3.
when 4.
num = num - 4.
when 5.
num = num + 5. "or ( - 5 )
when 6.
num = num + 4.
when 7.
num = num + 3.
when 8.
num = num + 2.
when 9.
num = num + 1.
endcase.
write: num.
Regards
Allan Cristian
Message was edited by:
Allan Cristian
‎2007 Oct 15 6:35 PM
Hi,
Please try FM ROUND to round it up or down.
Regards,
Ferry Lianto
‎2007 Oct 15 6:44 PM
hi pompougnia,
U can use MOD too, like this.
data:
num(10) value '943',
module(2).
module = num mod 10.
case module.
when 0.
...
when 1.
num = num - 1.
when 2.
num = num - 2.
when 3.
num = num - 3.
when 4.
num = num - 4.
when 5.
num = num + 5. "or ( - 5 )
when 6.
num = num + 4.
when 7.
num = num + 3.
when 8.
num = num + 2.
when 9.
num = num + 1.
endcase.
write: num.
Regards
Allan Cristian
Message was edited by:
Allan Cristian
‎2007 Oct 15 6:53 PM
Try this.
PARAMETERS: p_number TYPE i.
DATA: reminder TYPE i.
p_number = ( p_number / 10 ) * 10.
WRITE p_number.
‎2007 Oct 15 8:14 PM
You can use function module HR_BEN_ROUND_AMOUNT. Set the raw amount to the original amount, set the rounding rule to B, and set the rounding divisor to 10. The rounded amount will be returned to you.
- April King