‎2006 Feb 20 6:30 AM
Hi,
Is there any Function module to round the values ie. Value = 2.49 then i want it as 3....
Thanks in advance
‎2006 Feb 20 6:32 AM
<b>n = floor( m ). WRITE: / 'FLOOR:', n.</b>
Also see this FM
<b>HR_NZ_ROUNDING_DECIMALS
ROUND</b>
‎2006 Feb 20 6:34 AM
Use CEIL.
Usage:
DATA : p TYPE p DECIMALS 2 VALUE '2.49'.
DATA i TYPE i.
i = CEIL( p ).
WRITE : i.
‎2006 Feb 20 6:35 AM
‎2006 Feb 20 7:14 AM
‎2006 Feb 20 6:36 AM
Hi,
If you defined that variable as INTEGER it will take care of that rounding.
Thanks.
‎2006 Feb 20 6:41 AM
Hi,
Check out function module J_1I6_ROUND_TO_NEAREST_AMT
other wise you can also use ROUND(amount) or CEIL(amount).
Thanks & Regards
‎2006 Feb 20 6:47 AM
just move this to a type i variable, the system will automatically round it
data: a(16) type p decimals 2 .
data: b type i .
a = '16.49' .
b = a .
now b will have 17 as value
Regards
Raja
‎2006 Feb 20 6:54 AM
Try this sample code
Data: w_a type i,
w_b type i.
w_a = '10.67'.
CALL FUNCTION 'ROUND'
EXPORTING
input = w_a
IMPORTING
OUTPUT = w_b .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write:/ w_b.This will work.
Kindly reward points and close the thread if ur problem got solved.
‎2006 Feb 20 7:02 AM
CHK THIS
CALL FUNCTION 'HR_IN_ROUND_AMT'
EXPORTING
AMOUNT = val1
RNDOFF = '100'
RNDLMT = 'N'
IMPORTING
RETAMT = val2.
U CAN SET UR ROUNDING CHARACTERISTIC IN THE PARAMTER RNDOFF.
hOPE IT HELPS,
Regards,
Bikash