GetExchRate

Get Exchange Rate

Minor Business Rule

Object Name: B0000033

Parent DLL: CALLBSFN

Location: Client/Server

Language: C

Functional Description

Purpose

This function retrieves the exchange rate from the Currency Exchange Rates table (F0015) based on 

currency code from, currency code to, address number and transaction date.  If an exact date match is not 

found, this function will pick up the most recent rates. If triangulation does not occur between the 

"From" and "To" currencies, then both the multiplier and divisor rates are returned.  In addition, a 

default rate is returned based on the currency conversion method stored in the Currency Exchange Rates 

table. However, if triangulation does occur, the triangulation rates will be returned.  The 

multiplier, divisor, and default rates will all be returned as zero.

 


Setup Notes and Prerequisites


 
Special Logic

• This function should be called only when the exchange rate is 0 (meaning the user did not key in a 
spot rate).

• This function will first attempt to fetch using a specified address book number.  If a rate is not 
found, a fetch is made using zero in the address number field.

'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7

'b7'b7'b7'b7

Technical Specification

• First attempt to fetch based on the currency code from, currency code to, address book and 
transaction date.

• If a record was not found try using an address book number of zero.
• If we have a "Triangulation" currency (determined by the calculation method parameter in the 
record), return the multiplier rate as the triangulation rate 1 and the divisor as the triangulation rate 2.  

Zero out the multiplier, divisor, and default rate parameters to be returned.  Set the date effective 

rates parameter equal to the effective date.

• If we don't have triangulation (step 3 above is not true) then retrieve the current exchange rate 
based on the transaction date passed in.  If no rates are found then set an error and return.  If rates 

are found then load the multiplier and divisor rates.  Load the date effective rates parameter with 

the effective date of the rates. Set the conversion method equal to the conversion method set up in the 

record that was retrieved.  If the conversion method is 'Y' then set the default rate equal to the 

multiplier rate, if not then set the default rate equal to the divisor rate. 

'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7'b7

'b7'b7'b7'b7



Data Structure

D0000033 - Get Exchange Rate


Parameter NameData ItemData TypeReq/OptI/O/Both
szCurrencyCodeFromCRCDcharOPTNONE

Special Input Expected
This is the currency code that we are converting an amount from. 


szCurrencyCodeToCRDCcharOPTNONE

Special Input Expected
This is the currency code that we are converting the amount to.

mnAddressNumberAN8MATH_NUMERICOPTNONE

Special Input Expected
If not input, '0' is used.  We will first try to fetch a rate using this address number (if it is 
passed in).  If we do not find a rate then we will try again without using the address number.

jdTransactionDateDGJJDEDATEOPTNONE

Special Input Expected
This is the date of the transaction that the exchange rate is needed  for.ab 

mnCurrConvRateMultCRRMATH_NUMERICOPTNONE

Special Output Returned
This is the multiplier rate between the From and To currency codes.  The amount in the From currency 

would be multiplied by this number in order to calculate the amount for the To currency.   If 

triangulation occurs between the From and To currencies, this parameter will be zero.

mnCurrConvRateDivCRRDMATH_NUMERICOPTNONE

Special Output Returned
 This is the divisor rate between the From and To currency codes.  The amount in the From currency 

would be divided by this number in order to calculate the amount for the To currency. If triangulation 

occurs between the From and To currencies, this parameter will be zero.

jdDateEffectiveRatesEFTJDEDATEOPTNONE

Special Output Returned
This is the date that the exchange rates returned were effective from.  If triangulation occurs 

between the From and To currencies, this parameter will be returned with the value of the override 

effective date.

mnDefaultRateCRRMATH_NUMERICOPTNONE

Special Output Returned
This is the rate that corresponds to the conversion method set up in the general accounting 

constants, or the override conversion method setup for the From and To currencies.  If the method is 'Y' then 

this will be the multiplier rate.  If the method is 'Z' then this will be the divisor rate. If 

triangulation occurs between the From and To currencies, this parameter will be  zero.ab 


mnTriangulationRate1CRRDMATH_NUMERICOPTNONE

Special Output Returned
If triangulation occurs between the From and To currencies, then the two rates which need to be 

passed to CurrencyConvForAndDom (B0000027) for conversion are passed back in mnTriangulationRate1 and 

mnTriangulationRate2.  In the case of triangulation the multiplier rate (mnCurrConvRateMult), divisor rate 

(mnCurrConvRateDiv), and default rate (mnDefaultRate) are passed back as zero.  Also the 

cConversionMethod parameter is passed back as blank.  If  triangulation does not occur then mnTriangulationRate1 

and mnTriangulationRate2 are passed back as zero and the appropriate rates are passed back in the 

multiplier rate (mnCurrConvRateMult), divisor rate (mnCurrConvRateDiv), and default rate (mnDefaultRate) 

parameters.

mnTriangulationRate2CRRMATH_NUMERICOPTNONE

Special Output Returned
If triangulation occurs between the From and To currencies, then the two rates which need to be 

passed to CurrencyConvForAndDom (B0000027) for conversion are passed back in mnTriangulationRate1 and 

mnTriangulationRate2.  In the case of triangulation the multiplier rate (mnCurrConvRateMult), divisor rate 

(mnCurrConvRateDiv), and default rate (mnDefaultRate) are passed back as zero.  Also the 

cConversionMethod parameter is passed back as blank.  If  triangulation does not occur then mnTriangulationRate1 

and mnTriangulationRate2 are passed back as zero and the appropriate rates are passed back in the 

multiplier rate (mnCurrConvRateMult), divisor rate (mnCurrConvRateDiv), and default rate (mnDefaultRate) 

parameters. 

cConversionMethodCRCMcharOPTNONE

Special Output Returned
If the F00151 record for the From and To currency has a conversion method specified and the 

transaction date is greater then the override effective date in the Currency Rates Header table (F00151) then 

that method will be returned, if not, the method set up in the general accounting constants will be 

returned.ab 


jdOverrideEffectiveDateEFTJDEDATEOPTNONE

Special Output Returned
This parameter will contain the override effective date stored in the Currency Rates Header table 

(F00151) if not blank.

Related Functions

None

Related Tables

F0015 Currency Exchange Rates