11-16-2007 6:39 AM
Hi ,
I want a Conversion Routine for Converting CAD to USD Currency ..
If possible give some sample codes.
Thanks,
Gokul.
11-16-2007 6:42 AM
Hi try this...
data:
w_amt like knka-KLIMG.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
date = sy-datlo
foreign_currency = 'USD'
local_amount = '1000'
local_currency = 'CAD'
RATE = 0
TYPE_OF_RATE = 'M'
READ_TCURR = 'X'
IMPORTING
EXCHANGE_RATE =
FOREIGN_AMOUNT = w_amt
FOREIGN_FACTOR =
LOCAL_FACTOR =
EXCHANGE_RATEX =
DERIVED_RATE_TYPE =
FIXED_RATE =
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
11-16-2007 6:47 AM
Hi
Use an FM like CONVERT_TO_FOREIGN_CURRENCY or CONVERT_TO_LOCAL_CURRENCY whichever is more relevant in your case.
Additionally please ensure that the exchnage rates are maintained in transaction OB08 or check table TCURR.. Besides you also need to ensure that the right exchange rate type is used.
Regards
Arun