Fonction SAP CALCULATE_EXCHANGE_RATE - Find Rate Based on Amounts, Currency Keys and Date

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
CLIENT SYST-MANDT C 3 SY-MANDT X
DATE SYST-DATUM D 8 Conversion Date
FOREIGN_AMOUNT 0 Amount in Foreign Currency
FOREIGN_CURRENCY 0 Currency Cey for Foreign Currency
LOCAL_AMOUNT 0 Amount in Local Currency
LOCAL_CURRENCY 0 Currency Key for Local Currency
TYPE_OF_RATE 0 'M' X Exchange Rate Type

Paramètre Reférence Type Long. Description
DERIVED_RATE_TYPE TCURR-KURST C 4 Alternative Exchange Rate, Where Used
EXCHANGE_RATE 0 Exchange Rate
FIXED_RATE 0 Fixed Exchange Rate 4,5, if Present
FOREIGN_FACTOR TCURR-FFACT P 5 Factor for the Foreign Currency Units
LOCAL_FACTOR TCURR-TFACT P 5 Factor for the Local Currency Units

Exception Description
DERIVED_2_TIMES
NO_FACTORS_FOUND No Entry Found in Table TCURF
NO_RATE_COMPUTABLE Translation not Possible
NO_RATE_FOUND Entry not Found in Table TCURR
NO_SPREAD_FOUND Spread not Entered in Table TCURS
OVERFLOW Arithmetical Overflow
RATE_TOO_BIG The Exchange Rate Determined Exceeds Acceptable Limits


A translation rate is determined from the amounts entered. As the rateis also dependent on the units of each individual currency, (e.g. aDEM/ITL rate of 1.67 with the units 1 DEM and 1000 ITL means that 1 DEMis equal to 1670 ITL), table TCURR must also be read before the ratecan be established. For this, you need both currency keys, an exchangerate type and a validity date. The factors determined in this way aretransferred to the calling program along with the determined rate. Ifexchange rate fixing is defined for exchange rate type TYPE_OF_RATE,this information is transferred to the calling program. If one amountis calculated from the other even where a fixed exchange rate is used,this amount is returned instead of the rate calculated.
Example call-up:
CALL FUNCTION 'CALCULATE_EXCHANGE_RATE'
EXPORTING DATE = BKPF-WWERT
FOREIGN_AMOUNT = BSEG-WRBTR
FOREIGN_CURRENCY = BKPF-WAERS
LOCAL_AMOUNT = BSEG-DMBTR
LOCAL_CURRENCY = T001-WAERS
TYPE_OF_RATE = 'M'
IMPORTING EXCHANGE_RATE = KURS
FOREIGN_FACTOR = FAKTOR-F
LOCAL_FACTOR = FAKTOR-L
Exceptions NO_RATE_COMPUTABLE = 4
NO_RATE_FOUND = 8
NO_FACTORS_FOUND = 12.
Exchange rate calculated from the amounts.are read from the table TCURR.rate.