Customs Exchange Rates in SAP GTS: Step-by-Step Setup
Set up official customs exchange rates for SAP Global Trade Services: one rate type per clearance country and direction, translation ratios, scheduled loads from the customs API, ALE distribution to GTS, the legal regulation assignment, checks and troubleshooting.
SAP Global Trade Services values customs declarations in the currency of the clearance country, at the
exchange rate that country's customs authority fixed for the declaration date. That is not the
M rate your postings use. This guide sets up the whole chain: rate types in the feeder system,
a scheduled load from the customs exchange rate API, distribution
to GTS, and the assignment that makes GTS use the right rate. For loading TCURR in general, see the
SAP guide.
How GTS reads exchange rates
- Rates live in table TCURR of the feeder system (S/4HANA or ECC), keyed by exchange rate type, from-currency, to-currency and valid-from date, and are distributed to GTS.
- GTS uses the exchange rate type assigned to each legal regulation in the customizing activity Control Setting for "Customs Processing" Service.
- The same settings decide whether the rate is read again at each duty calculation or fixed when first read (data element
/SAPSLL/CVRTF). - TCURR holds a valid-from date only. A rate stays in force until the next one, which is exactly how customs tables work.
1. Plan the rate types
One customs table per rate type. The table is set by the clearance country, and in some countries by the direction of the goods, so plan the types before creating them:
| Case | Example rate types | Why |
|---|---|---|
| One clearance country | ZCUS | One customs table applies. |
| Several EU member states | ZCDE, ZCNL, ZCFR | Each member state sets its own monthly table; goods cleared in Rotterdam use the Dutch one. |
| Separate import and export rates | ZCIN (import), ZCIX (export) | India, Thailand, Korea, Iceland and Uganda fix both. Each side goes in its own type, assigned to the import or export regulation. |
| US and China | ZCUSA, ZCCN | Built by rule from the Federal Reserve and CFETS series; responses say "method": "rule" with the rule in basis. |
Rate type names above are examples; use your naming standard. GET /api/v1/customs (no key)
lists which authority covers each country.
2. Create the rate types and ratios
- Rate type: define it in the feeder system (transaction
OB07). - Translation ratios: maintain the ratio for every currency pair in the type (transaction
OBBS, tableTCURF). Currencies with large unit values (JPY, KRW, IDR, VND and similar) usually need 100 or 1,000;EXCH_RATEis DEC 9,5, so a rate above 9,999.99999 for one unit does not fit. Without the ratio, the load and the transfer to GTS fail with a message asking you to maintain the translation ratios.
3. Load the customs tables on schedule
Three ways in, all writing the same TCURR rows:
- SAP Integration Suite: an iFlow that maps the API response to an
EXCHANGE_RATE01IDoc. Ready-made in the SAP package guide. - ABAP report:
ZALLRATES_LOAD_EXCHANGE_RATESfrom the same package, scheduled inSM36. - RFC from a script:
BAPI_EXCHRATE_CREATEMULTIPLE, for example with Python andpyrfc:
import requests
from pyrfc import Connection
API = "https://allratestoday.com/api/v1/customs"
HEADERS = {"Authorization": "Bearer art_live_your_key"}
PREF = ["reference", "mid", "import", "buy", "sell", "export"] # the API's own order
def customs_rows(country, home_ccy, rate_type, side=None, factors=None, date="latest"):
"""TCURR rows (foreign -> home) for one customs rate type."""
factors = factors or {}
t = requests.get(f"{API}/{country}/{date}", headers=HEADERS, timeout=10).json()
rates = [r for r in t["rates"] if side is None or r["type"] == side]
rates.sort(key=lambda r: PREF.index(r["type"]) if r["type"] in PREF else 99)
seen, rows = set(), []
for r in rates:
if r["quote"] == home_ccy:
ccy, v = r["base"], r["value"]
elif r["base"] == home_ccy:
ccy, v = r["quote"], 1 / r["value"]
else:
continue
if ccy in seen: # one side per currency per rate type
continue
seen.add(ccy)
f = factors.get(ccy, 1)
rows.append({"RATE_TYPE": rate_type, "FROM_CURR": ccy, "TO_CURRNCY": home_ccy,
"VALID_FROM": t["rate_date"].replace("-", ""),
"EXCH_RATE": round(v * f, 5), "FROM_FACTOR": f, "TO_FACTOR": 1})
return t, rows
conn = Connection(ashost="erp.example.com", sysnr="00", client="100", user="RFCUSER", passwd="...")
for country, home, kurst, side in [("NL", "EUR", "ZCNL", None), ("DE", "EUR", "ZCDE", None),
("IN", "INR", "ZCIN", "import"), ("IN", "INR", "ZCIX", "export")]:
t, rows = customs_rows(country, home, kurst, side, factors={"JPY": 100, "KRW": 1000})
res = conn.call("BAPI_EXCHRATE_CREATEMULTIPLE", EXCHRATE_LIST=rows, UPD_ALLOW="X")
if any(m["TYPE"] in ("E", "A") for m in res["RETURN"]):
raise SystemExit((country, kurst, res["RETURN"]))
conn.call("BAPI_TRANSACTION_COMMIT", WAIT="X")
print(country, kurst, t["authority"]["code"], t["rate_date"], len(rows))
Two rules every route follows: VALID_FROM is the table's rate_date, not the run
date, and a two-sided table gives one row per currency per rate type, the side you ask for.
Loading both sides into one type would leave whichever row was posted last.
Schedule by cadence
| Cadence | Examples | When to run |
|---|---|---|
| Monthly | EU member states (Art. 146 tables), China, Thailand, Uganda | Where the table is set early (EU, China): last days of the previous month with /next (paid plans). Otherwise on the 1st with /latest |
| Fortnightly | India (CBIC) | Daily check; a notification takes effect the day after it is issued |
| Weekly | Japan, Korea, Iceland, Indonesia | Before the week starts |
| Daily | Canada, Australia, South Africa, Switzerland | Every evening or early morning |
The coverage table gives every country's cadence.
Running more often than needed is harmless: with UPD_ALLOW set, a rerun rewrites the same date.
4. Distribute the rates to GTS
Send them the standard way: report RFALEX00 distributes message type
EXCHANGE_RATE over ALE to the GTS system. Set up the RFC destination, distribution model, port
and partner profiles as for any ALE scenario, restrict the distribution to your customs rate types, and
schedule it right after the load job.
5. Assign the rate types to the legal regulations
In GTS customizing, Control Setting for "Customs Processing" Service, assign each customs rate type to the legal regulation for its clearance country (and the export rate type to the export regulation where the country has one). Decide there whether the rate is fixed at first read or read again at each duty calculation. Menu paths differ between GTS 11.0 and SAP GTS, edition for SAP HANA; check the activity names in your release.
6. Check the result
After the first load, compare a few TCURR entries (OB08 or SE16) with the
official table, then follow one test declaration through GTS:
# After the load: compare what TCURR holds with the official table for a date
def check(country, date, ccy, home_ccy, tcurr_rate, factor=1, side=None):
params = {"source": ccy, "target": home_ccy}
if side:
params["type"] = side
r = requests.get(f"{API}/{country}/{date}", params=params, headers=HEADERS, timeout=10).json()
return abs(tcurr_rate / factor - r["rate"]) / r["rate"] < 1e-5, r["rate"], r["rate_date"] Audit trail
- Log each load: clearance country, authority code,
rate_date, rate type and row count. The package writes them as message headers (Integration Suite) or list output (ABAP). - Keep
derivedandmethodfor pairs the authority did not print, andbasisfor rule-built tables. - A past declaration can be re-checked any time:
/api/v1/customs/{country}/{date}returns the table in force on that date.
Troubleshooting
- "Maintain the translation ratios": a pair in the rate type has no
OBBSentry. Add it with the same factor the load uses. - A currency is missing after the load: its rate did not fit DEC 9,5 for one unit; give it a ratio of 100 or 1,000 in both
OBBSand the load. - IDoc in status 56: the sender port, partner or partner type in the IDoc control record does not match the inbound partner profile (
WE20). - The export declaration shows the import rate: the export regulation points at the import rate type, or the export type was loaded without the
exportside. - A new month's EU rate is missing on the 1st: the load ran before the table existed. Use
/nextat month end or rerun on the 1st.
Setting up GTS across several clearance countries?
Tell us your countries and regulations and we will map the tables and rate types.
Talk to us SAP package guide