2008 Feb 27 6:58 AM
Hi Experts,
what is the difference between
CONVERT_TO_FOREIGN_CURRENCY
and
CONVERT_TO_LOCAL_CURRENCY
THANKS IN ADVANCE
Hi Experts,
what is the difference between
CONVERT_TO_FOREIGN_CURRENCY
and
CONVERT_TO_LOCAL_CURRENCY
THANKS IN ADVANCE
2008 Feb 27 7:03 AM
Hi
The difference between CONVERT_TO_LOCAL_CURRENCY and CONVERT_TO_FOREIGN_CURRENCY is:
Foreign currency is TCURR-FCURR (From Currency)
Local Currency is TCURR-TCURR (To Currency)
So result will be slightly different for the both functions (two rates stored in the TCURR: e.g. JPY->USD rate is 0.00880, USD->JPY rate is 122.00000). Its better to use CONVERT_TO_LOCAL_CURRENCY, because multiplication is more exact operation than division.
Both conversion functions can return also selected rate and factors.
Thanks
Vasudha
2008 Feb 27 7:05 AM
hi
CONVERT_TO_FOREIGN_CURRENCY" This translates local currency amount into foreign currency.
An amount in foreign currency is calculated from a specified local currency amount. You may either specify the translation rate manually (Parameter RATE) or have the system determine it from table TCURR on the basis of the rate type, date and currency key. The ratios for the units of the currencies involved in the translation are significant for this translation, table TCURR is always read by the program and there must be a valid entry for the data specified. If exchange rate fixing is defined for exchange rate type TYPE_OF_RATE, or an alternative exchange rate type is defined for the currency pair, this information is transferred to the calling program.
When table TCURR is read, the foreign currency key is always taken as the first part of the key and the local currency as the second part. If this entry is not in the table, the key is re-read in reverse sequence.
Heres a sample code:
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING DATE = BKPF-WWERT
FOREIGN_CURRENCY = BKPF-WAERS
LOCAL_CURRENCY = T001-WAERS
LOCAL_AMOUNT = BSEG-DMBTR
RATE = BKPF-KURSF
TYPE_OF_RATE = 'M'
IMPORTING EXCHANGE_RATE = KURS
FOREIGN_AMOUNT = BSEG-WRBTR
FOREIGN_FACTOR = FAKTOR-F
LOCAL_FACTOR = FAKTOR-L
EXCEPTIONS NO_RATE_FOUND = 4
NO_FACTORS_FOUND = 8.
Try this also and use the following F.M's:
CONVERT_TO_FOREIGN_CURRENCY - Converts local currency to foreign currency.
CONVERT_TO_LOCAL_CURRENCY - Converts from foreign currency to local currency
Code:
PARAMETERS: P_UKURS LIKE TCURR-UKURS.
DATA: BEGIN OF GI_TAB OCCURS 0,
KONWA LIKE KONP-KONWA,
STPRS LIKE MBEW-STPRS,
WAERS LIKE T001-WAERS,
END OF GI_TAB.
DATA: L_STPRS LIKE MBEW-STPRS,
L_RATE LIKE TCURR-UKURS.
IF P_UKURS IS INITIAL.
CLEAR L_RATE.
ELSE.
L_RATE = P_UKURS / 100.
ENDIF.
CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'
EXPORTING
DATE = SY-DATUM
FOREIGN_CURRENCY = GI_TAB-KONWA
LOCAL_AMOUNT = GI_TAB-STPRS
LOCAL_CURRENCY = GI_TAB-WAERS
RATE = L_RATE
IMPORTING
FOREIGN_AMOUNT = L_STPRS
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = SY-DATUM
FOREIGN_AMOUNT = L_BELOEB
FOREIGN_CURRENCY = 'JPY'
LOCAL_CURRENCY = 'DKK'
RATE = L_RATE
TYPE_OF_RATE = 'M'
IMPORTING
EXCHANGE_RATE = L_RATE
FOREIGN_FACTOR =
LOCAL_AMOUNT = L_BELOEB
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.
hope it will help you
regards
sreelatha gullapalli
2008 Feb 27 7:07 AM
CONVERT_TO_FOREIGN_CURRENCY Convert local currency to foreign currency.
CONVERT_TO_LOCAL_CURRENCY Convert from foreign currency to local currency
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |