Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SAP to Google over EDI: IDocs in, Merchant API out

Google has no EDI endpoint. Merchant Center takes no X12 or EDIFACT, and no IDoc. It takes Merchant API calls (JSON) or feed files. So “SAP to Google EDI” means this: ECC sends IDocs, its own EDI format, to a translator, and the translator writes to the Merchant API. What matters is where the translator sits, which IDocs it accepts, and what it must refuse.

Which IDocs carry what

IDoc message typeCarriesECC tablesGoes to Google?
MATMASMaterial master: identity, text, units, weights, plants, storage locationsMARA, MAKT, MARMYes: becomes the product input
COND_ACondition records: list price, sale price, validity datesA004, KONPYes: price, salePrice, salePriceEffectiveDate
Stock (no single standard type)Unrestricted stock by plant and storage locationMARDYes: availability. MATMAS carries the storage-location records but not stock quantities; use the IDoc your release already sends for stock (in SAP Retail, LOISTD), or a scheduled RFC read
DEBMASCustomer master: name, address, e-mail, opt-in flagsKNA1, ADR6, KNVVNever directly. Personal data goes through the release gate or nowhere
ORDERS, ORDRSP, DELVRY (DESADV), INVOICOrders, confirmations, deliveries, invoicesVBAK, VBAPNo. Google sends no orders to an ERP. Orders from Google’s agentic checkout land at the storefront first (see below)

Shops that already send X12 832 (price/sales catalogue) or 846 (inventory) to retail partners have the same data leaving ECC. A translator can produce both an 832 for a retailer and a Merchant API insert for Google from one MATMAS + COND_A pair. Only the output differs.

IDoc segments to Merchant API attributes

The translator parses IDoc-XML into the same sap:: structs that the SE16 and RFC paths use, then runs the same converter (src/merchant.rs). Field rules for each attribute are on the Google Merchant Center page; this table only says which segment carries the field.

SegmentFields usedTableMerchant API v1
MATMAS E1MARAMMATNR, EAN11, NUMTP, MFRPN, NTGEW, BRGEW, GEWEI, PRDHA, SATNRMARAofferId, gtins[], mpn, weights, productTypes[], itemGroupId
MATMAS E1MAKTMSPRAS, MAKTXMAKTtitle (one product input per contentLanguage)
MATMAS E1MARMMMEINH, EAN11, LAENG, BREIT, HOEHE, MEABMMARMbase-unit GTIN, shippingLength / Width / Height
COND_A E1KOMGKSCHL, VKORG, VTWEG, MATNRA004 keywhich offer and market the price applies to
COND_A E1KONHDATAB, DATBIA004 validitysalePriceEffectiveDate
COND_A E1KONPKBETR, KPEIN, KONWA, LOEVM_KOKONPprice / salePrice, after the TCURX decimal shift
EDIDC (control record)DOCNUM, MESTYP, CREDAT, CRETIM—idempotency key and, if nothing better is available, versionNumber

Two rules from the Merchant page matter more on this path:

  • Leading zeros. MATNR arrives in the IDoc with internal leading zeros (000000000000012345). The converter’s display_matnr strips them for numeric numbers. A translator that skips that step creates a second offer for the same material.
  • Decimals. KBETR in E1KONP is stored with two decimals whatever the currency, as in KONP. KRW and JPY still need the TCURX shift.

The path

ECC
 BD52/BD61: change pointers on for MATMAS and COND_A
 BD21: change pointers → IDocs (scheduled)
 WE20 partner profile → WE21 port, type XML HTTP
   │  IDoc-XML over HTTPS, out through Cloudflare Tunnel (no inbound port on ECC's network)
   ▼
Cloudflare Worker: the translator
 verify the caller (mTLS) · parse IDoc-XML into sap:: structs · reject any MESTYP not on the list
   │
   ▼
Rust converter (src/merchant.rs) ─▶ Xano merchant_product (one row per offer, keyed by offerId + feedLabel)
   │
   ▼
Merchant API productInputs:insert?dataSource=…   with versionNumber

Nothing in this path writes to ECC. The Worker returns HTTP 200 only after the Xano row is written, so a failure leaves the IDoc in an error status in ECC (WE02 / BD87) where the SAP team already looks. Status 03 in ECC only means “handed to the port”. It says nothing about Google, so reconcile against merchant_product as well.

Mixed-up flows are refused at the parser. The Worker accepts MATMAS, COND_A and the chosen stock type. A DEBMAS sent to the same port by a mistaken partner profile is rejected with a 4xx and logged, not stored. Personal data reaches Google only through the release gate (ECC direct to Google).

Order, replays and versionNumber

IDocs aren’t guaranteed to arrive in order. BD87 reprocessing, a parallel BD21 run or a resend after an outage can deliver an older price after a newer one. Two protections:

  1. Idempotency on DOCNUM. The same IDoc number twice is a no-op in Xano.
  2. versionNumber on every insert. Google refuses an insert whose number is lower than the stored one. Use the change document time (CDHDR UDATE + UTIME) when the extract carries it, as on the Merchant page. An IDoc usually doesn’t, so the fallback is the control record’s CREDAT + CRETIM (when ECC created the IDoc), never the Worker’s receive time: a replay is received late but was created early.

A product’s price and its master data arrive in different IDocs (COND_A and MATMAS) at different times. The translator merges into the Xano row and sends the whole product input; it never sends a half-built product with one IDoc’s fields.

The file-feed alternative

Older EDI setups often go IDoc → middleware → flat file → SFTP or a scheduled fetch by Merchant Center. That still works, but:

Merchant API insertScheduled file
FreshnessPer product, as each IDoc landsPer file: nothing changes until the next fetch
Older data overwriting newerRefused by versionNumberA stale file replaces the data source’s contents
ErrorsPer call, tied to the IDoc that caused themPer fetch, read from Merchant Center diagnostics
CredentialsOAuth service account; short-lived tokenSFTP password or a public fetch URL

The file feed is a fair first step if the middleware already writes one. The API path is the target.

Orders coming back

Google doesn’t send orders to an ERP. When a buyer checks out on Google (for example through UCP agentic checkout), the order is placed at the storefront, and the storefront’s order is what reaches ECC, usually as an ORDERS IDoc inbound. That inbound document is the one SAP counts under Digital Access. Settle it before it ships (Licensing penalties by flow). The product path above is read-only and outbound and creates no documents in ECC.

What the EDI path still has to handle

IssueWhyWhere it is handled
Stock freshnessStock changes far more often than master data; change pointers on stock flood the queueA separate, more frequent stock run, or an RFC read on a timer, writing only availability
DeletionsA material flagged for deletion (LVORM) or a deleted condition (LOEVM_KO) must take the offer down, not leave itThe converter treats them as out-of-stock or deletes the product input; never ignore the flag
Several sales organisationsOne MATMAS, several COND_A records for different VKORGsOne product input per feedLabel, priced from that market’s condition
Prior price (EU)Omnibus needs the lowest price of the last 30 days per marketPrice history in Xano, built from each COND_A received
Partner profile driftSomeone adds a message type to the partner profile in WE20The Worker’s allow-list on MESTYP, not the partner profile, decides what is accepted

In one line

ECC keeps speaking IDoc; a Worker translates MATMAS and COND_A into Merchant API calls through the same Rust converter, refuses everything else, and nothing about a person or an order goes to Google from ECC’s side.