2007 Dec 22 7:56 AM
Will anyone let me know how to convert currency to local currency, I am presently trying with CONVERT_TO_LOCAL_CURRENCY function module, but I am not getting any result.
Please let me know first of all is this function module is the correct one? and if it's correct one, Pls. let me know any pre requisites are supposed to be taken place to use this function module?
2007 Dec 22 1:05 PM
Hi,
ok this is how i did that:
Code:
----
Calculate_currency - convert currency to local *
----
FORM calculate_currency
USING
lv_date LIKE wa_data-fldate "date is needed as on current date should be set exchange rate (be carefull with type i left my original)
lv_foreign_amount LIKE lv_totalprice "number
lv_foreign_currency LIKE wa_data-currency "currency identificator
lv_local_currency TYPE c "currency identificator
CHANGING
lv_local_amount TYPE p. "number
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
date = lv_date
foreign_amount = lv_foreign_amount
foreign_currency = lv_foreign_currency
local_currency = lv_local_currency
RATE = 0
TYPE_OF_RATE = 'M'
READ_TCURR = 'X'
IMPORTING
EXCHANGE_RATE =
FOREIGN_FACTOR =
local_amount = gv_local_amount
LOCAL_FACTOR =
EXCHANGE_RATEX =
FIXED_RATE =
DERIVED_RATE_TYPE =
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.
ENDFORM. "Calculate_currencytake a look on exceptions which you get after, it might be helpfull
Regards,
Satish.
2007 Dec 22 10:07 AM
Hi,
The FM you are using is correct. The date you are passing may not correct. For testing purpose Go to se11 and see the values is TCURR table.
For ex. If you want the exchange rate as M (which is Month Begin Exchnage rate), the date you are passing to the FM should always Begin of the month.
Thanks,
Sriram Ponna.
2007 Dec 22 1:05 PM
Hi,
ok this is how i did that:
Code:
----
Calculate_currency - convert currency to local *
----
FORM calculate_currency
USING
lv_date LIKE wa_data-fldate "date is needed as on current date should be set exchange rate (be carefull with type i left my original)
lv_foreign_amount LIKE lv_totalprice "number
lv_foreign_currency LIKE wa_data-currency "currency identificator
lv_local_currency TYPE c "currency identificator
CHANGING
lv_local_amount TYPE p. "number
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
CLIENT = SY-MANDT
date = lv_date
foreign_amount = lv_foreign_amount
foreign_currency = lv_foreign_currency
local_currency = lv_local_currency
RATE = 0
TYPE_OF_RATE = 'M'
READ_TCURR = 'X'
IMPORTING
EXCHANGE_RATE =
FOREIGN_FACTOR =
local_amount = gv_local_amount
LOCAL_FACTOR =
EXCHANGE_RATEX =
FIXED_RATE =
DERIVED_RATE_TYPE =
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.
ENDFORM. "Calculate_currencytake a look on exceptions which you get after, it might be helpfull
Regards,
Satish.