Official Exchange Rates into SAP with Integration Suite and ABAP: Package Guide
Set up the sap-official-exchange-rates package: a SAP Integration Suite iFlow that maps the AllRatesToday API to an EXCHANGE_RATE01 IDoc, or an ABAP report that posts with BAPI_EXCHRATE_CREATEMULTIPLE. Properties, adapter settings, backend setup, two-sided tables and tests.
The open-source sap-official-exchange-rates package loads official exchange rates (customs valuation rates by clearance country, central bank reference rates, tax authority tables) into SAP table TCURR under a rate type you choose. It has two routes. Both are reference implementations to review, test in a sandbox client and adapt. The Groovy mapping is unit-tested; the ABAP report has not been run in an SAP system by us.
| Route | For | File |
|---|---|---|
| SAP Integration Suite (Cloud Integration) | S/4HANA and ECC, on-premise or private cloud, through Cloud Connector | integration-suite/ExchangeRateToIdoc.groovy |
| ABAP report | On-premise systems that call the API directly | abap/zallrates_load_exchange_rates.prog.abap |
Which endpoint to call
- Customs rate for a clearance country:
GET /api/v1/customs/{country}/latest, ISO code such asNL,US,IN. - A past declaration date:
/api/v1/customs/{country}/{YYYY-MM-DD}(paid plans). - A central bank or tax authority table:
/api/v1/central-bank/{code}/latest, for exampleecb,hmrc,rbi.
Send the key as Authorization: Bearer <key>. Every response carries
rate_date, the authority's own table date, which both routes write as VALID_FROM.
Route 1: Integration Suite iFlow
- Timer start event on the source's cadence (see the schedule table).
- Request Reply to an HTTP receiver calling the endpoint. Keep the key in a Secure Parameter and set the
Authorizationheader in a Content Modifier. - Content Modifier setting the exchange properties below, then a Groovy Script step with
ExchangeRateToIdoc.groovy. - IDoc receiver adapter to the SAP system.
Script properties
| Property | Meaning | Default |
|---|---|---|
RateType | TCURR exchange rate type (KURST) | M |
HomeCurrency | Write every rate as foreign → home (direct quotation) | the table's own direction |
Currencies | Comma list to keep | all |
Factors | Ratios matching OBBS/TCURF, e.g. JPY:100,KRW:1000 | 1 |
TableRateType | Side of a two-sided table: import or export | one row per currency, import first |
SenderPort, SenderPartner, ReceiverPort, ReceiverPartner | EDI_DC40 partner data (partner type LS) | none |
UpdateAllowed / ChangeFixed / AllowedDeviation | UPD_ALLOW / CHG_FIXED / DEV_ALLOW | X / blank / 000 |
For the export side of India's customs table, for example:
RateType = ZCIX # TCURR rate type (KURST)
HomeCurrency = INR # write every rate as foreign -> home
Currencies = USD,EUR,GBP # optional filter
Factors = JPY:100 # must match OBBS / TCURF
TableRateType = export # import or export, for two-sided tables
SenderPort = SAPCPI
SenderPartner = CPI_LS
ReceiverPort = SAPS4H
ReceiverPartner = S4H_100
Rates are written with 5 decimals (EXCH_RATE is DEC 9,5). A rate that does not fit for the
chosen factor is skipped, not truncated: give that currency a ratio in Factors and
OBBS. The script also sets the headers AllRatesRateDate,
AllRatesSource and AllRatesRows for monitoring.
IDoc receiver adapter
As in SAP's own exchange-rate recipe in the SAP Integration Recipes repository:
- Address
http://<virtual host>:<port>/sap/bc/srt/idoc?sap-client=<client>, using the Cloud Connector virtual host. - Proxy Type On-Premise, with your Cloud Connector Location ID.
- Authentication Basic (User Credentials artifact).
- IDoc Content Type Text/XML.
SAP backend
SRTIDOC: register the IDoc SOAP inbound service (default values).SICF: activate/sap/bc/srt/idoc.WE20: inbound partner profile for the sender logical system with message typeEXCHANGE_RATE(basic typeEXCHANGE_RATE01). Sender partner, partner type and port must match the IDoc, or it stops in status 56.OBBS: translation ratios for every pair in the rate type, matchingFactors.
Route 2: ABAP report
ZALLRATES_LOAD_EXCHANGE_RATES calls the API with CL_HTTP_CLIENT, parses the
response with /UI2/CL_JSON, writes every rate as foreign → home and posts with
BAPI_EXCHRATE_CREATEMULTIPLE and BAPI_TRANSACTION_COMMIT.
| Parameter | Meaning |
|---|---|
P_CNTRY or P_SRC | Clearance country (customs), or a source code such as ecb, hmrc, zollde |
P_DATE | Table in force on this date; empty for today's table |
P_HOME | Ledger or customs currency |
P_KURST | Rate type, default ZCUS |
P_CURR, P_FACT | Optional currency list and ratios (JPY:100) |
P_RTYP | Table side for two-sided tables: import or export; empty = one row per currency, import first |
P_UPD, P_TEST | Allow overwrite; test mode lists without posting (on by default) |
Prerequisites: the SSL client PSE (STRUST) trusts allratestoday.com's certificate chain,
GET_API_KEY is replaced with your secure storage, and the translation ratios exist. Schedule
it in SM36 on the source's cadence, one variant per rate type.
Two-sided tables
India (CBIC), Thailand, Korea, Iceland and Uganda publish separate import and export rates per currency,
and Uganda adds VAT and income-tax series. A TCURR rate type holds one rate per pair and date, so both
routes keep one row per currency: the side named in TableRateType /
P_RTYP, or the import side when none is named. Load each side into its own rate type, for
example ZCIN with import and ZCIX with export, and assign
each to the matching legal regulation in SAP GTS.
Tests
The Groovy mapping is tested with plain Groovy 4 and a stand-in for the CPI Message class:
CP="groovy-4.0.24.jar:groovy-json-4.0.24.jar:groovy-xml-4.0.24.jar"
java -cp "$CP" org.codehaus.groovy.tools.FileSystemCompiler -d build \
test/com/sap/gateway/ip/core/customdev/util/Message.groovy
java -cp "$CP:build" groovy.ui.GroovyMain test/run.groovy # ExchangeRateToIdoc: ok The tests cover direction and inversion, ratios, the currency filter, skipped oversize rates, IDoc control data and the import/export selection on a two-sided table.
S/4HANA Cloud, public edition
Not covered by the package. Public edition takes exchange rates through SAP's own interfaces; check the current options and field names on the SAP Business Accelerator Hub for your release, and contact us if you need this route.
Rolling this out?
Tell us your SAP landscape and clearance countries and we will help map rate types and sources.
Talk to us View the package on GitHub