Solution Architecture:
Setting Up Exchange Rate Provider in Ax 2012 R2:
In Ax 2012 R2 CU1 as Out Of Box Feature, Following are the steps that describe how to easily setup the Exchange Rate Providers.
- You must first set up the exchange rate provider you want to use, and AX 2012 R2 comes with 3 providers ready to use in General Ledger -> Setup -> Currency -> Configure Exchange Rate Providers :
- Once this is done, General Ledger -> Periodic -> Import Currency Exchange Rates allows you to choose which Exchange Rate Type you want to import the rates for, and using which provider.
- You can of course set one up for each rate type, and even schedule these to import periodically using the standard AX batch feature
- Once this has run, your rates can be reviewed inGeneral Ledger -> Setup -> Currency -> Exchange Rates :
Steps to Customize and Enable New providers in Ax 2012 R2
A customization is required, where a provider class(EX: ExchangeRateProviderXXX) created extending form ExchangeRateProvider Class.
- In the classdeclaration()
- Declare the Provider Id macro with value - '[ Enter GUID of the provider here]'
- DeclareService Current URL Macro with - '[Service URL for current date provided by the service provider here]'
- DeclareService on Date URL Macro with - '[Service URL for date range provided by the service provider here]'
- In the getConfigurationDefaults()
- Set default values for addNameValueConfigurationPair
- Set ServiceCurrentURL, ServiceOnDateURL to NameValueConfigurationPair
- In the getExchangeRateDisplayFactor() Set the Switch case from 1-1000 Exchange Rate Display Factor.
- In the getExchangeRateFromNode() set the loop to get the ExchangeRate from the XML Response node.
- In the getExchangeRates() set the ExchangeRateRequest which sends a request to the Service Provider using the web service and sending the Request XML.
- In the getExchangeRatesFromService() pulls the data from the response XML file and distributes the data to the respective fields, Assert, and Revert the FileIO Permissions.
- In the getName() return a string with name '[Service Provider Name]' to Display it on form.
- In the getProviderId()consume the macro declared in the class declaration.
- In the getSupportOptions()set parm methods for options for CurrencyPairs, SpecificDates, ISO Currency.
- In the providerId() return the providerId received from getProviderId Method.
Compile the objects, resolve syntax of BP errors/Warnings If any, Create labels for the text and then Generate Full CIL.
Hence that Enables your service provider as shown below: