2008 May 29 9:06 AM
Hi Folks,
Can some please provide some logic to round of the values? I have one field p_temp of type P decimals 2. If it contain 1.24 it should round to 1, and if it contains 1.7 then it should round to 2. Simply it the decimal point is greater than .5 then it should round to the next value. And if it is less than .5 then it should round the current.
Please help me to put the dynamic logic.
Thanks,
Raghu.
Hi Folks,
Can some please provide some logic to round of the values? I have one field p_temp of type P decimals 2. If it contain 1.24 it should round to 1, and if it contains 1.7 then it should round to 2. Simply it the decimal point is greater than .5 then it should round to the next value. And if it is less than .5 then it should round the current.
Please help me to put the dynamic logic.
Thanks,
Raghu.
2008 May 29 9:07 AM
2008 May 29 9:08 AM
HI,
Declare one integer variable and pass this value to that integer then the value will automatically round.
Rgds,
Bujji
2008 May 29 9:08 AM
Hi,
DATA: VAR1 TYPE P DECIMALS 2,
RES TYPE P DECIMALS 2.
VAR1 = '12.33'.
RES = ROUND( VAR1 ).
WRITE RES.
Also check the following Function modules
ROUND_AMOUNT
FI_ROUND_AMOUNT
FM HR_IN_ROUND_AMT
Regards,
Raj.
2008 May 29 9:10 AM
hi,
Use ceil or floor command to convert ..
data : v_d(10) type p decimals 2.
v_d = '352.65'.
v_d = ceil( v_d ).
data : v_d1(10) type p decimals 2.
v_d1 = '352.25'.
v_d1 = floor( v_d1 ).
regards
siva
2008 May 29 9:22 AM
Hi,
Check the below code :
data : i_val type i.
parameters : p_dec type p decimals 2.
i_val = p_dec.
write : i_val.NOTE : dont give 1.25 instead you can give 1,25. Instead of "." you need to use "," that depends on your user settings.
Regards,
Raghu
2008 May 29 9:56 AM
2008 May 29 10:12 AM
Hi Raghu,
U can use the FM 'ROUND'
CALL FUNCTION 'ROUND'
EXPORTING
* DECIMALS = 0
input = v_data
* SIGN = ' '
IMPORTING
OUTPUT = v_data
.
thanks,
teja.