2008 Jul 09 4:35 AM
Hi all,
I have a requirement as given below . Can anyone suggest me what should be done to get this solution.
"Quantity is a decimal number u2013 The integration team is expecting integer , so lets round it off to the nearest integer if there is a decimal value. For eg. if the value is 100.5, we should round it to 101. No decimal places should be sent in the file."
Frnds plzz suggest me solutions.
regards,
karan
2008 Jul 09 4:49 AM
Hi,
TRY THIS CODE
take second variable of type c and in write statement
write <1st var> to <2nd var> decimals 0.
regards.
sriram.
2008 Jul 09 4:52 AM
Hi
It can be done using write statement if you want to round the amount field in the report. This can be easily achieved by the following operation. A constant need to be defined with value 0.5. rounding is achieved by amount = floor( amount + constant ).
alternatively T-code OAYO helps in rounding off.
regards
Divya
2008 Jul 09 4:54 AM
Hi,
other wise try this code.
suppose var1 = 1234.56
write:/ var1 out put is 1,234.560
write:/ var1(.1) output is 1,234.6
write:/ var1(.4) output is 1,234.5600
write:/ var1(.0) output is 1,235
here last one is your answer.
regards.
sriram
2008 Jul 09 4:57 AM
hi,
do this way ...
data : v_int type i,
v_quant like bseg-dmbtr.
v_quant = '126.67'.
CALL FUNCTION 'ROUND'
EXPORTING
* DECIMALS = 0
input = v_quant
* SIGN = ' '
IMPORTING
OUTPUT = v_int.
write : v_int.
Regards,
Santosh
.
2008 Jul 09 4:59 AM
hi karan,
watch out for this example,i know it will definately help you out.
DATA A TYPE P DECIMALS 3.
A = '123.456'.
WRITE: / A ROUND -2,
/ A ROUND -1,
/ A ROUND 1.
plzz do give points also.
2008 Jul 09 5:32 AM
Hi kiran,
There is no need to use any coding OR calling the Function modules ,
The simplest way to solve this problem is just declare one variable with integer type (i.e type i)
and move the deciamal value into that variable( type i), it will be rounded off,
Reward me points if helpfull,
Regards,
Krishna Prasad.K
2008 Jul 09 5:44 AM
Hi,
Try this code:
data : amt(10) type p decimals 2 value '100.2',
res type I.
res = amt.
write : res.
OR
Use can use FM ROUND.
Thanks,
Sriram Ponna.
2011 Feb 09 6:14 AM