‎2009 Dec 03 7:23 AM
Dear All,
I want convert INR currecny to USD dollor currency. In my program it display result 0. I want sample program for currecny conversion. I have include my program for persual.
DATA: xrate TYPE f,
lamt TYPE p,
ffact TYPE f,
lfact TYPE f.
PARAMETERS: fcurr LIKE tcurc-waers,
lcurr LIKE tcurc-waers,
famt TYPE p.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
date = sy-datum
foreign_currency = fcurr
local_amount = lamt
local_currency = lcurr
RATE = 50
TYPE_OF_RATE = 'M'
READ_TCURR = 'X'
IMPORTING
exchange_rate = xrate
foreign_amount = famt
foreign_factor = ffact
local_factor = lfact
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 EQ 0.
WRITE:/ lamt, 'converted from',lcurr, 'to',fcurr, 'is:',famt.
WRITE:/ 'exchange rate',xrate,
/ 'foreign factor',ffact,
/ 'local factor',lfact.
ELSE.
WRITE:/ lamt, 'not converted'.
ENDIF.
With Regards,
Sathish M.R
‎2009 Dec 03 7:29 AM
Hi,
I dont think you need to mention the parameter value RATE = 50.
If the exchange rates are maintained in the system, the func module will check the latest based on date and do the conversion.
Regards,
Subramanian
‎2009 Dec 03 7:29 AM
Hi,
I dont think you need to mention the parameter value RATE = 50.
If the exchange rates are maintained in the system, the func module will check the latest based on date and do the conversion.
Regards,
Subramanian
‎2009 Dec 03 7:30 AM
use this.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
DATE = EKBE-BUDAT
LOCAL_AMOUNT = EKBE-DMBTR "XEBEFU-NETWR
FOREIGN_CURRENCY = EKKO-WAERS "EKKO-WAERS
LOCAL_CURRENCY = T001-WAERS "T001-WAERS
* TYPE_OF_RATE = KURSTYP
IMPORTING
FOREIGN_AMOUNT = I_WRBTR . "XEBEFU-NETWREdited by: Aeda N on Dec 3, 2009 1:01 PM
Edited by: Aeda N on Dec 3, 2009 1:04 PM
‎2009 Dec 03 7:31 AM
First the exchange rates should be maintained in the table TCURR. Please check this.
Also check the below sample.
DATA : L_NETWR TYPE VBAP-NETWR.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = SY-DATUM
FOREIGN_AMOUNT = '18'
FOREIGN_CURRENCY = 'INR'
LOCAL_CURRENCY = 'USD'
TYPE_OF_RATE = 'M'
IMPORTING
LOCAL_AMOUNT = L_NETWR
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6.
WRITE: L_NETWR.
‎2009 Dec 03 8:26 AM
Hello Satish,
Please check in table TCURR what is the exch. rate type maintained for INR to USD.
As mentioned by J@y the exch. rate must be maintained in TCURR for this FM to behave correctly. Also one thing to note is: are the variables fcurr, lcurr & lamt populated correctly during the FM call?
BR,
Suhas