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 type | Carries | ECC tables | Goes to Google? |
|---|---|---|---|
MATMAS | Material master: identity, text, units, weights, plants, storage locations | MARA, MAKT, MARM | Yes: becomes the product input |
COND_A | Condition records: list price, sale price, validity dates | A004, KONP | Yes: price, salePrice, salePriceEffectiveDate |
| Stock (no single standard type) | Unrestricted stock by plant and storage location | MARD | Yes: 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 |
DEBMAS | Customer master: name, address, e-mail, opt-in flags | KNA1, ADR6, KNVV | Never directly. Personal data goes through the release gate or nowhere |
ORDERS, ORDRSP, DELVRY (DESADV), INVOIC | Orders, confirmations, deliveries, invoices | VBAK, VBAP | No. 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.
| Segment | Fields used | Table | Merchant API v1 |
|---|---|---|---|
MATMAS E1MARAM | MATNR, EAN11, NUMTP, MFRPN, NTGEW, BRGEW, GEWEI, PRDHA, SATNR | MARA | offerId, gtins[], mpn, weights, productTypes[], itemGroupId |
MATMAS E1MAKTM | SPRAS, MAKTX | MAKT | title (one product input per contentLanguage) |
MATMAS E1MARMM | MEINH, EAN11, LAENG, BREIT, HOEHE, MEABM | MARM | base-unit GTIN, shippingLength / Width / Height |
COND_A E1KOMG | KSCHL, VKORG, VTWEG, MATNR | A004 key | which offer and market the price applies to |
COND_A E1KONH | DATAB, DATBI | A004 validity | salePriceEffectiveDate |
COND_A E1KONP | KBETR, KPEIN, KONWA, LOEVM_KO | KONP | price / 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.
MATNRarrives in the IDoc with internal leading zeros (000000000000012345). The converter’sdisplay_matnrstrips them for numeric numbers. A translator that skips that step creates a second offer for the same material. - Decimals.
KBETRinE1KONPis 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:
- Idempotency on
DOCNUM. The same IDoc number twice is a no-op in Xano. versionNumberon every insert. Google refuses an insert whose number is lower than the stored one. Use the change document time (CDHDRUDATE+UTIME) when the extract carries it, as on the Merchant page. An IDoc usually doesn’t, so the fallback is the control record’sCREDAT+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 insert | Scheduled file | |
|---|---|---|
| Freshness | Per product, as each IDoc lands | Per file: nothing changes until the next fetch |
| Older data overwriting newer | Refused by versionNumber | A stale file replaces the data source’s contents |
| Errors | Per call, tied to the IDoc that caused them | Per fetch, read from Merchant Center diagnostics |
| Credentials | OAuth service account; short-lived token | SFTP 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
| Issue | Why | Where it is handled |
|---|---|---|
| Stock freshness | Stock changes far more often than master data; change pointers on stock flood the queue | A separate, more frequent stock run, or an RFC read on a timer, writing only availability |
| Deletions | A material flagged for deletion (LVORM) or a deleted condition (LOEVM_KO) must take the offer down, not leave it | The converter treats them as out-of-stock or deletes the product input; never ignore the flag |
| Several sales organisations | One MATMAS, several COND_A records for different VKORGs | One product input per feedLabel, priced from that market’s condition |
| Prior price (EU) | Omnibus needs the lowest price of the last 30 days per market | Price history in Xano, built from each COND_A received |
| Partner profile drift | Someone adds a message type to the partner profile in WE20 | The 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.