‎2008 Jan 31 12:37 PM
Hi,
I need a Function Module to round the Number to nearest value.
e.g. Input = 4.017
Output = 4.02
Can you Please tell the Function Module ?
Regards,
Surjith
‎2008 Jan 31 12:42 PM
Hi,
Do like this
data: v_dec1 type p deciamals 3 value '4.017',
v_dec2 type p decimals 2.
v_dec2 = v_dec1.
write: v_dec2.
If this doesn't work, try FM ROUND.
or try this
v_dec2 = ROUND( v_dec3 ).
WRITE v_dec2.
Regards,
Satish
‎2008 Jan 31 12:43 PM
‎2008 Jan 31 12:44 PM
Hi,
Declare a var like below
Data temp type p decimals 2.
move <ur input variable> to temp.
write temp.
it is automatically rounded off.......
Cheers,
Will.
‎2008 Jan 31 12:46 PM
DATA : l_var(4) TYPE p decimals 3.
DATA : l_var2(4) TYPE p decimals 2.
l_var = '4.017'.
CALL FUNCTION 'ROUND'
EXPORTING
DECIMALS = 3
input = l_var
IMPORTING
OUTPUT = l_var2.
write : l_var2.
‎2008 Jan 31 12:54 PM
Hi,
Please try this function module:
Try the function ROUND.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Jan 31, 2008 12:31 PM
‎2016 May 10 11:50 AM
Hi All
Use the below code and it is so simple
For 2 decimal places
data(lv_round) = round( val = '5678.65800341' dec = 2 ).
lv_round will be 5678.66
data(lv_round) = round( val = '5678.65300341' dec = 2 ).
lv_round will be 5678.65
For 5 decimals
data(lv_round) = round( val = '5678.65800741' dec = 5 ).
lv_round will be 5678.65801
data(lv_round) = round( val = '5678.65800341' dec = 5 ).
lv_round will be 5678.65800
Thanks,
Murugan