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.

By Madhushan, Founder & Lead Developer ·

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

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:

CaseExample rate typesWhy
One clearance countryZCUSOne customs table applies.
Several EU member statesZCDE, ZCNL, ZCFREach member state sets its own monthly table; goods cleared in Rotterdam use the Dutch one.
Separate import and export ratesZCIN (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 ChinaZCUSA, ZCCNBuilt 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

  1. Rate type: define it in the feeder system (transaction OB07).
  2. Translation ratios: maintain the ratio for every currency pair in the type (transaction OBBS, table TCURF). Currencies with large unit values (JPY, KRW, IDR, VND and similar) usually need 100 or 1,000; EXCH_RATE is 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:

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

CadenceExamplesWhen to run
MonthlyEU member states (Art. 146 tables), China, Thailand, UgandaWhere the table is set early (EU, China): last days of the previous month with /next (paid plans). Otherwise on the 1st with /latest
FortnightlyIndia (CBIC)Daily check; a notification takes effect the day after it is issued
WeeklyJapan, Korea, Iceland, IndonesiaBefore the week starts
DailyCanada, Australia, South Africa, SwitzerlandEvery 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

Troubleshooting

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