‎2010 Jul 19 11:53 PM
Hi Experts,
I have input data from Excel file, every number is pure number without format.
After uploading the file to an internal table, I assign it to a variable with data type CURR 13 with 2 decimal places.
The problem is:
20 USD in excel file will become 20.00 USD in SAP which is correct BUT
20000 VND in excel file will become 20000.00 VND
and when I saved this value to the database and view it on screen it becomes: 2,000,000 VND which is not correct. I see it 100 times than the original value.
Can any body explain to me why? and how do I fix this?
Thanks,
Anthony
‎2010 Jul 20 1:51 AM
Hi,
do you use fixed point arithmetic in your program? To check this display program attributes in SE38.
Cheers
‎2010 Jul 20 3:23 AM
Hi ,
Use the below logic Instead of DMBTR use your Amount field.
SELECT SINGLE * FROM t001 INTO l_t0011 WHERE bukrs = <fs_original>-bukrs.
SELECT SINGLE * FROM tcurx INTO l_curr
WHERE currkey = l_t0011-waers.
IF sy-subrc EQ 0 .
v_con = 100.
DO l_curr-currdec TIMES.
v_con = v_con / 10.
ENDDO.
Rgds,
Arun
<fs_reposted>-dmbtr = <fs_reposted>-dmbtr * v_con.
ENDIF.
‎2010 Jul 20 3:40 AM
hi anthony,
can you try this one?
before assigning the value to the variable with the data type of currency,
just use WRITE TO with the CURRENCY 'USD'.
rgds,
guna..
‎2010 Jul 20 5:21 AM
Hi Anthony,
I think you should do a conversion step for currency amount before insert them to DB. Please try FM:
BAPI_CURRENCY_CONV_TO_INTERNALfor each currency code and currency amount.
Hope that helps.
Thien
‎2010 Jul 20 4:33 PM
Thank you all for your help!
Actually I use the FM
CURRENCY_CONVERTING_FACTORand I calculate the actual amount by doing:
lv_amount = lv_amount / factor "return from the above FM It works.