‎2008 Feb 06 7:44 AM
hi experts
hi do i round a number allways down e.g. 24.9 will be 24 and 24.3 also will be 24
thanks
amit
‎2008 Feb 06 7:46 AM
hi Amit,
you can use:
number = FLOOR( number ).
hope this helps
ec
‎2008 Feb 06 7:46 AM
hi Amit,
you can use:
number = FLOOR( number ).
hope this helps
ec
‎2008 Feb 06 7:47 AM
‎2008 Feb 06 7:49 AM
Hi,
You should use the keyword FLOOR.
Say i = 24.9
then floor(i) = 24.
‎2008 Feb 06 7:51 AM
data:res type p decimals 2
res = (resuly/100) *100
store the result in res varaible
Rewards If Useful
‎2008 Feb 06 8:19 AM
Hi,
If you want to round the number to the nearest integer, then you must use the function module ROUND. I am pasting you an example below:
data: nu(10) type p decimals 4.
data: nu1(5) type p decimals 2.
nu = '4.017'.
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = 2
INPUT = nu
SIGN = ' '
IMPORTING
OUTPUT = nu1
EXCEPTIONS
NPUT_INVALID = 1
OVERFLOW = 2
*TYPE_INVALID = 3
OTHERS = 4
.
Write:/ nu1. output -> 4.02.
Here you must set the DECIMALS parameter to suit your purpose.
Reward if helpful.
Edited by: prosenjit chaudhuri on Feb 6, 2008 9:20 AM