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

ECC Names and Types in Rust

This book lists SAP ECC tables as Rust types: every ABAP field, the Rust name it becomes, the Rust type that holds it, and the generated struct. It is built from the ABAP Dictionary itself (a DD02T and DD03L export), so a new table is a new row in the export, not a new chapter to write.

DD03L export ─▶ 11ty + lib/naming.js ─▶ site/ddic.json ─▶ src/codegen.rs ─┬─▶ Rust structs (build.rs)
                                                                          └─▶ this book (cargo run --bin book)

The same code writes the structs and these pages, and tests/book.rs fails if the book and the compiled code disagree.

  • What is ABAP?: SAP’s language and its Dictionary, the ABAP types, and the three parsers: DDIC (11ty), Rust (Serde) and the XanoScript generator.
  • Naming: how /ACME/GPC becomes acme_gpc, and every name in this book that needed more than lower-casing.
  • Types: how DATS, NUMC, CURR and the "X" flag become Rust types.
  • Google Merchant Center: which ECC fields feed which product attribute, with machine data (identifiers, amounts, units, dates, stock) highlighted in pink and a worked example.
  • GraphQL: Product and User: a Product shaped like the Merchant API v1 product input (attributes per Google’s product data specification) and a separate User with the customer’s personal data and consent ledger. Every field says where it comes from.
  • Rust structs and GraphQL types: each Product and User field as GraphQL type, converted Rust struct, Merchant API struct and ECC source.
  • Consent gaps, CRM Sync gap fill and Plan: Xano buildout: what ECC can’t say about consent, what Shopify, Google and CRM Sync fill in, the Xano ledger that holds it, and the plan for generating the Xano tables and CSV uploads from this book’s map.
  • ECC direct to Google: what it replaces: why converting ECC straight to Merchant Center takes S/4HANA off the path to Google but replaces neither the upgrade nor the consent layer.
  • An alternative to a full S/4HANA upgrade: a diagram of what moves from ECC to Xano and Cloudflare, what it replaces in S/4HANA and Salesforce, the benefits, and the routes compared.
  • Data layer compared: ECC, Xano, Shopify and Google Cloud against Databricks, Snowflake and Fabric, and how one typed Serde record reaches any destination.
  • ERP programmes in public: Revlon, Nike, Coty, Diageo, AB InBev and Honda: what happened, the reported penalty and the lesson for this layer, plus the next escalation: Shopify’s GraphQL and token changes, and agentic commerce.
  • One page per table, grouped by namespace, with its key, fields, generated struct and a sample record where there is one.
  • Field index: every ABAP field A to Z, with the tables it appears in.

Using a type

use abap_to_rust::sap::Kna1;

let c: Kna1 = serde_json::from_str(r#"{"MANDT":"100","KUNNR":"0000012345","ZZ_MKT_OPTIN":"X"}"#)?;
assert!(c.zz_mkt_optin);                 // "X" -> true
assert_eq!(c.kunnr, "0000012345");       // leading zeros kept
let back = serde_json::to_string(&c)?;   // ABAP names again

Scope

The tables and fields here are illustrative subsets of standard ECC tables, plus a made-up /ACME/ customer namespace. Field lists come from fixtures/dd03l.csv, not from a live system. Export DD03L from your own system to get your fields, your appends and your Z tables.

What is ABAP?

ABAP (Advanced Business Application Programming) is SAP’s own programming language. SAP ECC is largely written in it, and so are the custom reports, interfaces and add-ons companies build on top of SAP. ABAP also defines how ECC stores its data, and that part is what this book reads.

Four terms

TermWhat it isIn this book
Rust structA named Rust type with a fixed set of typed fields. The compiler checks every use, so a field can’t be missing, misspelled or the wrong type.One struct per SAP table, generated from the Dictionary: sap::Kna1 has kunnr: String, erdat: Option<NaiveDate>, loevm: bool. Plus hand-written structs for what Google receives: merchant::Product, merchant_api::ProductInput.
DictionaryIn SAP, the ABAP Dictionary (DDIC): the metadata that describes every table, field, data element and type. Not to be confused with a Rust or Python “dictionary” (a key-value map, HashMap in Rust), or a JSON object.The DDIC export (DD02T, DD03L) is the input. Every struct, GraphQL type, Xano table and page is generated from it.
JSON formatterCode that turns a typed value into JSON text and back. In Rust that is Serde: #[derive(Serialize, Deserialize)] on a struct, serde_json for the JSON itself, and attributes or helper modules for any field whose JSON form differs from its Rust form.Two directions. ABAP format for ECC records: #[serde(rename = "KUNNR")] keeps SAP’s field names, and src/abap.rs formats flags as "X" / "" and dates as YYYYMMDD. Google format for the Merchant API: #[serde(rename_all = "camelCase")] writes offerId, skip_serializing_if leaves out empty fields, and prices are written as micros strings ("129000000").
Beautiful SoupA Python library that parses HTML or XML into a tree you can search by tag, class or attribute. It reads markup as it is, including imperfect markup, and writes nothing back to the source.Not used in this repo. It is the design-side counterpart of the DDIC parser: in the front-end pipeline (Webflow export → Beautiful Soup → component map → 11ty), it reads a Webflow export’s classes, data-* attributes and CMS rows into a JSON component map, as step 1 here reads DD03L into site/ddic.json. Its output is a Python dictionary (a key-value map) written out as JSON.

The same KNA1 customer in each form:

FormExample
Dictionary (DD03L row)KNA1,ERDAT,10,,ERDAT_RF,DATS,8,0,Created On
ECC record (JSON, ABAP format){"KUNNR": "0000012345", "ERDAT": "20240115", "LOEVM": ""}
Rust structKna1 { kunnr: "0000012345", erdat: Some(2024-01-15), loevm: false, … }

And a Webflow product card, read by Beautiful Soup:

FormExample
Webflow export (HTML)<div class="product-card" data-sku="HM-QUEEN-01"><h3 class="product-title">Heated mat, queen</h3></div>
Beautiful Soup (Python)card = soup.select_one(".product-card") → {"component": "product-card", "sku": card["data-sku"], "title": card.h3.get_text()}
Component map (JSON){"component": "product-card", "sku": "HM-QUEEN-01", "title": "Heated mat, queen"}

The design side and the ERP side meet on the identifier: the card’s data-sku is the material’s offerId (MARA-MATNR), so the page renders the converted record instead of a copy typed into the design.

And the same price, formatted for each side:

FormExample
ECC condition record (KONP-KBETR, KONP-KONWA)129.00, USD
Rust (merchant::Money)Money { amount: 129.00 (Decimal), currency: "USD", decimals: 2 }
Merchant API JSON (merchant_api::Price){"amountMicros": "129000000", "currencyCode": "USD"}

The ABAP Dictionary

Every table and field in ECC is described in the ABAP Dictionary (DDIC). Two of its own tables are the input to this book:

DDIC tableWhat it listsExample row
DD02TEach table and its descriptionKNA1: General Data in Customer Master
DD03LEach table’s fields: position, key flag, data element, ABAP type, length, decimalsKNA1-KUNNR: key, CHAR 10, Customer Number

Names carry ownership. SAP’s own tables have plain names (KNA1, MARA). A company’s additions start with Z or Y (ZZ_MKT_OPTIN, a custom field appended to KNA1), or sit in a registered namespace between slashes (/ACME/CONSENT). Naming shows how each becomes a Rust name.

ABAP types

ABAP typeWhat it holdsExampleRust type
CHARFixed-length text, padded with blanksNAME1 = Example Retail Inc.String
NUMCDigits stored as text; the leading zeros are part of the valueKUNNR = 0000012345String
CHAR 1 flagX is true, blank is falseLOEVM = X (deleted)bool
DATSA date as YYYYMMDD; 00000000 means noneERDAT = 20240115Option<NaiveDate>
TIMSA time as HHMMSSUTIME = 021500Option<NaiveTime>
CURR, QUAN, DECPacked decimals; a currency amount takes its decimals from the CUKY field it points toKBETR = 129.00Decimal
CLNT, LANG, CUKY, UNITClient, language key, currency key, unitSPRAS = EString
INT1 to INT8IntegersSEQNO = 1u8 to i64

ABAP has no null. An empty field holds its initial value: blanks, zero or 00000000. So the converter maps an initial value to None only where it means “not set” (a date), and keeps it as a value where it is one (a zero quantity). The full rule table is on Types.

The parsers

Three steps turn a DDIC export into Rust, JSON for Google and XanoScript for Xano. Each fails loudly on what it can’t translate, naming the field, rather than guessing.

DD02T + DD03L export (CSV)
   │
   ▼  1. DDIC parser: 11ty (web/_data/ddic.js + lib/naming.js)
site/ddic.json  ── tables, fields, Rust names, Rust types, Merchant map, consent map
   │
   ├─▶ 2a. Rust code generator: build.rs + src/codegen.rs ─▶ structs (sap::Kna1, acme::Consent …), schema.graphql, this book
   │
   ├─▶ 2b. Rust record parsers: Serde + src/abap.rs ─▶ an ECC record (JSON from RFC, IDoc or SE16) into those structs
   │
   └─▶ 3.  XanoScript generator: src/xano.rs ─▶ xano/tables/*.xs table definitions + CSV uploads

1. The DDIC parser (11ty)

web/_data/ddic.js reads fixtures/dd02t.csv and fixtures/dd03l.csv (as from SE16 or an RFC_READ_TABLE dump). lib/naming.js decides each name once: it splits a namespace (/ACME/CONSENT → namespace acme, struct Consent), makes field names valid in Rust (/ACME/GPC → acme_gpc), and picks the Rust type from the type rules. A DDIC type with no rule stops the build and names the field. The output is site/ddic.json; lib/naming.test.js tests the rules.

2a. The Rust code generator

build.rs reads site/ddic.json with Serde and writes one struct per table. Each field keeps its ABAP name for reading and writing, and says how to parse it:

/// `KUNNR` CHAR 10 (key): Customer Number
#[serde(rename = "KUNNR")]
pub kunnr: String,
/// `ERDAT` DATS 8: Created On
#[serde(rename = "ERDAT", default, with = "crate::abap::dats")]
pub erdat: Option<chrono::NaiveDate>,
/// `LOEVM` CHAR 1: Central Deletion Flag
#[serde(rename = "LOEVM", default, with = "crate::abap::xflag")]
pub loevm: bool,

Key fields are required; every other field defaults to ABAP’s initial value when it is missing. The same generator writes schema.graphql and these pages, and tests/book.rs fails if the book and the compiled code disagree.

2b. The Rust record parsers

src/abap.rs holds the Serde helpers for ABAP’s internal formats. They parse and write back, and refuse anything that isn’t a valid ABAP value:

HelperReadsWrites backRefuses
abap::xflag"X" → true; "" or " " → false"X" or ""Any other text, e.g. "Y"
abap::dats"20240115" → 2024-01-15; "00000000" or "" → NoneYYYYMMDD; None → "00000000"An impossible date
abap::tims"021500" → 02:15:00; "" → NoneHHMMSSAn impossible time
abap::timestamp20261103021500 (number or string, UTC) → a date-time; 0 → NoneThe same 14 digitsA malformed stamp

So the KNA1 record {"KUNNR":"0000012345","ERDAT":"20240115","LOEVM":"",…} parses into a sap::Kna1 with kunnr = "0000012345", erdat = Some(2024-01-15) and loevm = false, and writes back unchanged. tests/convert.rs checks that round trip, VBAK’s amount and time, the consent ledger’s newest row, and that missing keys and bad values are refused.

3. The XanoScript generator

XanoScript is Xano’s own language for tables, functions and endpoints. src/xano.rs writes one table definition per Xano table from the same map, and cargo run --bin xano-buildout writes them to xano/tables/*.xs with the CSV uploads:

table "merchant_product" {
  description = "Google Merchant Center products in the Merchant API v1 shape, flattened. No personal data."
  auth = false
  schema {
    int id { description = "Row ID" }
    text idempotency_key filters=trim { description = "SHA-256 of the row's source, subject and value: a replayed import writes nothing" }
    text offer_id filters=trim { description = "id (machine; MARA-MATNR)" }
    …
  }
  index = [ {type: "primary", field: [{name: "id"}]}, {type: "btree|unique", field: [{name: "idempotency_key", op: "asc"}]} … ]
}

The rules it applies:

  • Optional means nullable. ? on the type makes a column nullable and ? on the name makes it optional; an optional column here is always both, so a missing price is null, never 0.
  • Every row has an idempotency key, unique-indexed, so a replayed import writes nothing twice.
  • Personal columns are marked sensitive.
  • It generates, it doesn’t apply. The .xs files are written to the repo; changes to a live workspace are applied one confirmed step at a time, as in Plan: Xano buildout.

The XanoScript side generates Xano’s language rather than parsing it. The parsing happens on the ABAP side: the DDIC in step 1 and the records in step 2b.

Where it runs: the full stack

The parsers on this page are one layer of a larger stack. Design and ERP data enter on two sides, meet on the same identifiers, and land in one system of record.

 Design side                               ERP side
 Webflow (designers)                       SAP ECC: DD02T / DD03L + records (RFC, IDoc, SE16)
   │ export: HTML, CSS, CMS CSV              │
   ▼                                         ▼
 Python + Beautiful Soup                   11ty DDIC parser ─▶ site/ddic.json
   │ component map (JSON)                    │
   ▼                                         ▼
 11ty: HTML from the component map         Rust: structs, Serde record parsers, Merchant API JSON, XanoScript
   │                                         │
   └──────────────┬──────────────────────────┘
                  ▼
 Cloudflare: Workers + static assets serve the pages (petite-vue, UIkit, no compile step),
             carry consent at the edge, and run AI calls after the release gate
                  │
                  ▼
 Xano: the system of record ─ each instance in its own Docker container on Kubernetes, data in PostgreSQL
                  │
                  ▼
 Google (Merchant, Ads, BigQuery) · Shopify · other warehouses, through the release gate
LayerToolsJobStatus here
DesignWebflowDesigners keep designing; classes and CMS fields are the contractOutside this repo
Design parserPython, Beautiful SoupWebflow export → JSON component mapOutside this repo
ERP parser11ty, lib/naming.jsDD03L export → site/ddic.jsonBuilt
Typed coreRust, SerdeStructs, record parsing, Google’s JSON, XanoScriptBuilt: runs as cargo commands
Rust nested in other layersRust as a Python extension (PyO3), as WebAssembly in a Worker, or inside a Tauri / Dioxus appThe same conversion rules wherever the data is handledProposed
Edge and AICloudflare Workers, static assetsServe the pages, enforce consent before any tag, run AI calls behind the release gateThe CRM Sync Worker is live; the book is a static-assets Worker
System of recordXano on Docker and Kubernetes, PostgreSQLOne record for products, customers, consent and the ledgerLive; tables generated from this book
DestinationsGoogle Merchant, Google Ads, BigQuery, ShopifyListings, conversions, audiences, analyticsThrough the release gate; the Merchant sender is planned

Why PostgreSQL underneath matters. The record lives in PostgreSQL tables, not in a proprietary store, so its shape is ordinary relational data: tables export as CSV and back up with the workspace. How directly the database itself can be reached depends on the Xano plan. The rules (types, names, consent) live in this repo’s code, not in the database, so they move with it.

Xano’s description of its own platform: Xano technology, Xano, the scalable visual BaaS.

BigQuery is a destination in the stack above, not a system of record. Google’s BigQuery Data Transfer Service can extend the ECC data with commerce and media data, but each transfer brings consent gaps of its own, on top of the ECC consent gaps. Two transfers are covered here:

What each source is keyed by

SourceKeyGrainConsent it carries
ECC (CSV or IDoc extract)KUNNR, MATNR, VBELN (leading zeros)Header / item rows, delta batchesNone (see Consent gaps)
Shopify transferGIDs (gid://shopify/Customer/…)Nested objects landed as separate tablesEmail and SMS marketing on Customers; no browser tracking consent
YouTube Channel transferchannel_id, video_id, dateAggregates by country, age group, gender, subscribed status, traffic sourceNone needed: no viewer is identified

None of the three shares a key with another. The crosswalk (KUNNR ↔ Shopify GID ↔ consent subject, MATNR ↔ product GID ↔ video_id) belongs in Xano, next to the consent ledger, not in BigQuery.

A media segment built from YouTube data is a cohort, for example GB · 18–24 · subscribed · from YouTube search · watched video X. It is never a list of people: the channel reports have no viewer-level IDs. Consent therefore governs the other side of the join, the customer data a segment is matched or activated against.

GapWhere it shows upWhat’s missingClosest existing gap
Customer data lands without a consent filterShopify Customers, Orders, Segments, Metafields_Customer are copied on every run; the page states no PII handlingA filter or pseudonymisation at ingest, keyed to the consent ledgerPurpose
Two consents that never meetShopify carries email / SMS marketing; browser tracking consent (Customer Privacy API, Consent Mode v2) never reaches the Admin APIA join of both to one subject in the ledgerBefore there is a customer
Email consent is not ads consentA Shopify email opt-in is not ad_user_data or ad_personalizationA check of both ad signals before any Customer Match upload beside a YouTube segmentAudiences
Erasure doesn’t follow the copyNothing says a Shopify customers/redact reaches BigQuery; snapshots kept for history keep the personA purge job triggered by the redact webhooks, with a receiptData subject requests
Minors in the audienceYouTube age groups include 13–1713–17 excluded from every activation segment; reporting onlyMinor status
Region and residencyThe Shopify page states no data location; YouTube rows carry the viewer’s country, not the regimeThe dataset location chosen per regime (EU / UK data in an EU dataset; KR held until a KR-resident store exists)Region
Thresholded rowsSmall cohorts come back as country ZZ, province US-ZZ, or NULL age group, gender and traffic detailZZ / NULL kept as an explicit unknown cohort, not dropped(new)
Time that doesn’t line upYouTube days run midnight to midnight Pacific; Shopify uses the shop’s time zone; ECC uses server local timeEvery source converted to UTC before a date joinTime
Retention and backfillYouTube reports are kept 60 days; a backfill arrives as a new report ID for the same periodSnapshots in BigQuery, replaced (not appended) on backfill, with an expiry per purposeRetention

Why the gaps skew the weighting

Segments and the models built on them (bidding, recommendations, LLM retrieval) inherit the gaps:

  • Opt-in rates differ by market. YouTube aggregates count everyone who watched; the Shopify and GA4 side counts only consented shoppers. Comparing the two overstates the YouTube-to-purchase effect where opt-in is low (EU, UK).
  • Percentages are not counts. channel_demographics_a1 has only views_percentage; weight it by views from channel_basic_a3 for the same date, video and country, or a video with ten views counts as much as one with a million.
  • Demographics don’t cross. Age and gender can’t be split by traffic source or device: they are separate reports. A segment that combines them is a model, and should be labelled one.
  • The largest store dominates. One transfer per shop means a union of stores; without balancing by market, the biggest market sets the weights.
  • No product key on media. The channel reports have no SKU, so the video_id ↔ MATNR link is one more row in the Xano crosswalk.

API reference naming: Shopify and YouTube

Each source names things its own way. The Rust names follow the same rules as Naming: one module per source, UpperCamelCase structs, snake_case fields, the source’s name kept on the wire with #[serde(rename …)]. These structs are proposed; the generator covers ECC only today.

SourceSource nameBigQuery nameRust (proposed)Rule
Shopify Admin GraphQLObject Order, fields displayFinancialStatus, totalPriceSetTransfer object Ordersshopify::Order, display_financial_status#[serde(rename_all = "camelCase")] keeps GraphQL’s names on the wire
ShopifyMetafields_ProductMetafields_Productshopify::MetafieldsProductThe underscore joins owner and type; drop it in the struct name
ShopifyID gid://shopify/Order/5012345StringShopifyGid (newtype)Keep the full GID; parse the numeric tail only for joins
YouTube ChannelReport channel_basic_a3Table p_channel_basic_a3_<suffix>, view channel_basic_a3_<suffix>youtube::ChannelBasicA3p_ is the table, no prefix is the view; <suffix> is set when the transfer is created
YouTube Content OwnerReport content_owner_basic_a4p_content_owner_basic_a4_<suffix>youtube::ContentOwnerBasicA4Same pattern, content_owner_ in front
YouTube (both)Version _a1 … _a4Part of the namePart of the struct nameA new version is a new table: pin queries to views, and treat a version change as a schema change

Names to check in your own dataset, because Google’s Content Owner page lists them irregularly: the province view as content_owner_province_3_<suffix> (no a), the playlist playback-location view and the playlist traffic-source table without <suffix>.

What a Content Owner transfer adds. A channel transfer covers the brand’s own channels. A Content Owner (a YouTube partner managing many channels) also gets assets, claims, references, video metadata and the money: content_owner_estimated_revenue_a1 (estimated_partner_revenue, ad_impressions, estimated_cpm, by video_id, claimed_status, uploader_type, country_code), content_owner_ad_rates_a1, and system-managed ad, subscription (red), Shorts, payment and tax tables. Revenue is creator-side income, not shopper data, but it is finance data: it belongs next to the ledger, under the same retention rules.

One meaning, four names. The fields that join sources rarely share a name or a format:

MeaningECCShopifyYouTubeGA4 export
CountryLAND1 (SAP country key)countryCode (enum)country_code (ISO 3166-1, ZZ when thresholded)geo.country (a country name)
RegionREGIOprovinceCodeprovince_code (US- states only)geo.region (a name)
ProductMATNRVariant sku, product GIDnone (map video_id in Xano)items.item_id
OrderVBELN; Shopify order often in BSTNKOrder GID, name (#1001)noneecommerce.transaction_id
DayDATS, server local timeDateTime (UTC)Pacific dayevent_date in the property’s time zone
MoneyKBETR + KONWAshopMoney / presentmentMoneyestimated_*_revenueecommerce.purchase_revenue

Normalise once, in the Rust core: ISO 3166-1 / 3166-2 codes, UTC timestamps, ISO 4217 currency with an amount type, and one product key from the Xano crosswalk.

The funnel crosses from cohorts to people at one point: the click to the site. Above it, everything is aggregate; below it, a person can be followed only with consent.

#StageSource and fieldKey carried forwardGrainNeeded to record it per person
1ImpressionYouTube channel_reach_basic_a1.video_thumbnail_impressionsvideo_idCohortNothing: no person is recorded
2Viewchannel_basic_a3.views, engaged_views, by subscribed_status, country_codevideo_id, country_codeCohortNothing
3Click to siteLink with utm_source=youtube&utm_content=<video_id>; GA4 session_startvideo_id → sessionThe bridgeanalytics_storage granted; otherwise only a modelled conversion
4Product viewGA4 view_item, items.item_idMATNR / SKUPerson (session)analytics_storage
5Add to cart, checkoutGA4 add_to_cart, begin_checkoutSKU, sessionPersonanalytics_storage. The Shopify transfer has no cart or abandoned-checkout object, so these stages come from GA4 only
6OrderShopify Orders, OrderLineItems; GA4 purchaseOrder GID = transaction_idPersonThe order itself needs no consent (it is the contract); joining it to the session needs analytics_storage
7ERP orderECC VBAK / VBAPVBELN, Shopify order in BSTNKPersonNone, but the shopper’s consent still governs any use beyond fulfilment
8Fulfilment, return, refundShopify Fulfillments, Returns, Refunds; ECC deliveries and billingOrder, VBELNPersonNone for the transaction; the purpose limit carries over
9Re-engageGoogle Ads Customer Match beside a YouTube segmentHashed emailPersonad_user_data and ad_personalization, checked by the release gate; never email consent alone

Where the funnel breaks: if stage 3 has no consent, stages 4 to 9 can still be counted (orders are real), but not tied to the video. The YouTube-to-revenue figure is then modelled for that share, and the model should say so per market.

Globalised data governance: requirements per session and per segment

The same pages and segments serve several regimes, so the rules are decided twice: once per session, at the edge, before anything loads; and once per segment, before anything leaves BigQuery or Xano. These are the requirements the stack enforces; the legal reading of each market is for counsel to confirm.

Per session (the Cloudflare Worker, on the first request):

RequirementUS (state privacy laws)EU (GDPR, ePrivacy, DMA)UK (UK GDPR, PECR)KR (PIPA)
Default before a choiceAnalytics on; sale / share and targeted ads off if GPC is sentEverything off until opt-inEverything off until opt-inEverything off until opt-in
Tags before the banner is answeredNecessary only where GPC is sentNecessary onlyNecessary onlyNecessary only
Signals recordedGPC, sale / share opt-outanalytics_storage, ad_storage, ad_user_data, ad_personalizationSame fourSeparate consents per purpose, plus overseas transfer
Region and regimeISO 3166-2 at decision time (state matters)ISO 3166-2 at decision timeISO 3166-2 at decision timeISO 3166-2 at decision time
Where the session’s data is storedUSEUUK or EUHeld until a KR-resident store exists
Child age thresholdUnder 13 (COPPA)13 to 16, by member stateUnder 13Under 14 needs a guardian’s consent
Ledger entryAppend-only, UTC, sequence number, banner versionSameSameSame

Per segment (the release gate, before any export or activation):

RequirementRule
PurposeEach segment is labelled reporting or activation; only activation may leave for Google Ads, and only through the release gate
Minimum cohort sizeKeep YouTube’s thresholding (ZZ / NULL stay unknown) and add your own floor on segments built from your data; no segment below it is exported
Minors13–17 YouTube cohorts are reporting-only; any person under the regime’s child threshold is never in an activation segment
Consent per memberEvery person in an activation segment has ad_user_data and ad_personalization granted at export time, read live from the ledger, not from a cached copy
ResidencyThe segment is built and stored in the dataset of its regime; EU / UK people are not copied to a US dataset to be joined
Cross-border transferEU / UK to US needs a lawful transfer basis; KR to anywhere needs the shopper’s separate overseas-transfer consent
Mixed-regime segmentsA segment spanning regimes takes the strictest rule of any member’s regime, or is split by regime
Withdrawal and erasureA withdrawal or a customers/redact removes the person from every segment before the next export; the export records which version it used
RetentionEach segment has an expiry per purpose; YouTube snapshots are kept only as long as reporting needs them
ReceiptEvery export writes a receipt (segment, version, count, regime, gate decision) to the ledger, so any audience upload can be traced back

The yt_segment view

bigquery/yt_segment.sql applies the per-segment rules above to the YouTube Channel transfer. It is a draft: written against the documented report fields and not yet run against a live dataset (the checks to make first are in its header).

StepWhat it doesRule it applies
Read the viewschannel_basic_a3 and channel_demographics_a1, not the p_ tablesA backfill or version change is absorbed by the view
Normalise the mixShares of views_percentage within each date, video, country, subscribed and live / on-demand row, summing to 1Percentages are not counts
Weight by viewsEach share × views (and engaged views, watch time, subscribers gained) → est_* columnsA video with ten views doesn’t count as much as one with a million
Keep the unknownsZZ country and NULL age / gender become an explicit unknown cohort; a row with no demographics keeps all its views as oneThresholded rows are kept, not dropped
Convert the dayday_start_utc / day_end_utc from the Pacific (UTC-8) YouTube dayEvery source in UTC before a date join
Label the regimeUS, UK, EU / EEA, KR, unknown or other, from country_codeRules come from the viewer’s regime
Label the purposereporting_only for 13–17, unknown age or country, KR (on hold) and cohorts below the floor; otherwise activation_candidateMinors are never activated; activation still passes the release gate
Key the segmentsegment_key, a SHA-256 of the cohort’s dimensionsEvery export receipt can name the segment it used

Channel-level rows carry an empty video_id. The view keeps join keys as '' and turns them into NULL only in its output: a join on NULL matches nothing, and those rows would lose their demographics.

-- yt_segment: YouTube Channel cohorts, weighted by views, with governance flags.
--
-- Book: What is ABAP? → Extending the data → Segment consent gaps / Governance per segment.
-- Sources (YouTube Channel transfer, views not p_ tables, so a backfill or version change is absorbed by the view):
--   channel_basic_a3_SUFFIX         date, channel_id, video_id, live_or_on_demand, subscribed_status, country_code
--                                   + views, engaged_views, watch_time_minutes, subscribers_gained
--   channel_demographics_a1_SUFFIX  same dimensions + age_group, gender → views_percentage only
--
-- What this view is: aggregate cohorts. There are no viewer IDs in the source, so nothing here is personal data and
-- consent is not checked here. Consent applies when a segment is matched or activated against customer data, in the
-- release gate (Xano), never in BigQuery.
--
-- Rules applied (book: Governance per segment):
--   * views_percentage is weighted by views from channel_basic for the same row grain, never used raw
--   * thresholded rows (country ZZ, NULL age_group / gender) stay as an explicit 'unknown' cohort
--   * AGE_13_17 is reporting-only, always
--   * cohorts below the floor are reporting-only
--   * the YouTube day is midnight to midnight Pacific Standard Time (UTC-8, fixed), converted to UTC here
--
-- Replace before creating: PROJECT, DATASET, SUFFIX (the table suffix set on the transfer).
-- The dataset must be in the same location as the commerce data it will be joined to (EU / UK data → EU dataset).
--
--   sed -e 's/PROJECT/my-project/g' -e 's/DATASET/youtube_eu/g' -e 's/SUFFIX/brand/g' bigquery/yt_segment.sql \
--     | bq query --use_legacy_sql=false
--
-- To check on a real dataset before relying on it (not verified: no dataset was available when this was written):
--   1. The type of `date` (STRING 'YYYYMMDD' or DATE): handled both ways below, confirm with INFORMATION_SCHEMA.
--   2. Whether the transfer's views already keep only the latest report per day after a backfill. If they don't,
--      deduplicate on the full dimension set, keeping the most recent load.
--   3. The age_group / gender values (expected AGE_13_17 … AGE_65_, FEMALE / MALE / GENDER_OTHER).

CREATE OR REPLACE VIEW `PROJECT.DATASET.yt_segment`
OPTIONS (
  description = 'YouTube Channel cohorts weighted by views. Aggregate only: no viewer IDs. Activation only through the Xano release gate.'
) AS

WITH params AS (
  SELECT
    50  AS min_cohort_views,   -- own floor on top of YouTube's thresholding; tune per market
    ['AT','BE','BG','HR','CY','CZ','DK','EE','FI','FR','DE','GR','HU','IE','IT','LV','LT','LU','MT','NL',
     'PL','PT','RO','SK','SI','ES','SE','IS','LI','NO'] AS eea_countries
),

basic AS (
  SELECT
    COALESCE(SAFE.PARSE_DATE('%Y%m%d', CAST(date AS STRING)), SAFE_CAST(CAST(date AS STRING) AS DATE)) AS yt_date,
    channel_id,
    IFNULL(video_id, '')                    AS video_id,        -- '' = channel-level row; join keys stay non-NULL
    IFNULL(live_or_on_demand, '')           AS live_or_on_demand,
    IFNULL(subscribed_status, '')           AS subscribed_status,
    COALESCE(NULLIF(country_code, ''), 'ZZ') AS country_code,
    SUM(views)              AS views,
    SUM(engaged_views)      AS engaged_views,
    SUM(watch_time_minutes) AS watch_time_minutes,
    SUM(subscribers_gained) AS subscribers_gained
  FROM `PROJECT.DATASET.channel_basic_a3_SUFFIX`
  GROUP BY 1, 2, 3, 4, 5, 6
),

demo AS (
  SELECT
    COALESCE(SAFE.PARSE_DATE('%Y%m%d', CAST(date AS STRING)), SAFE_CAST(CAST(date AS STRING) AS DATE)) AS yt_date,
    channel_id,
    IFNULL(video_id, '')                    AS video_id,
    IFNULL(live_or_on_demand, '')           AS live_or_on_demand,
    IFNULL(subscribed_status, '')           AS subscribed_status,
    COALESCE(NULLIF(country_code, ''), 'ZZ') AS country_code,
    COALESCE(age_group, 'unknown')          AS age_group,       -- NULL = thresholded
    COALESCE(gender, 'unknown')             AS gender,
    SUM(views_percentage)                   AS views_percentage
  FROM `PROJECT.DATASET.channel_demographics_a1_SUFFIX`
  GROUP BY 1, 2, 3, 4, 5, 6, 7, 8
),

-- Normalise the mix within each row grain, so the shares sum to 1 whether views_percentage is 0–1 or 0–100.
demo_share AS (
  SELECT
    *,
    SAFE_DIVIDE(
      views_percentage,
      SUM(views_percentage) OVER (
        PARTITION BY yt_date, channel_id, video_id, live_or_on_demand, subscribed_status, country_code)
    ) AS share
  FROM demo
),

-- Every basic row gets a mix; a row with no demographics at all becomes one 'unknown' cohort with share 1.
weighted AS (
  SELECT
    b.yt_date,
    b.channel_id,
    b.video_id,
    b.live_or_on_demand,
    b.subscribed_status,
    b.country_code,
    COALESCE(d.age_group, 'unknown') AS age_group,
    COALESCE(d.gender, 'unknown')    AS gender,
    COALESCE(d.share, 1)             AS share,
    d.share IS NULL                  AS demographics_missing,
    b.views                * COALESCE(d.share, 1) AS est_views,
    b.engaged_views        * COALESCE(d.share, 1) AS est_engaged_views,
    b.watch_time_minutes   * COALESCE(d.share, 1) AS est_watch_time_minutes,  -- assumes watch time follows the view mix
    b.subscribers_gained   * COALESCE(d.share, 1) AS est_subscribers_gained,
    b.views                                       AS row_views
  FROM basic AS b
  LEFT JOIN demo_share AS d
    USING (yt_date, channel_id, video_id, live_or_on_demand, subscribed_status, country_code)
)

SELECT
  -- Segment identity
  TO_HEX(SHA256(CONCAT(
    channel_id, '|', IF(video_id = '', 'channel', video_id), '|', country_code, '|', age_group, '|', gender, '|',
    subscribed_status, '|', live_or_on_demand))) AS segment_key,
  w.yt_date,
  TIMESTAMP(DATETIME(w.yt_date), '-08:00')                            AS day_start_utc,  -- YouTube day, PST fixed
  TIMESTAMP(DATETIME(DATE_ADD(w.yt_date, INTERVAL 1 DAY)), '-08:00')  AS day_end_utc,
  w.channel_id,
  NULLIF(w.video_id, '') AS video_id,
  IF(w.video_id = '', 'channel', 'video') AS segment_level,
  w.country_code,
  w.age_group,
  w.gender,
  NULLIF(w.subscribed_status, '') AS subscribed_status,
  NULLIF(w.live_or_on_demand, '')  AS live_or_on_demand,

  -- Weighted metrics (estimates: demographics are a share, not a count)
  w.share,
  w.est_views,
  w.est_engaged_views,
  w.est_watch_time_minutes,
  w.est_subscribers_gained,
  w.row_views,

  -- Data quality
  w.country_code = 'ZZ'     AS country_thresholded,
  w.age_group = 'unknown'   AS demographics_thresholded,
  w.demographics_missing,

  -- Regime of the viewer's country (the regime the segment's activation rules come from)
  CASE
    WHEN w.country_code = 'US'                 THEN 'US'
    WHEN w.country_code = 'GB'                 THEN 'UK'
    WHEN w.country_code IN UNNEST(p.eea_countries) THEN 'EU'
    WHEN w.country_code = 'KR'                 THEN 'KR'
    WHEN w.country_code = 'ZZ'                 THEN 'unknown'
    ELSE 'other'
  END AS regime,

  -- Governance
  w.age_group = 'AGE_13_17' AS is_minor_cohort,
  CASE
    WHEN w.age_group = 'AGE_13_17'             THEN 'reporting_only:minor'
    WHEN w.age_group = 'unknown'               THEN 'reporting_only:unknown_age'
    WHEN w.country_code = 'ZZ'                 THEN 'reporting_only:unknown_country'
    WHEN w.country_code = 'KR'                 THEN 'reporting_only:kr_hold'   -- until a KR-resident store exists
    WHEN w.est_views < p.min_cohort_views      THEN 'reporting_only:below_floor'
    ELSE 'activation_candidate'                                                -- still needs the release gate
  END AS segment_purpose

FROM weighted AS w
CROSS JOIN params AS p;

The rule is the same as for ECC: BigQuery reads consent, it never decides it. Every segment export to Google Ads passes through the release gate in Xano, as every other destination in the stack does.

Why 11ty, and when Astro

Astro would work. 11ty is used because it is the simpler tool for what this book asks of it, and because the portability that matters sits in the Rust core, not in the site generator.

Why 11ty here

  • It is a data parser as much as a site builder. web/_data/ddic.js reads the DD03L export and writes site/ddic.json through 11ty’s data step: plain JavaScript, no component model, no bundler.
  • It ships no JavaScript of its own. The output is HTML; islands are added afterwards, after consent, by the Worker or one tag.
  • Its templates are ones teams already know. 11ty can use Liquid, the language of Shopify themes, or Nunjucks.
  • It has few moving parts. No Vite and no framework runtime, which matters for a handoff team.

Where Astro is stronger

  • Built-in islands (client:load, client:visible) and components for React, Vue or Svelte when a page needs them.
  • Typed content collections with schemas, useful when the content model grows.
  • The trade-off for this design: Astro islands are built by Vite, so they belong to an Astro build. The islands on this page load into any platform’s theme without one.

Rust works everywhere. The rules live in the Rust core, so the site generator is replaceable: 11ty and Astro would both read site/ddic.json and render it, and swapping them changes nothing about how a price, a date or a consent decision is converted.

The Rust core compiles toRuns in
A native command-line toolcargo run today: structs, Merchant API JSON, XanoScript
WebAssemblyA Cloudflare Worker, or a browser island
A Python extension (PyO3)The design pipeline, beside Beautiful Soup
A desktop or mobile appTauri or Dioxus

One rule is not in Rust yet. Naming (/ACME/GPC → acme_gpc) is decided in lib/naming.js at the 11ty step, and the Rust build only checks it. Moving naming into the Rust core is what makes “Rust everywhere” complete: then 11ty, Astro or anything else only renders.

One repository, islands per requirement

For a client handoff, the whole stack fits in one repository, one package per layer. Each page then loads only the pieces its requirements need (“islands”), instead of one framework build for everything.

client-repo/
├── design/        Webflow export + the Beautiful Soup script → component map (JSON)
├── ddic/          DD02T / DD03L export + the 11ty DDIC parser → site/ddic.json
├── core/          The Rust crate: structs, Serde record parsers, Merchant API JSON, XanoScript
├── site/          11ty: pages from the component map, data from Xano
├── worker/        The Cloudflare Worker: serves the site, consent first, loads islands, calls Xano
├── xano/          Generated .xs table definitions and CSV uploads
└── package.json   One npm install; scripts with plain names: dev:site, build:core, deploy:worker

On the page, each requirement is its own island, loaded by the Worker only where that page needs it and only after consent allows it:

RequirementIslandLoaded on
Static contentNone: 11ty HTMLEvery page
A small interactive part (a product card’s variant picker)petite-vue (about 6 KB) on that element’s v-scopePages with that component
A server round trip without client state (filters, a form)HTMX, opt-inPages that use it
UI behaviour (modal, offcanvas, tabs)UIkit components (uk-*), the design system the petite-vue islands render into, themed per brandPages with those components
MotionGSAPPages that animate
Heavy compute in the browser (pricing preview, a converter)The Rust core compiled to WebAssemblyOnly that tool’s page
Analytics and ad tagsThe tag itselfOnly after the consent decision allows it

UIkit is the design system for the Vue islands. UIkit (uk-* classes and attributes) supplies the components and the brand theme; petite-vue, the Vue layer, supplies the state and the templates. They fit without glue: petite-vue renders uk-card, uk-modal or uk-navbar markup, and UIkit’s own DOM observer initialises each component as it appears. UIkit itself is framework-independent JavaScript, so the same components also work in a page with no Vue at all, or with HTMX.

BEM modifiers are plain vanilla code. BEM (Block, Element, Modifier) names every class by what it is: a block (card), an element inside it (card__title), and a modifier for a variant or state (card--featured). UIkit follows the same idea with its prefix and hyphens: block uk-card, elements uk-card-body and uk-card-title, modifiers uk-card-primary and uk-card-small. A modifier is only a class, so changing state needs no framework:

<div class="uk-card uk-card-default uk-card-body product-card" data-sku="HM-QUEEN-01">
  <h3 class="uk-card-title product-card__title">Heated mat, queen</h3>
  <p class="product-card__price">129.00 USD</p>
</div>
/* The site's own block, in BEM, beside UIkit's: no specificity fights, because each class names one thing. */
.product-card__price { font-variant-numeric: tabular-nums; }
.product-card--out-of-stock .product-card__price { text-decoration: line-through; }
// Vanilla: a modifier is a class toggle.
const card = document.querySelector('.product-card[data-sku="HM-QUEEN-01"]')
card.classList.toggle('product-card--out-of-stock', !inStock)
card.classList.toggle('uk-card-primary', featured)
<!-- The same modifiers from a petite-vue island: state in, class out. -->
<div v-scope="{ inStock: false, featured: true }"
     class="uk-card uk-card-body product-card"
     :class="{ 'product-card--out-of-stock': !inStock, 'uk-card-primary': featured, 'uk-card-default': !featured }">

The class names are the contract between design and code: Webflow designers set them, Beautiful Soup reads them into the component map, and the stock state that drives product-card--out-of-stock is availability from the converted ECC record.

No compile step, on any live theme

The islands are plain <script> and <link> tags that bind to classes and data-* attributes already in the page. So they reach a live theme without rebuilding it, and they enhance progressively: the theme’s HTML works first, and each island improves it when it loads. A theme change that keeps the classes and data attributes keeps the islands working.

There are two ways in, and neither needs the platform’s build:

  • A Cloudflare Worker in front of the site rewrites the theme’s HTML on the way out (HTMLRewriter) and adds the islands after the consent check. The theme isn’t edited at all. This needs the site’s traffic to pass through Cloudflare.
  • One tag in the theme’s <head>, where a Worker can’t sit in front. It loads the same islands from the same place.
PlatformWhere the page’s HTML comes fromHow the islands arriveNote
ShopifyLiquid theme (theme.liquid, sections)A theme app embed or one tag in theme.liquidShopify serves its storefronts through its own edge, so the tag route is the usual one
WordPressPHP theme templatesWorker in front, or one enqueued script in the theme or a small pluginWorks the same with block and classic themes
AstroStatic or server-rendered pagesWorker in front, or one tag in the base layoutAstro’s own islands can sit beside these; nothing has to be rebuilt to add ours through the Worker
Next.jsReact, server- or statically renderedWorker in front, or one <Script> tag in the root layoutWithout the Worker, the layout tag is a one-time change and redeploy; the islands after that change without a rebuild
Adobe Experience ManagerHTL page components, client librariesWorker in front, or one tag in the page component’s headAuthors keep their components and templates
Magento / Adobe CommerceLayout XML and PHTML templatesWorker in front, or one script declared in the theme’s layout headWorks with Luma and Hyvä themes alike
Salesforce Commerce Cloud (B2C, SFRA)ISML templatesWorker in front, or one tag in the page’s htmlHead templateCartridges and the storefront code stay as they are
SAP Commerce (Hybris)JSP / tag files in the storefrontWorker in front, or one tag in the master templateThe back office and the integration to SAP are untouched

What every row shares: the islands, the consent check and the call to Xano are the same on every platform. Only where the one tag goes differs. The platform keeps rendering its theme; the islands add behaviour; the release gate in Xano decides what any of it may send.

Islands compared with a full framework build

Islands per requirementFull framework build (for example Next.js, Nuxt)
What ships to the browserThe HTML, plus each island the page usesThe framework runtime and the page’s bundle, then hydration of the page
Build step11ty renders HTML; islands need no compile step; only the Rust core is compiledThe whole site goes through the framework’s build
Who editsDesigners in Webflow; developers own the islands and the coreDevelopers, for most changes
Changing CMS or themeThe same islands load the same way under any themeThe front end is tied to the framework’s routing and data loading
ConsentThe Worker decides before any island or tag loadsServer rendering and client hydration can send data before the banner has been answered, unless that is designed in
Where it fits bestContent and commerce pages with a few interactive partsApp-like interfaces with a lot of shared client state

The rule: start with static HTML, add an island only for a requirement the HTML can’t meet, and keep every island optional, so a page still works without it. One repository keeps the islands, the Rust core and the generated Xano tables in step, and hands over with one npm install.

Naming

Names are decided once, in lib/naming.js, when 11ty builds ddic.json. The Rust build only checks them.

ABAPRustRule
Standard table KNA1sap::Kna1Module sap, UpperCamelCase struct
/ACME/CONSENTacme::ConsentThe namespace becomes a module; slashes can’t appear in Rust names
ZSD_ORDER_LOGz::ZsdOrderLogZ and Y objects go in module z
Field KUNNRkunnrsnake_case
Field /ACME/GPCacme_gpcNamespace joined with _
Field TYPEtype_Rust keywords get a trailing _

Every field keeps its ABAP name on the wire through #[serde(rename = "…")], so a record reads and writes unchanged. Two ABAP names that would become the same Rust name stop the build.

Names in this book that needed more than lower-casing

TableABAP fieldRust field
KNA1/ACME/GPCacme_gpc
/ACME/CONSENT(table)acme::Consent

Shopify and YouTube names

The naming rules for the BigQuery transfers (Shopify Admin GraphQL objects, YouTube Channel and Content Owner reports) and the fields that join them across sources are in What is ABAP? → API reference naming.

Types

The first matching row wins. A DDIC type with no row stops the build and names the field.

DDIC typeConditionRust typeHelperFields in this bookNotes
CLNT, LANG, CUKY, UNIT, NUMC, STRG, SSTRString38Text. NUMC stays text because leading zeros are data (0000012345).
CHARlength 1 and data element XFELD, BOOLE_D, FLAG, XFLAG, LOEVM_X, LOEVM_V, LVOMA, LOEVM_KO, AD_FLGDFNR, AD_FLNOUSEboolabap::xflag9“X” is true, blank is false; anything else is refused.
CHARString87Text, blank when initial.
DATSOption<chrono::NaiveDate>abap::dats8YYYYMMDD; 00000000 is None.
TIMSOption<chrono::NaiveTime>abap::tims2HHMMSS; 000000 is midnight, blank is None.
DECdata element TIMESTAMPOption<chrono::NaiveDateTime>abap::timestamp1YYYYMMDDhhmmss UTC, as a number or a string; 0 is None.
CURR, QUAN, DECrust_decimal::Decimal20Read and written as strings, scale kept (258.00). Currency comes from the CUKY field it references.
INT1u81
INT2i160
INT4i321
INT8i640

ABAP has no null. Key fields are required; every other field defaults to ABAP’s initial value (blank, zero, 00000000) when it is missing, and a None date is written back as 00000000.

Google Merchant Center

Which ECC fields feed which attribute of Google’s product data specification, and how. 27 attributes are mapped: 18 machine data, 6 authored, 3 not in ECC.

MeansWho may change it
machine dataA fact ECC already holds as a code, identifier, amount, unit, date or stock quantityNobody: it is converted by a fixed rule in src/merchant.rs and never rewritten or generated. A wrong value is fixed in ECC.
authoredText a person writes, or a mapping a person keepsPeople, and AI if it is declared: Google’s structured_title and structured_description carry digital_source_type: trained_algorithmic_media for generated text.
not in ECCOwned by another system (storefront, DAM)That system.

A material with the deletion flag MARA-LVORM set is removed from the feed rather than sent. Values the rules can’t convert (a failed GTIN check digit, a unit Google doesn’t accept) are left out and listed as notes for review, never guessed.

Machine data: converted by rule

AttributeECC sourceRuleMerchant API v1RequirementSection
idMARA-MATNRMATNR as SAP displays it (numeric numbers lose their leading zeros). Must stay stable; prefix a market only if one material is sent to several feeds.offerId
string
requiredBasic product data
availabilityMARD-LABST
MARD-INSME
MARD-SPEME
in_stock when unrestricted stock (LABST) in the shipping plants is above zero; stock in quality inspection (INSME) or blocked (SPEME) doesn’t count. preorder and backorder need a date from purchasing or ATP and are not derived.productAttributes.availability
enum IN_STOCK / OUT_OF_STOCK / PREORDER / BACKORDER / LIMITED_AVAILABILITY
requiredPrice and availability
priceA004-KSCHL
A004-DATAB
A004-DATBI
KONP-KBETR
KONP-KPEIN
KONP-KONWA
KONP-LOEVM_KO
TCURX-CURRDEC
The PR00 condition valid today and not deletion-flagged: KBETR divided by KPEIN; shifted by TCURX-CURRDEC because SAP stores every amount with 2 decimals (KRW 129000 is stored as 1290.00); written as “129.00 USD”.productAttributes.price
Price {amountMicros (int64 string) + currencyCode}
requiredPrice and availability
sale_priceA004-KSCHL
A004-DATAB
A004-DATBI
KONP-KBETR
KONP-KPEIN
KONP-KONWA
TCURX-CURRDEC
A sale condition type (ZSAL in the sample) valid today; same conversion as price.productAttributes.salePrice
Price
optionalPrice and availability
sale_price_effective_dateA004-DATAB
A004-DATBI
DATAB/DATBI as ISO 8601 with the sales organisation’s UTC offset (DATS has no time zone). An open-ended DATBI (99991231) omits the attribute so the sale applies until the condition ends.productAttributes.salePriceEffectiveDate
Interval {startTime + endTime} RFC 3339 UTC; end exclusive
optionalPrice and availability
cost_of_goods_soldMBEW-VPRSV
MBEW-STPRS
MBEW-VERPR
MBEW-PEINH
Standard price (VPRSV S) or moving average (V) divided by PEINH in the company code currency. Confidential cost data: send it only if finance agrees.productAttributes.costOfGoodsSold
Price
optionalPrice and availability
unit_pricing_measureMARA-INHAL
MARA-INHME
Net contents (IS-Retail) such as “750 ml”. EU unit-price rules require it for many goods.productAttributes.unitPricingMeasure
{value + unit}
conditionalPrice and availability
product_typeMARA-PRDHA
T179T-PRODH
T179T-VTEXT
The product hierarchy text for each level (5 + 5 + 8 characters) joined with “ > “.productAttributes.productTypes[]
string list
optionalProduct category
gtinMARM-EAN11
MARM-NUMTP
MARA-EAN11
MARA-NUMTP
The EAN of the base unit (MARM row where MEINH = MARA-MEINS) or else MARA-EAN11. Sent only with a valid GS1 check digit and never an in-store number (NUMTP IE or GS1 prefixes 02 / 04 / 20-29).productAttributes.gtins[]
string list (up to 10)
conditionalProduct identifiers
mpnMARA-MFRPNManufacturer part number as stored.productAttributes.mpn
string
conditionalProduct identifiers
identifier_existsMARA-EAN11
MARA-MFRPN
“no” when there is neither a valid GTIN nor an MPN.productAttributes.identifierExists
boolean (default true)
optionalProduct identifiers
item_group_idMARA-SATNRThe generic article (IS-Retail) that groups variants.productAttributes.itemGroupId
string
conditionalDetailed product description
product_weightMARA-NTGEW
MARA-GEWEI
Net weight with the SAP unit mapped (KG to kg / G to g / LB to lb / OZ to oz).productAttributes.productWeight
{value (4 decimals) + unit g / kg / oz / lb}
optionalDetailed product description
shipping_weightMARA-BRGEW
MARA-GEWEI
Gross weight; same unit mapping. Required for carrier-calculated rates.productAttributes.shippingWeight
{value + unit}
conditionalShipping and returns
shipping_lengthMARM-LAENG
MARM-MEABM
Base-unit length; MM and M converted to cm; IN kept. Length / width / height are sent together or not at all.productAttributes.shippingLength
{value + unit in / cm}
conditionalShipping and returns
shipping_widthMARM-BREIT
MARM-MEABM
As shipping_length.productAttributes.shippingWidth
{value + unit in / cm}
conditionalShipping and returns
shipping_heightMARM-HOEHE
MARM-MEABM
As shipping_length.productAttributes.shippingHeight
{value + unit in / cm}
conditionalShipping and returns
ships_from_countryT001W-LAND1Country of the shipping plant (ISO 3166-1 alpha-2).customAttributes[ships_from_country]
{name + value}: v1 has no typed field for it
optionalShipping and returns

Authored

AttributeECC sourceRuleMerchant API v1RequirementSection
titleMAKT-MAKTX
MAKT-SPRAS
The 40-character short text in the feed language: an internal label to start from. If AI writes or rewrites the title, send structured_title with digital_source_type trained_algorithmic_media.productAttributes.title
string
requiredBasic product data
descriptionThe sales text is a long text (READ_TEXT object MVKE id 0001), not a table field. AI-written text goes in structured_description with digital_source_type trained_algorithmic_media.productAttributes.description
string
requiredBasic product data
google_product_categoryMARA-MATKLNo ECC field: keep a mapping from material group (or product hierarchy) to the Google taxonomy ID in the system of record.productAttributes.googleProductCategory
string
optionalProduct category
brandMARA-MFRNRMFRNR is the manufacturer’s vendor number; the brand name comes from that vendor (LFA1-NAME1) or a classification characteristic. Not resolved here.productAttributes.brand
string
requiredProduct identifiers
materialMARA-WRKSTBasic material text as entered.productAttributes.material
string
conditionalDetailed product description
colorClassification characteristics (AUSP / CABN); not table fields covered here. Same for size and pattern.productAttributes.color
string
conditionalDetailed product description

Not in ECC

AttributeECC sourceRuleMerchant API v1RequirementSection
linkThe storefront page. Not in ECC.productAttributes.link
string
requiredBasic product data
image_linkThe DAM or CMS. Not in ECC. Google enforces a 500 x 500 px minimum from 2027-01-31.productAttributes.imageLink
string
requiredBasic product data
conditionNot a material field; new for standard stock.productAttributes.condition
enum NEW / USED / REFURBISHED
conditionalDetailed product description

Example: one material

The sample material HM-QUEEN-01 (fixtures/merchant/heated-mat-queen.json) for a US feed on 2026-11-04, price condition PR00, sale condition ZSAL, UTC offset -08:00. tests/merchant.rs checks every value below.

ECC rows in
{
  "MARA": {"MANDT":"100","MATNR":"HM-QUEEN-01","ERSDA":"20240115","LVORM":"","MTART":"HAWA","MATKL":"HOME01","MEINS":"ST","BRGEW":"9.800","GEWEI":"KG","NTGEW":"8.250","EAN11":"012345678905","NUMTP":"UC","MFRNR":"0000300100","MFRPN":"HM-Q-2026","PRDHA":"HOMETHEATMATQUEEN0","WRKST":"Cotton / Carbon heating film","SATNR":"HM-QUEEN","INHAL":"0.000","INHME":""},
  "MAKT": [{"MANDT":"100","MATNR":"HM-QUEEN-01","SPRAS":"E","MAKTX":"Heated mat, queen"},
           {"MANDT":"100","MATNR":"HM-QUEEN-01","SPRAS":"3","MAKTX":"전기매트 퀸"}],
  "MARM": [{"MANDT":"100","MATNR":"HM-QUEEN-01","MEINH":"ST","UMREZ":"1","UMREN":"1","EAN11":"012345678905","NUMTP":"UC","LAENG":"1500.000","BREIT":"2000.000","HOEHE":"12.000","MEABM":"MM","BRGEW":"9.800","GEWEI":"KG"}],
  "CONDITIONS": [
    [{"MANDT":"100","KAPPL":"V","KSCHL":"PR00","VKORG":"US01","VTWEG":"10","MATNR":"HM-QUEEN-01","DATBI":"99991231","DATAB":"20260101","KNUMH":"0000100001"},
     {"MANDT":"100","KNUMH":"0000100001","KOPOS":"01","KSCHL":"PR00","KBETR":"129.00","KONWA":"USD","KPEIN":"1","KMEIN":"ST","LOEVM_KO":""}],
    [{"MANDT":"100","KAPPL":"V","KSCHL":"ZSAL","VKORG":"US01","VTWEG":"10","MATNR":"HM-QUEEN-01","DATBI":"20261130","DATAB":"20261101","KNUMH":"0000100002"},
     {"MANDT":"100","KNUMH":"0000100002","KOPOS":"01","KSCHL":"ZSAL","KBETR":"109.00","KONWA":"USD","KPEIN":"1","KMEIN":"ST","LOEVM_KO":""}]
  ],
  "MARD": [{"MANDT":"100","MATNR":"HM-QUEEN-01","WERKS":"US10","LGORT":"0001","LABST":"42.000","INSME":"3.000","SPEME":"0.000"}],
  "MBEW": {"MANDT":"100","MATNR":"HM-QUEEN-01","BWKEY":"US10","BWTAR":"","VPRSV":"S","VERPR":"0.00","STPRS":"46.50","PEINH":"1"},
  "T001W": {"MANDT":"100","WERKS":"US10","NAME1":"Los Angeles DC","LAND1":"US","REGIO":"CA"},
  "T179T": [{"MANDT":"100","SPRAS":"E","PRODH":"HOMET","VTEXT":"Home"},
            {"MANDT":"100","SPRAS":"E","PRODH":"HOMETHEATM","VTEXT":"Heating"},
            {"MANDT":"100","SPRAS":"E","PRODH":"HOMETHEATMATQUEEN0","VTEXT":"Heated mats"}],
  "CDHDR": [{"MANDANT":"100","OBJECTCLAS":"MATERIAL","OBJECTID":"HM-QUEEN-01","CHANGENR":"0000412001","USERNAME":"MDM_EDIT","UDATE":"20261028","UTIME":"141210","TCODE":"MM02","CHANGE_IND":"U"},
            {"MANDANT":"100","OBJECTCLAS":"MATERIAL","OBJECTID":"HM-QUEEN-01","CHANGENR":"0000412118","USERNAME":"BATCH_PIM","UDATE":"20261103","UTIME":"021500","TCODE":"","CHANGE_IND":"U"}],
  "TCURX": [{"CURRKEY":"KRW","CURRDEC":0},{"CURRKEY":"JPY","CURRDEC":0}]
}

Feed row out (null = not sent; link, image_link, description and brand come from other systems):

{
  "id": "HM-QUEEN-01",
  "title": "Heated mat, queen",
  "availability": "in_stock",
  "price": "129.00 USD",
  "sale_price": "109.00 USD",
  "sale_price_effective_date": "2026-11-01T00:00-08:00/2026-11-30T23:59-08:00",
  "cost_of_goods_sold": "46.50 USD",
  "unit_pricing_measure": null,
  "product_type": "Home > Heating > Heated mats",
  "gtin": "012345678905",
  "mpn": "HM-Q-2026",
  "identifier_exists": "yes",
  "item_group_id": "HM-QUEEN",
  "material": "Cotton / Carbon heating film",
  "product_weight": "8.25 kg",
  "shipping_weight": "9.8 kg",
  "shipping_length": "150 cm",
  "shipping_width": "200 cm",
  "shipping_height": "1.2 cm",
  "ships_from_country": "US"
}

What the rules did:

  • price: KONP-KBETR 129.00 ÷ KPEIN 1, USD has 2 decimals → 129.00 USD
  • sale_price_effective_date: A004 DATAB 20261101 / DATBI 20261130 plus the offset
  • gtin: MARM-EAN11 of the base unit ST, check digit valid, not an in-store prefix
  • shipping_length / width / height: MARM in MM → cm
  • availability: MARD-LABST 42 unrestricted; the 3 in quality inspection don’t count
  • product_type: PRDHA split 5 + 5 + 8 and each level’s T179T text

No notes: every machine value converted.

The same product as a Merchant API v1 product input

POST https://merchantapi.googleapis.com/products/v1/accounts/{account}/productInputs:insert?dataSource=accounts/{account}/dataSources/{dataSource}
{
  "offerId": "HM-QUEEN-01",
  "contentLanguage": "en",
  "feedLabel": "US",
  "productAttributes": {
    "title": "Heated mat, queen",
    "availability": "IN_STOCK",
    "price": {
      "amountMicros": "129000000",
      "currencyCode": "USD"
    },
    "salePrice": {
      "amountMicros": "109000000",
      "currencyCode": "USD"
    },
    "salePriceEffectiveDate": {
      "startTime": "2026-11-01T08:00:00Z",
      "endTime": "2026-12-01T08:00:00Z"
    },
    "costOfGoodsSold": {
      "amountMicros": "46500000",
      "currencyCode": "USD"
    },
    "productTypes": [
      "Home > Heating > Heated mats"
    ],
    "gtins": [
      "012345678905"
    ],
    "mpn": "HM-Q-2026",
    "itemGroupId": "HM-QUEEN",
    "material": "Cotton / Carbon heating film",
    "productWeight": {
      "value": 8.25,
      "unit": "kg"
    },
    "shippingWeight": {
      "value": 9.8,
      "unit": "kg"
    },
    "shippingLength": {
      "value": 150.0,
      "unit": "cm"
    },
    "shippingWidth": {
      "value": 200.0,
      "unit": "cm"
    },
    "shippingHeight": {
      "value": 1.2,
      "unit": "cm"
    }
  },
  "customAttributes": [
    {
      "name": "ships_from_country",
      "value": "US"
    }
  ],
  "versionNumber": "20261103021500"
}

Google names it accounts/{account}/productInputs/en~US~HM-QUEEN-01. What changes from the feed row:

  • Prices are Price objects in micros: 129.00 USD → "amountMicros": "129000000"; KRW 129000 → "129000000000".
  • availability is an enum: IN_STOCK, not in_stock.
  • salePriceEffectiveDate is an Interval in UTC with an exclusive end: the last sale day 2026-11-30 (-08:00) ends at 2026-12-01T08:00:00Z.
  • gtin and product_type become lists: gtins, productTypes.
  • Weights and dimensions are {value, unit} objects, at most 4 decimals.
  • identifierExists defaults to true, so it is only sent as false.
  • ships_from_country has no typed v1 field, so it goes in customAttributes.
  • versionNumber is the newest change document for the material (CDHDR, object class MATERIAL: 2026-11-03 02:15:00). Google refuses an insert into a primary data source whose number is lower than the stored one, so a late or replayed batch can’t overwrite a newer product with older data. It is machine data too.

Both shapes come from one converted Product in src/merchant.rs: feed_row writes the specification’s names and text ("129.00 USD"), and src/merchant_api.rs writes the Merchant API v1 productInputs resource ({"amountMicros": "129000000"}). tests/merchant_api.rs fails if a field path in this table is missing from the API output.

GraphQL: Product and User

Two GraphQL shapes generated from the same map as the Rust structs and the Google Merchant Center chapter. Product attributes follow Google’s product data specification.

  • Product has one field per Merchant attribute, named and typed like the Merchant API v1 product input (price: Money in micros, availability: Availability, gtins: [String!]). 18 of its fields are machine data.
  • User is the customer: KNA1 with its address and default e-mail, and the consent ledger. 5 of its fields are personal data, so User is a separate type: nothing personal is reachable from Product, and nothing in User is sent to Merchant Center.

Every field carries @source(ecc: [...], origin: ...), so a resolver, a reviewer or an agent can see where a value comes from and whether it may be rewritten. marketingOptIn is @deprecated: it is a flag a nightly batch can overwrite, so clients read consent (newest row per purpose wins) instead.

Fields

TypeFieldGraphQL typeOriginECC source
ProductofferIdID!machineMARA-MATNR
ProducttitleStringauthoredMAKT-MAKTX
MAKT-SPRAS
ProductdescriptionStringauthored
ProductlinkStringnone
ProductimageLinkStringnone
ProductavailabilityAvailabilitymachineMARD-LABST
MARD-INSME
MARD-SPEME
ProductpriceMoneymachineA004-KSCHL
A004-DATAB
A004-DATBI
KONP-KBETR
KONP-KPEIN
KONP-KONWA
KONP-LOEVM_KO
TCURX-CURRDEC
ProductsalePriceMoneymachineA004-KSCHL
A004-DATAB
A004-DATBI
KONP-KBETR
KONP-KPEIN
KONP-KONWA
TCURX-CURRDEC
ProductsalePriceEffectiveDateDateIntervalmachineA004-DATAB
A004-DATBI
ProductcostOfGoodsSoldMoneymachineMBEW-VPRSV
MBEW-STPRS
MBEW-VERPR
MBEW-PEINH
ProductunitPricingMeasureMeasuremachineMARA-INHAL
MARA-INHME
ProductgoogleProductCategoryStringauthoredMARA-MATKL
ProductproductTypes[String!]machineMARA-PRDHA
T179T-PRODH
T179T-VTEXT
ProductbrandStringauthoredMARA-MFRNR
Productgtins[String!]machineMARM-EAN11
MARM-NUMTP
MARA-EAN11
MARA-NUMTP
ProductmpnStringmachineMARA-MFRPN
ProductidentifierExistsBooleanmachineMARA-EAN11
MARA-MFRPN
ProductitemGroupIdStringmachineMARA-SATNR
ProductmaterialStringauthoredMARA-WRKST
ProductcolorStringauthored
ProductconditionConditionnone
ProductproductWeightMeasuremachineMARA-NTGEW
MARA-GEWEI
ProductshippingWeightMeasuremachineMARA-BRGEW
MARA-GEWEI
ProductshippingLengthMeasuremachineMARM-LAENG
MARM-MEABM
ProductshippingWidthMeasuremachineMARM-BREIT
MARM-MEABM
ProductshippingHeightMeasuremachineMARM-HOEHE
MARM-MEABM
ProductshipsFromCountryStringmachineT001W-LAND1
UseridID!machineKNA1-KUNNR
UsernameStringpersonalKNA1-NAME1
UseremailStringpersonalADR6-SMTP_ADDR
ADR6-FLGDEFAULT
ADR6-FLG_NOUSE
UserphoneStringpersonalADRC-TEL_NUMBER
UsercityStringpersonalKNA1-ORT01
UserpostalCodeStringpersonalKNA1-PSTLZ
UserregionStringmachineKNA1-REGIO
UsercountryString!machineKNA1-LAND1
UserlanguageStringmachineKNA1-SPRAS
UsercreatedOnDatemachineKNA1-ERDAT
UserdeletedBoolean!machineKNA1-LOEVM
UsergpcSeenBooleanmachineKNA1-/ACME/GPC
UsermarketingOptInBooleanmachineKNA1-ZZ_MKT_OPTIN
Userconsent[Consent!]!machine/ACME/CONSENT

Schema

schema.graphql in the repository; tests/graphql.rs parses it.

# @generated from site/ddic.json by src/codegen.rs. Do not edit.

"""Where a field's value comes from, and who may change it."""
directive @source(
  """Attribute name in the product data specification."""
  attribute: String
  """ECC tables and fields it is converted from."""
  ecc: [String!]!
  origin: Origin!
) on FIELD_DEFINITION

enum Origin {
  """A code, identifier, amount, unit, date or quantity ECC holds: converted by rule, never rewritten."""
  MACHINE
  """Text a person writes. AI-written text must be declared (digital_source_type)."""
  AUTHORED
  """Owned by another system."""
  NONE
  """Personal data: served only to the customer or a permitted purpose, never sent to Merchant Center."""
  PERSONAL
}

scalar Date
scalar DateTime

"""A product, shaped like a Merchant API v1 product input. Attributes: https://support.google.com/merchants/answer/7052112"""
type Product {
  """ISO 639-1, e.g. en."""
  contentLanguage: String!
  """A-Z, 0-9, - and _; up to 20."""
  feedLabel: String!
  offerId: ID! @source(attribute: "id", ecc: ["MARA-MATNR"], origin: MACHINE)
  title: String @source(attribute: "title", ecc: ["MAKT-MAKTX", "MAKT-SPRAS"], origin: AUTHORED)
  description: String @source(attribute: "description", ecc: [], origin: AUTHORED)
  link: String @source(attribute: "link", ecc: [], origin: NONE)
  imageLink: String @source(attribute: "image_link", ecc: [], origin: NONE)
  availability: Availability @source(attribute: "availability", ecc: ["MARD-LABST", "MARD-INSME", "MARD-SPEME"], origin: MACHINE)
  price: Money @source(attribute: "price", ecc: ["A004-KSCHL", "A004-DATAB", "A004-DATBI", "KONP-KBETR", "KONP-KPEIN", "KONP-KONWA", "KONP-LOEVM_KO", "TCURX-CURRDEC"], origin: MACHINE)
  salePrice: Money @source(attribute: "sale_price", ecc: ["A004-KSCHL", "A004-DATAB", "A004-DATBI", "KONP-KBETR", "KONP-KPEIN", "KONP-KONWA", "TCURX-CURRDEC"], origin: MACHINE)
  salePriceEffectiveDate: DateInterval @source(attribute: "sale_price_effective_date", ecc: ["A004-DATAB", "A004-DATBI"], origin: MACHINE)
  costOfGoodsSold: Money @source(attribute: "cost_of_goods_sold", ecc: ["MBEW-VPRSV", "MBEW-STPRS", "MBEW-VERPR", "MBEW-PEINH"], origin: MACHINE)
  unitPricingMeasure: Measure @source(attribute: "unit_pricing_measure", ecc: ["MARA-INHAL", "MARA-INHME"], origin: MACHINE)
  googleProductCategory: String @source(attribute: "google_product_category", ecc: ["MARA-MATKL"], origin: AUTHORED)
  productTypes: [String!] @source(attribute: "product_type", ecc: ["MARA-PRDHA", "T179T-PRODH", "T179T-VTEXT"], origin: MACHINE)
  brand: String @source(attribute: "brand", ecc: ["MARA-MFRNR"], origin: AUTHORED)
  gtins: [String!] @source(attribute: "gtin", ecc: ["MARM-EAN11", "MARM-NUMTP", "MARA-EAN11", "MARA-NUMTP"], origin: MACHINE)
  mpn: String @source(attribute: "mpn", ecc: ["MARA-MFRPN"], origin: MACHINE)
  identifierExists: Boolean @source(attribute: "identifier_exists", ecc: ["MARA-EAN11", "MARA-MFRPN"], origin: MACHINE)
  itemGroupId: String @source(attribute: "item_group_id", ecc: ["MARA-SATNR"], origin: MACHINE)
  material: String @source(attribute: "material", ecc: ["MARA-WRKST"], origin: AUTHORED)
  color: String @source(attribute: "color", ecc: [], origin: AUTHORED)
  condition: Condition @source(attribute: "condition", ecc: [], origin: NONE)
  productWeight: Measure @source(attribute: "product_weight", ecc: ["MARA-NTGEW", "MARA-GEWEI"], origin: MACHINE)
  shippingWeight: Measure @source(attribute: "shipping_weight", ecc: ["MARA-BRGEW", "MARA-GEWEI"], origin: MACHINE)
  shippingLength: Measure @source(attribute: "shipping_length", ecc: ["MARM-LAENG", "MARM-MEABM"], origin: MACHINE)
  shippingWidth: Measure @source(attribute: "shipping_width", ecc: ["MARM-BREIT", "MARM-MEABM"], origin: MACHINE)
  shippingHeight: Measure @source(attribute: "shipping_height", ecc: ["MARM-HOEHE", "MARM-MEABM"], origin: MACHINE)
  shipsFromCountry: String @source(attribute: "ships_from_country", ecc: ["T001W-LAND1"], origin: MACHINE)
  """Newest change document for the material (CDHDR), YYYYMMDDhhmmss: an older write can't replace a newer one."""
  versionNumber: String @source(ecc: ["CDHDR-UDATE", "CDHDR-UTIME"], origin: MACHINE)
}

"""Micros: 1 000 000 = one unit of the currency. KRW and JPY are already shifted from SAP's 2 stored decimals."""
type Money {
  amountMicros: String!
  """ISO 4217."""
  currencyCode: String!
}

"""UTC; endTime is exclusive."""
type DateInterval {
  startTime: DateTime!
  endTime: DateTime!
}

type Measure {
  value: Float!
  """Google's unit: g, kg, oz, lb, cm, in, ml, l, ..."""
  unit: String!
}

enum Availability {
  IN_STOCK
  OUT_OF_STOCK
  PREORDER
  BACKORDER
  LIMITED_AVAILABILITY
}

enum Condition {
  NEW
  USED
  REFURBISHED
}

"""A customer (KNA1 with its address and e-mail) and their consent. Personal data stays here: it is not part of Product."""
type User {
  """Customer number as SAP displays it (leading zeros dropped for all-digit numbers)."""
  id: ID! @source(ecc: ["KNA1-KUNNR"], origin: MACHINE)
  """Name 1 of the customer master."""
  name: String @source(ecc: ["KNA1-NAME1"], origin: PERSONAL)
  """The default e-mail address (FLGDEFAULT) that is not marked do-not-use (FLG_NOUSE); ADR6 is reached through KNA1-ADRNR."""
  email: String @source(ecc: ["ADR6-SMTP_ADDR", "ADR6-FLGDEFAULT", "ADR6-FLG_NOUSE"], origin: PERSONAL)
  """Telephone from the business address."""
  phone: String @source(ecc: ["ADRC-TEL_NUMBER"], origin: PERSONAL)
  """City."""
  city: String @source(ecc: ["KNA1-ORT01"], origin: PERSONAL)
  """Postal code."""
  postalCode: String @source(ecc: ["KNA1-PSTLZ"], origin: PERSONAL)
  """Region code (ISO 3166-2 subdivision once prefixed with the country)."""
  region: String @source(ecc: ["KNA1-REGIO"], origin: MACHINE)
  """ISO 3166-1 alpha-2."""
  country: String! @source(ecc: ["KNA1-LAND1"], origin: MACHINE)
  """BCP 47 from the one-character SAP language key (E → en / 3 → ko)."""
  language: String @source(ecc: ["KNA1-SPRAS"], origin: MACHINE)
  """Created on."""
  createdOn: Date @source(ecc: ["KNA1-ERDAT"], origin: MACHINE)
  """Central deletion flag: a deleted customer is not served."""
  deleted: Boolean! @source(ecc: ["KNA1-LOEVM"], origin: MACHINE)
  """Global Privacy Control was received."""
  gpcSeen: Boolean @source(ecc: ["KNA1-/ACME/GPC"], origin: MACHINE)
  marketingOptIn: Boolean @source(ecc: ["KNA1-ZZ_MKT_OPTIN"], origin: MACHINE) @deprecated(reason: "a flag a batch job can overwrite. Read consent instead.")
  """The append-only consent ledger for this customer; the newest row per purpose wins."""
  consent: [Consent!]! @source(ecc: ["/ACME/CONSENT"], origin: MACHINE)
}

"""One row of /ACME/CONSENT: append-only, the newest row per purpose wins."""
type Consent {
  purpose: String! @source(ecc: ["/ACME/CONSENT-PURPOSE"], origin: MACHINE)
  recordedAt: DateTime! @source(ecc: ["/ACME/CONSENT-RECORDED_AT"], origin: MACHINE)
  granted: Boolean! @source(ecc: ["/ACME/CONSENT-GRANTED"], origin: MACHINE)
  source: String @source(ecc: ["/ACME/CONSENT-SOURCE"], origin: MACHINE)
  seqno: Int @source(ecc: ["/ACME/CONSENT-SEQNO"], origin: MACHINE)
}

type Query {
  product(offerId: ID!, contentLanguage: String!, feedLabel: String!): Product
  """Served only to the customer themself or for a permitted purpose."""
  user(id: ID!): User
}

Example

The same sample material as the Merchant chapter, and the sample customer from fixtures/records/kna1.json, adr6.json and acme_consent.json. tests/graphql.rs checks that every key in these responses is a field of the schema.

query {
  product(offerId: "HM-QUEEN-01", contentLanguage: "en", feedLabel: "US") {
    offerId title availability
    price { amountMicros currencyCode }
    salePrice { amountMicros currencyCode }
    salePriceEffectiveDate { startTime endTime }
    gtins mpn identifierExists productTypes
    shippingWeight { value unit }
    shipsFromCountry versionNumber
  }
}
{
  "data": {
    "product": {
      "availability": "IN_STOCK",
      "gtins": [
        "012345678905"
      ],
      "identifierExists": true,
      "mpn": "HM-Q-2026",
      "offerId": "HM-QUEEN-01",
      "price": {
        "amountMicros": "129000000",
        "currencyCode": "USD"
      },
      "productTypes": [
        "Home > Heating > Heated mats"
      ],
      "salePrice": {
        "amountMicros": "109000000",
        "currencyCode": "USD"
      },
      "salePriceEffectiveDate": {
        "endTime": "2026-12-01T08:00:00Z",
        "startTime": "2026-11-01T08:00:00Z"
      },
      "shippingWeight": {
        "unit": "kg",
        "value": 9.8
      },
      "shipsFromCountry": "US",
      "title": "Heated mat, queen",
      "versionNumber": "20261103021500"
    }
  }
}
query {
  user(id: "12345") {
    id name email country region language createdOn deleted gpcSeen marketingOptIn
    consent { purpose recordedAt granted source seqno }
  }
}
{
  "data": {
    "user": {
      "consent": [
        {
          "granted": false,
          "purpose": "ads",
          "recordedAt": "2026-11-04T10:05:00Z",
          "seqno": 0,
          "source": "dsr"
        },
        {
          "granted": true,
          "purpose": "ads",
          "recordedAt": "2026-11-04T10:02:00Z",
          "seqno": 0,
          "source": "banner"
        }
      ],
      "country": "US",
      "createdOn": "2024-01-15",
      "deleted": false,
      "email": "orders@example.com",
      "gpcSeen": false,
      "id": "12345",
      "language": "en",
      "marketingOptIn": true,
      "name": "Example Retail Inc.",
      "region": "CA"
    }
  }
}

consent returns the ledger; the 10:05 withdrawal (dsr) is newer than the 10:02 grant, so ads consent is withdrawn. marketingOptIn still says true: that is the stale batch-written flag the schema deprecates.

Rust structs and GraphQL types

The same field in each shape it takes: the GraphQL type a client or agent reads, the Rust struct that holds it after conversion, and the ECC fields it comes from. The GraphQL side is schema.graphql; the Rust side is src/merchant.rs and src/merchant_api.rs for products and the generated sap::* and acme::* structs for customers.

Origin follows the book’s rule: machine data is converted by a fixed rule and never rewritten, authored text may be written by people or declared AI, none comes from another system, and personal data never reaches Merchant Center.

Product

Two Rust structs: merchant::Product is the converted ECC record (amounts as Decimal, dates as chrono), and merchant_api::ProductInput is what the Merchant API v1 receives (amounts in micros as strings, enums upper case). merchant_api::product_input turns one into the other; tests/merchant_api.rs checks every path.

GraphQL fieldGraphQL typemerchant::Product (converted)merchant_api::ProductInput (sent)OriginECC source
offerIdID!id: Stringoffer_id: StringmachineMARA-MATNR
contentLanguageString!(feed setting)content_language: String
feedLabelString!(feed setting)feed_label: String
titleStringtitle: Option<String>title: Option<String>authoredMAKT-MAKTX, MAKT-SPRAS
availabilityAvailabilityin_stock: boolavailability: &'static str (IN_STOCK / OUT_OF_STOCK)machineMARD-LABST, MARD-INSME, MARD-SPEME
priceMoneyprice: Option<Money> (amount: Decimal, currency: String, decimals: u32)price: Option<Price> (amount_micros: String, currency_code: String)machineA004, KONP, TCURX-CURRDEC
salePriceMoneysale_price: Option<Money>sale_price: Option<Price>machineA004, KONP, TCURX-CURRDEC
salePriceEffectiveDateDateIntervalsale_window: Option<(NaiveDate, NaiveDate, FixedOffset)> (inclusive, local)sale_price_effective_date: Option<Interval> (UTC, end exclusive)machineA004-DATAB, A004-DATBI
costOfGoodsSoldMoneycost: Option<Money>cost_of_goods_sold: Option<Price>machineMBEW-VPRSV, MBEW-STPRS, MBEW-VERPR, MBEW-PEINH
unitPricingMeasureMeasureunit_pricing: Option<Measure> (value: Decimal, unit)unit_pricing_measure: Option<ValueUnit> (value: f64, unit)machineMARA-INHAL, MARA-INHME
productTypes[String!]product_type: Option<String>product_types: Vec<String>machineMARA-PRDHA, T179T-VTEXT
gtins[String!]gtin: Option<String>gtins: Vec<String>machineMARM-EAN11, MARM-NUMTP, MARA-EAN11, MARA-NUMTP
mpnStringmpn: Option<String>mpn: Option<String>machineMARA-MFRPN
identifierExistsBooleanderived: identifier_exists()identifier_exists: Option<bool> (sent only as false)machineMARA-EAN11, MARA-MFRPN
itemGroupIdStringitem_group_id: Option<String>item_group_id: Option<String>machineMARA-SATNR
materialStringmaterial: Option<String>material: Option<String>authoredMARA-WRKST
productWeightMeasureproduct_weight: Option<Measure>product_weight: Option<ValueUnit>machineMARA-NTGEW, MARA-GEWEI
shippingWeightMeasureshipping_weight: Option<Measure>shipping_weight: Option<ValueUnit>machineMARA-BRGEW, MARA-GEWEI
shippingLengthMeasureshipping_dims: Option<[Measure; 3]>, [0]shipping_length: Option<ValueUnit>machineMARM-LAENG, MARM-MEABM
shippingWidthMeasureshipping_dims, [1]shipping_width: Option<ValueUnit>machineMARM-BREIT, MARM-MEABM
shippingHeightMeasureshipping_dims, [2]shipping_height: Option<ValueUnit>machineMARM-HOEHE, MARM-MEABM
shipsFromCountryString (ISO 3166-1 alpha-2)ships_from_country: Option<String>custom_attributes: Vec<CustomAttribute> (name, value)machineT001W-LAND1
versionNumberStringversion: Option<i64> (YYYYMMDDhhmmss)version_number: Option<String>machineCDHDR-UDATE, CDHDR-UTIME
description, googleProductCategory, brand, colorStringnot heldnot sent from ECCauthoredwritten by people, or AI if declared
link, imageLink, conditionString, String, Conditionnot heldnot sent from ECCnonestorefront, DAM

User

There is no single Rust User struct. User in GraphQL is assembled from the generated table structs, so each field keeps the type its DDIC field has; the resolver joins them on KNA1-ADRNR = ADDRNUMBER.

GraphQL fieldGraphQL typeRust struct and fieldRust typeOriginECC source
idID!sap::Kna1.kunnrStringmachineKNA1-KUNNR
nameStringsap::Kna1.name1StringpersonalKNA1-NAME1
emailStringsap::Adr6.smtp_addr, where flgdefault and not flg_nouseString, bool, boolpersonalADR6-SMTP_ADDR, ADR6-FLGDEFAULT, ADR6-FLG_NOUSE
phoneStringsap::Adrc.tel_numberStringpersonalADRC-TEL_NUMBER
cityStringsap::Kna1.ort01StringpersonalKNA1-ORT01
postalCodeStringsap::Kna1.pstlzStringpersonalKNA1-PSTLZ
regionStringsap::Kna1.regioStringmachineKNA1-REGIO
countryString!sap::Kna1.land1StringmachineKNA1-LAND1
languageStringsap::Kna1.spras (E → en, 3 → ko)StringmachineKNA1-SPRAS
createdOnDatesap::Kna1.erdatOption<chrono::NaiveDate>machineKNA1-ERDAT
deletedBoolean!sap::Kna1.loevmboolmachineKNA1-LOEVM
gpcSeenBooleansap::Kna1.acme_gpcboolmachineKNA1-/ACME/GPC
marketingOptIn (deprecated)Booleansap::Kna1.zz_mkt_optinboolmachineKNA1-ZZ_MKT_OPTIN
consent[Consent!]!Vec<acme::Consent> for the customersee belowmachine/ACME/CONSENT
GraphQL fieldGraphQL typeRust struct and fieldRust typeECC source
purposeString!acme::Consent.purposeString/ACME/CONSENT-PURPOSE
recordedAtDateTime!acme::Consent.recorded_atOption<chrono::NaiveDateTime>/ACME/CONSENT-RECORDED_AT
grantedBoolean!acme::Consent.grantedbool/ACME/CONSENT-GRANTED
sourceStringacme::Consent.sourceString/ACME/CONSENT-SOURCE
seqnoIntacme::Consent.seqnoi32/ACME/CONSENT-SEQNO

Google Merchant endpoints: product, loyalty, comparison shopping, reviews

Where each record goes in Google, and what of it this book builds. All four use the https://www.googleapis.com/auth/content OAuth scope, and every write names a data source (accounts/{account}/dataSources/{dataSource}).

EndpointMethod and pathVersionRust structGraphQLWhat it carriesHere
ProductPOST https://merchantapi.googleapis.com/products/v1/{parent=accounts/*}/productInputs:insert?dataSource=...; the processed product is read back with GET .../products/v1/accounts/{account}/products/{contentLanguage~feedLabel~offerId}v1merchant_api::ProductInputProductThe converted ECC product: identifiers, prices, stock, units, dimensions, versionNumberBuilt: src/merchant_api.rs, tests/merchant_api.rs. Nothing sends yet.
LoyaltyNo endpoint of its own: productAttributes.loyaltyPrograms[] on the same productInputs:insert. Loyalty shipping is set on accounts/{account}/shippingSettings. The program must first be linked in Merchant Center.v1not built: would be ProductAttributes.loyalty_programs: Vec<LoyaltyProgram>not built: would be Product.loyaltyProgramsPer tier: programLabel, tierLabel, member price (no higher than the regular price), cashbackForFutureUse, loyaltyPoints, memberPriceEffectiveDate, shippingLabelNot built. A member price would come from its own SAP condition type, converted like price. Program data, not personal data: who is a member stays on User.
Comparison shoppingPOST https://css.googleapis.com/v1/{parent=accounts/*}/cssProductInputs:insert: the separate CSS API, for comparison shopping services listing other merchants’ productsv1not builtnot builtA product input keyed by contentLanguage, feedLabel (the target country, e.g. DE) and identity; feedId is deprecatedNot built. Applies only when acting as, or supplying, a comparison shopping service. One-time API registration required.
ReviewsPOST https://merchantapi.googleapis.com/reviews/v1beta/{parent=accounts/*}/productReviews:insert?dataSource=... and .../merchantReviews:insert?dataSource=..., with get, list and deletev1betanot builtnot builtRating, title, content, review time, language and country, isVerifiedPurchase, isIncentivizedReview, and the reviewer (reviewerId, reviewerUsername, isAnonymous)Not built. Reviews come from the storefront or a review platform, not ECC. The reviewer is personal data: it belongs with User, under consent, never in Product. Requires a review data source and enrolment in the product ratings programme.

Two rules follow from the table:

  • Loyalty and reviews ride on the product, not the person. A member price is a fact about the product and the tier; a review is attached to the product’s identifiers. The person behind either (the member, the reviewer) stays on User, and leaves only through the release gate.
  • Beta means it can change. Reviews are v1beta; Google says beta versions are subject to change or removal. Product and loyalty are on v1.

Sources: Products: add and manage, ProductAttributes (v1), including loyaltyPrograms, loyalty_program in the product data specification, CSS API: cssProductInputs.insert, Reviews: product reviews, Reviews: merchant reviews, Merchant API design and versioning.

Where the types differ, and why

  • Amounts: Decimal in Rust keeps SAP’s scale exactly (258.00); GraphQL and the Merchant API carry micros as a string, because int64 doesn’t fit a JSON number safely.
  • Dates: Rust holds what ECC means (a local sale window, inclusive); the API gets UTC with an exclusive end.
  • Lists: ECC holds one GTIN and one product type per row; Google takes lists, so the converter wraps them.
  • Optional vs required: ABAP has no null. A Rust Option is None only where ECC’s initial value means “not set” (00000000 dates); GraphQL’s non-null ! marks the fields a resolver must always return.
  • Personal data: only User holds it. Nothing in Product, merchant::Product or ProductInput can carry a name, e-mail or phone, so a product feed can’t leak one.

Consent gaps

ECC has no consent model. It holds identity (KUNNR, address, e-mail), communication flags and blocking, but none of what a consent check needs. These are the 12 gaps, with the ECC fields that come closest. The CRM Sync gap fill chapter shows what fills each one.

The rule that follows from the table: keep consent out of ECC. ECC stays the source of identity and blocking; consent lives in an append-only ledger in Xano that ECC and batch jobs may read but never write.

GapWhat ECC hasClosest ECC fieldsWhat’s missing
Consent per purpose (analytics, ads, sale / share, email, SMS)At most a custom ZZ_ flag on KNA1. ADR6-FLG_NOUSE means “don’t use this address”, not “no consent”.KNA1-ZZ_MKT_OPTIN
ADR6-FLG_NOUSE
A record per purpose: one flag can’t say “email yes, ads no”.
Who decided, how and with which bannerChange documents, but only for fields flagged for change documents; custom ZZ_ fields usually aren’t, so a flip leaves no trace. A batch user shows up as the author.CDHDR-USERNAME
CDHDR-TCODE
CDPOS-VALUE_OLD
CDPOS-VALUE_NEW
The source, banner version and actor stored with each decision.
An exact, comparable timeDATS dates have no time zone; CDHDR UDATE / UTIME are server local time.CDHDR-UDATE
CDHDR-UTIME
UTC timestamps and a sequence number for events in the same second, so the newest row reliably wins.
Where consent was given, and under which regimeLAND1 / REGIO are the billing address, not where the shopper was when they decided.KNA1-LAND1
KNA1-REGIO
The region (ISO 3166-2) and regime (US opt-out with GPC, EU / UK opt-in, KR PIPA opt-in) at decision time.
Consent before there is a customerNothing: a visitor has no KUNNR until they order.(none)Consent keyed by a visitor ID and linked to the customer later.
Consent for one-time customersOne-time customer accounts share a single KUNNR across many real people.KNA1-KUNNRA key for the person, not the shared account.
Consent for B2B contact personsContact persons (KNVK) hang off the company record.(none)Consent per person, not per company.
A withdrawal that sticksA DEBMAS IDoc or a 15-minute middleware job rewrites whole segments, so a stale ZZ_MKT_OPTIN = X overwrites a withdrawal.KNA1-ZZ_MKT_OPTINAn append-only ledger; batch jobs read consent and never write it; withdrawals pushed as events.
Data subject requests: access, deletion, opt-out of saleLater enhancement packs add end-of-purpose blocking and ILM deletion, but no request tracking or receipts.KNA1-LOEVMA request record with a due date and a receipt from every system it fans out to.
Age or minor statusNo age field.(none)A minor flag where the law requires one.
Retention per purposeRetention is per object (ILM), not per purpose.(none)An expiry per purpose.
Permission to use a person for ads and audiencesNothing ties a customer to ads permission.(none)ad_user_data and ad_personalization checked before anyone is exported to an audience.

On a real system, check first whether any custom consent field is flagged for change documents (its data element’s change-document setting). If it isn’t, there is no record today of who changed it or when.

The /ACME/CONSENT table in this book is the shape the ledger takes if it must live in ECC; the Xano ledger in the next chapter adds the columns ECC can’t supply.

Does S/4HANA close the gaps?

Partly. An upgrade to S/4HANA improves the data-protection mechanics, but consent and the global state at decision time still sit outside the ERP core. SAP does sell consent tooling; it is a separate product the ERP receives by integration, which adds one more copy to reconcile rather than one record of truth.

What S/4HANA improves

ECC gapIn S/4HANA
Several customer masters (KNA1, KNVK contact persons)The Business Partner is mandatory: one record per person or organisation, with relationships for B2B contacts. This narrows the contact person gap.
Data subject requestsILM blocking and deletion at end of purpose, Read Access Logging, and information retrieval to collect one person’s data across objects.
Batch-only interfacesAPIs and events exist, though most estates still run IDocs and middleware batches.

What is still missing

GapWhy S/4HANA doesn’t close it
Consent per purposeNo per-purpose, append-only ledger in the core: still a flag or a custom field on the Business Partner. SAP’s consent products keep it in a separate system.
Region and regime at decision timeThe Business Partner holds an address, not where the shopper was, under which regime and with which banner. ERP is not on the path of a browser session.
A withdrawal that sticksIf middleware still rewrites whole master-data segments on a schedule, a stale opt-in still overwrites a withdrawal. A new ERP doesn’t change the batch.
Retention per purposeILM retention follows the business object and its legal hold (tax, commercial), not the purpose of consent.
Consent before there is a customerA Business Partner must exist first; visitors and pre-login consent are out of scope.
AudiencesNothing in ERP checks ad_user_data and ad_personalization before an audience or a BigQuery segment is exported.
Residency across regimesOne global instance in one region doesn’t give per-regime storage for EU, UK or KR personal data.

Why enterprises struggle with compliance. Consent ends up copied across systems that each own something else:

Consent banner / CMP (session) ─┐
Commerce platform ──────────────┤   each holds a copy of "consent",
Marketing cloud / CDP ──────────┼── refreshed on its own schedule,
S/4HANA Business Partner flags ─┤   none on the path of every decision
Warehouse and ad exports ───────┘
  • No record wins. When the banner, the CDP and the ERP flag disagree, no one can show which was in force when an export ran.
  • Batch delay is a compliance gap. A withdrawal that takes hours to reach an audience job is out of compliance for those hours.
  • Ownership is split. Legal owns the policy, marketing the CMP, IT the ERP, data teams the warehouse; no one owns the decision.
  • Several ERPs and regions, after acquisitions, multiply every gap above.
  • Upgrades treat consent as migration scope. The fields are moved; the decision logic is never designed.

The rule holds through the upgrade: ERP is the source of identity and blocking; consent lives in an append-only ledger beside it, and every export checks it live through the release gate. That is also why the gaps can be closed without a full upgrade: see An alternative to a full S/4HANA upgrade.

The S/4HANA features named here vary by release and by which SAP products are licensed. Check them against the system in front of you: where a consent product is in place, the first gap becomes “a consent store outside ERP that must be reconciled”, not “no consent store”.

CRM Sync gap fill: Shopify / Google → Xano

CRM Sync captures consent at the edge, before any tag loads, and writes it to a ledger in Xano, the system of record. Shopify and Google each hold part of the picture; neither holds all of it, and ECC holds none. For each consent gap:

GapShopifyGoogleCRM SyncXano
Consent per purpose (analytics, ads, sale / share, email, SMS)emailMarketingConsent and smsMarketingConsent on the customer (per channel); Customer Privacy API analytics / marketing / preferences / sale_of_data (per visitor).Consent Mode v2: analytics_storage, ad_storage, ad_user_data, ad_personalization.The banner writes one ledger row per purpose, never one combined flag.purpose
granted
Who decided, how and with which bannermarketingOptInLevel (single / confirmed opt-in); consentCollectedFrom on SMS consent.The Consent Mode update that was sent, as evidence.Every row carries source, banner_version, actor and a hash of the raw signal.source
banner_version
actor
evidence_sha256
An exact, comparable timeconsentUpdatedAt (ISO 8601, UTC).-recorded_at in UTC at the edge, plus seq.recorded_at
seq
Where consent was given, and under which regimeCustomer Privacy API region for the visitor.Consent Mode defaults set per region.Region from the edge request and the Sec-GPC header, resolved to a regime before the banner shows.region
regime
gpc
Consent before there is a customerCustomer Privacy API consent for an anonymous visitor.Consent Mode state per browser.visitor_id on every row; an identity link to the Shopify customer and KUNNR on first order or sign-in.subject_type
visitor_id
identity_link
Consent for one-time customersThe customer created or matched from the checkout email.-Subject keyed by email hash and Shopify customer ID; never by a one-time KUNNR.email_sha256
shopify_customer_id
Consent for B2B contact personsB2B company contacts are customers in their own right.-subject_type contact, with the company as context.subject_type
contact_id
A withdrawal that sticksCustomer marketing-consent update webhooks.A Consent Mode update to denied on the page.Appends a row, then publishes the withdrawal event; nothing overwrites a row.idempotency_key
recorded_at
seq
Data subject requests: access, deletion, opt-out of salecustomers/data_request, customers/redact and shop/redact webhooks; dataSaleOptOut on the customer.Remove the person from Customer Match lists.Fans the request out (Shopify, Google, ECC, Xano) and collects a receipt from each.dsr_request
dsr_receipt
Age or minor status--An age gate where required; unknown stays unknown.minor
Retention per purpose--Sets expires_at from the regime’s rule when it writes the row.expires_at
Permission to use a person for ads and audiencesmarketing and sale_of_data from the Customer Privacy API.Customer Match uploads carry consent (adUserData, adPersonalization: GRANTED / DENIED) per person.Exports only subjects whose newest ad_user_data and ad_personalization rows are granted; Merchant Center products carry no personal data.entitlement

Append-only: rows are added, never updated. The newest row per subject and purpose (by recorded_at, then seq) is the current decision.

FieldTypeNote
idintRow ID.
idempotency_keytext, uniqueOne per decision; a replay writes nothing.
subject_typeenum customer / visitor / contact
visitor_idtextSet before there is a customer.
kunnrtextKNA1-KUNNR when known; never a one-time account.
shopify_customer_idtextgid://shopify/Customer/…
email_sha256textNormalised e-mail, hashed: a key, not contact data.
contact_idtextB2B contact person.
purposeenum analytics / ads / ad_user_data / ad_personalization / sale_share / email / sms
grantedbool
sourceenum banner / shopify / dsr / gpc / importimport rows never grant ads purposes.
banner_versiontext
actortextWho or what wrote it: shopper, agent, support user, job.
regiontextISO 3166-2 at decision time.
regimeenum us_optout / eu_optin / kr_pipa / …
gpcboolSec-GPC seen.
minorbool, nullable
recorded_attimestamp (UTC)
seqintOrders events in the same second.
expires_attimestamp, nullable
evidence_sha256textHash of the raw signal (banner payload, webhook body).

Alongside it: identity_link (visitor → Shopify customer → KUNNR), dsr_request and dsr_receipt (one receipt per system a request fans out to), and an entitlement view computed from the newest rows: what a person may be sent, shown or exported to. Entitlements are derived, never uploaded or edited by hand.

Who writes what

WriterMay writeMay not
CRM Sync banner (edge)Ledger rows (source banner, gpc)Anything in ECC
Shopify webhooksLedger rows (source shopify), DSR requestsAds purposes from an e-mail opt-in
DSR handlerLedger rows (source dsr), DSR receiptsDelete ledger rows (they are the proof)
One-time import (CSV)Ledger rows (source import)Ads purposes, or anything newer than an existing row
ECC / middleware batchNothing: reads the entitlement viewConsent fields, in ECC or Xano
Merchant / Google exportNothing: reads entitlements and productsPersonal data into Merchant Center

Plan: Xano buildout

Status: Phases 1 to 3 are done; Phase 4 steps 1 to 4 are done (the generator, the four new tables, five columns on the consent log, two on the user table); steps 5 and 6 wait on real exports and the signer endpoint: cargo run --bin xano-buildout -- --workspace <id> --data-home <home>, tested by tests/xano.rs. The remaining Phase 4 steps change a live workspace and are applied one confirmed step at a time.

Everything is generated from the same map (site/ddic.json) as the Rust structs, the GraphQL schema and these pages, so the tables, the CSV headers and the docs can’t drift apart.

What Phase 3 changed

The dry run against the target workspace found most of the consent stack already in place:

Planned in Phase 1Already in the workspaceNow
A new consent ledgerAn append-only consent log, hash-chained and signed, written by the CRM Sync workerReused. Add the missing columns; rows go through the worker’s signer so the chain stays valid.
A consent entitlement functionA release gate every Google and Shopify payload must pass: latest decision wins, a tie revokes, no decision means deniedReused. One decision point. A second would disagree with it.
A customer tableThe storefront user table the gate keys on, with erasure and opt-out tagsReused. Add kunnr and shopify_customer_id.
A --hold KR flagA region policy table with a data home per countryReused. A person whose data home isn’t the workspace’s is held.
merchant_product, identity_link, dsr_request, dsr_receiptNothing equivalentCreated (step 2).

One rule follows from how the gate works: it reads consent category marketing as all three ad signals (ad storage, ad user data, ad personalization). So e-mail and SMS opt-ins are imported as categories newsletter (the worker’s own word for e-mail marketing) and sms, never marketing, and an e-mail opt-in can never open Customer Match. Shopify’s sale opt-out becomes the user’s opt-out tag, which the gate treats as a hard stop, not a consent row.

ECC export (DD03L + records) ─┐
Shopify customers (Admin API) ─┼─▶ xano-buildout ─▶ xano/tables/*.xs                 the 4 new tables
Region policy (snapshot)      ─┘                  ├▶ plan.json                        steps 2-6, with the column additions
                                                  ├▶ csv/storefront_users.csv         upserts, matched on e-mail
                                                  ├▶ csv/consent_records.csv          input for the consent signer
                                                  ├▶ csv/identity_link.csv, merchant_product.csv
                                                  ├▶ expected_release_decisions.csv   what the gate should answer
                                                  └▶ report.md                        what was skipped or held, and why

Phase 4

StepWhatChanges the workspace
1Reshape the generator to the existing tables (this page)No: built
2Create merchant_product, identity_link, dsr_request, dsr_receipt (each with a primary id and a unique idempotency_key; the last three point at the user table). Optional columns are nullable, so a missing price is null, never 0.Yes: done
3Add to the consent log: idempotency_key (unique), seq, gpc, expires_at, evidence_sha256. All optional and nullable: existing rows have none of them. Region, regime and banner version are not added: the log already keeps them in its systems_notified JSON. The chain hash and signature cover a fixed set (subject, category, action, consent ID, time, previous hash), so new columns don’t disturb them, and aren’t tamper-evident either.Yes: done
4Add to the user table: kunnr, shopify_customer_id (nullable, sensitive)Yes: done
5Import: users as upserts on e-mail (a blank field is left as is, tags are merged); identity links and products as inserts; consent rows one call at a time through the signer, oldest first. Needs a new admin-only worker endpoint that anchors and signs a backfill row for a known user with its historical time: no existing endpoint does.Yes
6Verify against expected_release_decisions.csv. A live gate call writes a ledger row, so verification uses verify- idempotency keys, or is checked offline.Only ledger rows

Phase 5: the session-to-order join (planned)

SAP never sees a shopper’s visit: its sessions belong to logged-in SAP users. What reaches SAP is the order, so the visit has to ride on the order. The join carries the consent session and the ad click from the landing page to the SAP sales order, so a confirmed sale can be reported to Google Ads against the click that led to it, and only if the release gate allows it.

landing ─▶ consent banner ─▶ add to cart ──────────▶ checkout ─▶ Shopify order ─▶ middleware ─▶ SAP sales order
gclid       session_id        cart attributes:                    customAttributes:              VBAK-BSTNK (or a Z field)
gbraid      (consent row)     _crm_session, _crm_click            _crm_session, _crm_click       = Shopify order ID
wbraid                         (only if ad_storage granted)
   │                                                                                                  │
   └─▶ visit_click (Xano): session_id → click IDs, landed_at ◀──── SAP confirms the sale ─────────────┘
                                                                     └─▶ conversion endpoint: order → session → click
                                                                         → release gate (google_ads_conversion) → export
StepWhereWhatRule
5.1CRM Sync worker, landing requestRead gclid / gbraid / wbraid from the landing URL; write one visit_click row: session_id, the click IDs, landed_at, regionStored only if ad_storage is granted for the session at that moment. Otherwise nothing is kept: Consent Mode’s own signals cover the denied case.
5.2Storefront, add to cartSet cart attributes _crm_session (the consent session_id) and _crm_click (the visit_click row’s key, not the raw click ID)Underscore-prefixed attributes are hidden from the shopper at checkout. Never a raw e-mail or click ID in the cart.
5.3ShopifyCart attributes become the order’s customAttributesNo code: Shopify copies them.
5.4Middleware (order to SAP)Keep writing the Shopify order ID to VBAK-BSTNK (or the Z field used today); carry nothing elseSAP holds the order reference only, never the session or the click.
5.5CRM Sync worker, on SAP confirmation (sale, return, cancellation)Look up the Shopify order’s _crm_click → visit_click → click IDs; call the existing conversion endpoint with the order ID, conversion_time from SAP, value and currencyThe endpoint already runs the release gate (google_ads_conversion) and the region policy, and stores the order reference only as an HMAC.
5.6XanoExpire visit_click rows after Google’s click-ID lookback (90 days)A click older than the window can’t be credited; keeping it serves nothing.

What this needs that doesn’t exist yet: the visit_click table (generated with the others when the step is approved), the worker’s landing and confirmation hooks, and the storefront’s cart attribute write. Nothing in it changes the consent log or the release gate, and SAP needs no change beyond the order reference it already carries.

Acceptance:

  • A session without ad_storage leaves no visit_click row, and its order carries no _crm_click.
  • An order whose shopper withdrew ad user data after the click is refused by the gate at confirmation time, not at the click.
  • A return or cancellation in SAP reaches Google as an adjustment against the same order reference.
  • No raw e-mail, click ID or session ID appears in SAP, in the order’s visible attributes, or in the export.

The CSVs

FileRows fromRules
storefront_users.csvECC customer (KNA1 + default e-mail in ADR6) and Shopify customersMatched on the normalised e-mail. One-time customer numbers are never a key. Deleted customers are left out. tags_add carries rejects_sale_of_data for Shopify’s dataSaleOptOut.
consent_records.csvShopify emailMarketingConsent / smsMarketingConsent (with consentUpdatedAt); the ECC consent tablesession_id (the consent log’s existing column) records the visit a decision came from; backfill rows have none, and today only the signed-in path writes it (the anonymous banner path writes it empty, which Phase 5 needs changed). Jurisdiction and regime go into systems_notified. Categories newsletter, sms; an ECC ads row becomes marketing only as a withdrawal: imports never grant ads. Rows without a time are skipped (the gate ignores them anyway). The ECC ZZ_MKT_OPTIN flag is never imported.
identity_link.csvPeople with both a KUNNR and a Shopify IDuser_email is resolved to the user’s ID on import.
merchant_product.csvThe converter in this book over the ECC exportNo personal data.

Every row carries an idempotency key, so a replayed file writes nothing the second time. The CSVs, plan.json and report.md are written to xano/ but not committed: from real exports they hold personal data.

On the fixtures the run writes 2 users, 1 identity link, 4 consent rows and 1 product, holds the KR customer (data home kr, not the workspace’s us) with all of their rows, and reports the ECC flag, the ECC ads grant (its later withdrawal is imported), the SMS state with no decision, and the sale opt-out turned into a tag.

Expected decisions

expected_release_decisions.csv is computed by an offline copy of the gate’s rules (src/release_gate.rs, tested on its own): hard stops first (erasure; the opt-out tag refuses the ad signals), then per signal the latest timed decision wins, a tie revokes, test sources are ignored, and no decision means denied. For the sample customer with an e-mail opt-in, Customer Match is still refused: the opt-in is category newsletter, which covers no ad signal. The live gate is the authority; the copy follows it.

Open decisions

  • Who runs the signer import (step 5), and from where.
  • Retention per purpose and regime (sets expires_at); the gate doesn’t check expiry yet.
  • Whether the gate should hold ad user data and ad personalization separately: marketing grants or revokes them together.
  • Whether B2B contact persons are in scope for the first import.
  • Phase 5: which middleware carries the Shopify order ID into SAP today, and in which field (BSTNK or a Z field), so the confirmation hook can find the order.

ECC direct to Google: what it replaces

Converting ECC’s own data straight into Google Merchant Center’s shape takes S/4HANA off the path to Google. It does not replace the S/4HANA upgrade, and it does not replace consent data. It makes the consent layer more important, not less.

What it removes

  • S/4HANA as a prerequisite for Google commerce. Merchant Center doesn’t care which ERP the data came from. MARA, MAKT, MARM, A004, KONP and MARD already hold title, GTIN, price, units and stock, and the Google Merchant Center page maps them attribute by attribute. Listing products on Google doesn’t wait for S/4HANA or need SAP’s commerce add-ons.
  • Commerce from the upgrade’s scope. If feeds to Google were one of the reasons to upgrade, that reason goes away, and the upgrade can be planned on its own schedule.

What it doesn’t remove

  • The S/4HANA upgrade. That is driven by the end of ECC support (standard maintenance ends at the end of 2027, paid extended maintenance runs to 2030), and by finance, tax and security patches. A product feed changes none of that. What it does is decouple the two: when ECC is replaced, only the feed’s source changes. The Merchant API shape, the offer IDs and Google’s product history stay the same.
  • Consent data. ECC has no consent model. It has flags such as ZZ_MKT_OPTIN and tables such as /ACME/CONSENT, with no time, purpose, source, evidence or withdrawal. Consent gaps lists each missing piece. S/4HANA doesn’t add one either: SAP’s answer is a separately licensed product. Here the CRM Sync gap fill and the Xano consent log fill that gap.

A product feed needs no consent: it is catalog data, with no personal data in it. Once the same pipe carries customer data (KNA1 and ADR6 for Customer Match, enhanced conversions, remarketing), a direct ECC → Google link would skip consent entirely. So the two flows are kept apart:

Products:  ECC export ─▶ converter (src/merchant.rs) ─▶ Xano merchant_product ─▶ Merchant API productInputs
People:    ECC export ─▶ Xano user table ─▶ release gate ─▶ Google (Customer Match, enhanced conversions)

Nothing about a person reaches Google without passing the release gate. ECC’s opt-in flags are inputs to the gate’s evidence, never the decision.

What a direct path still has to handle

IssueWhyWhere it is handled
FreshnessECC exports in batches. If the price or stock in the feed doesn’t match the product page, Google disapproves the offer.A refresh window per attribute; versionNumber on each insert so an older batch can’t overwrite a newer one.
A page to buy onMerchant Center needs a product page that can check out, or an agentic checkout. ECC has neither.The storefront, not the ERP.
Prior priceA sale price in the EU must show the lowest price of the previous 30 days (Omnibus), per market.Price history per market, kept outside ECC’s condition records.

When markets multiply: the domain is not the key

A direct path works for one market. The second market is where it breaks, and almost never because of ECC. It breaks when something downstream uses the storefront domain, a URL or a product handle as an identity key. A domain is a routing and presentation attribute. Identity lives in keys that don’t change when a market launches: the *.myshopify.com shop handle, the Shopify GID, MATNR and the GTIN.

The TLD, URL and channel side of this (ccTLD vs subfolder, hreflang, Merchant feed labels, Meta and Amazon) is covered in the TLD & Namespace Strategy book. This section covers what that book doesn’t: the ECC-to-Shopify gaps, and the revenue and WMS risk they carry.

One registry row per market

The market is looked up from a registry, never inferred from the host. Every URL is computed from the row plus an immutable key; no system stores a URL as a key.

{
  "market": "GB",
  "host": "brand.com", "pathPrefix": "/en-gb",
  "contentLanguage": "en", "feedLabel": "GB", "currency": "GBP",
  "shop": "brand-us.myshopify.com",
  "sap": { "vkorg": "2000", "vtweg": "10", "spart": "00" },
  "consentJurisdiction": "UK-GDPR",
  "live": false
}

live is the launch gate. It flips only when the checks in the risk register below pass.

ECC ↔ Shopify gaps

A gap is a place where ECC and Shopify name the same thing differently, at a different grain, or not at all.

GapECCShopifyWhat breaks when a market is addedFix
G1 Market ≠ sales areaSales area: VKORG + VTWEG + SPARTMarketMiddleware infers the sales area from the domain and posts a new market’s orders to the wrong sales orgRegistry maps market → sales area explicitly
G2 GrainMATNR (CHAR 18 in ECC) = one variantProduct groups variantsA second store or a translation plugin forks the grouping, and itemGroupId splitsKey on MATNR ↔ variant GID ↔ SKU; the PIM owns the grouping key
G3 One GTIN vs manyMARM-EAN11 per unit (each, case, pallet)One barcode per variantA case GTIN reaches Google, or an each GTIN reaches the WMSEach consumer reads its own unit (below)
G4 Price authorityA004/KONP per sales area, usually netMarket price list, often tax-inclusiveA market goes live before its conditions exist and falls back to a default or FX pricelive stays false until condition records exist
G5 Location grainPlant + storage location (T001W, MARD), WM warehouseLocation GIDInventory pushes keyed by location name break when a node is addedVersioned WERKS/LGORT ↔ location GID table
G6 Order identityVBAK-VBELN; customer PO in VBAK-BSTKDOrder GID; name #1001 repeats across storesBSTKD deduped on the order name collides across stores; webhook retries duplicate ordersBSTKD = {shop}:{order GID}, deduped with the webhook ID
G7 Customer and consentKNA1, one-time (CPD) accounts; no consent modelCustomer GID, marketing consentA new origin starts with empty consent and ECC never sees itConsent keyed on customer GID + jurisdiction, in the release gate, never ECC
G8 Localized textMAKT per SPRASTranslations and localized handlesAny join on handle breaks per languageHandles are output only; joins use GID or MATNR
G9 URL constructionNone: ECC has no URLPrimary + market domainsThe feed’s link is built in middleware with brand.com hardcodedOne url(market, gid) builder for every feed and the edge Worker

ECC has no concept of a URL. Every URL in an ECC-sourced feed was built by middleware, which is exactly where a hardcoded host ends up.

G3 in this repo

merchant::convert already reads the base unit’s MARM row (MEINH == MARA-MEINS) and validates it with merchant::gtin, so the Merchant feed gets the each-unit GTIN. A WMS or EDI feed must read the case row instead. Keying the GTINs by unit makes that choice explicit:

#![allow(unused)]
fn main() {
use std::collections::BTreeMap;

/// MARM-MEINH values the integration reads.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum Uom { Ea, Cs, Pl }

pub struct Gtins(BTreeMap<Uom, String>);

impl Gtins {
    /// Google and the storefront: the unit a shopper buys.
    pub fn consumer(&self) -> Option<&str> { self.0.get(&Uom::Ea).map(String::as_str) }
    /// The WMS and EDI: the unit that is picked and shipped.
    pub fn case(&self) -> Option<&str> { self.0.get(&Uom::Cs).map(String::as_str) }
}
}

Every value goes through merchant::gtin before it enters the map, so a bad check digit, an in-store number (NUMTP IE) or a restricted prefix never reaches either consumer.

Worked example: launching the UK

The fragile way: a translation plugin publishes uk.brand.com. The feed builds brand.com/products/ + handle, and UK handles 404 (G8, G9). A UK order maps to VKORG 1000 because no 2000 mapping exists (G1, G4). The WMS gets the case GTIN where it expects the each GTIN (G3). Consent captured on the new origin never reaches the customer record (G7).

The safe way: add a GB row (VKORG 2000, GBP, /en-gb subfolder through Shopify Markets, live: false). Put the plugin in subdirectory mode. Gate live on A004/KONP for VKORG 2000. None of the failures above can happen, because none of them read the host.

Market prices and FX: one price, read everywhere

A market price can come from three places, and a fixed price wins over everything else. Google then checks that price against the landing page from anywhere in the world. So every market advertised with a local-currency feed needs a deterministic price.

How Shopify derives a market price

LayerWhat it doesNote
Automatic conversionA dynamic rate Shopify updates to real-time rates, or a manual fixed rateAt checkout, automatic conversion uses Shopify’s rates, plus its conversion fee where that applies
Adjustment and roundingA price list adds a percentage on top of FX, then roundsShopify’s example: $20 × 1.3 FX × 1.2 (+20%) = $31.20, rounded to $31.99 by a 0.99 rule. Rounding uses Shopify’s per-currency defaults and can’t be customized
Fixed priceA price-list price already in the target currencyApplies regardless of FX and rounding

What Google requires

OptionHow it worksTrade-off
Local-currency feedSubmit GBP prices for the UKThe feed currency must match the landing page, for every viewer, wherever Google crawls from
Google’s currency conversionOne base-currency feed with extra countries; Google shows its converted price next to yoursFeed, page and checkout must still agree in your currency. Google uses Google Finance rates, and this usually earns fewer eligible impressions than a dedicated feed

If the numbers drift, Merchant Center may update the product’s price to what it finds on the landing page, or disapprove the item.

Where FX breaks the match

  • Dynamic rates drift daily. A feed generated at yesterday’s rate disagrees with today’s page. A market on dynamic FX needs its feed resynced at least as often as the rate changes.
  • IP-based currency switching. The most common failure. Google checks the page from any location, while Shopify Markets switches the page currency by visitor IP, so a local-currency feed is rejected. The fix is a market URL (/en-gb) in the feed link, so the URL sets the currency, not geolocation. This is G9 again.
  • Tax display. Location-based VAT settings in EU and UK stores show the crawler a net or gross price depending on where it seems to come from.
  • Structured data and shipping. JSON-LD offers.price must match the feed and page for every product ID, and shipping rates must use the feed’s currency for each country.

The ECC angle: three rate sources

Rate sourceDrives
ECC exchange rates (TCURR)Invoicing and financial postings
Shopify market FXStorefront and checkout
Google FinanceGoogle’s converted ad price

Each gives a slightly different number, so G4 covers rate authority as well as price authority. (TCURR holds the rates; TCURX, which merchant::to_money already reads, holds only the currency’s decimals.)

Recommended pattern

  1. Fixed price lists for every market advertised with a local-currency feed. Source them from A004/KONP for the market’s sales area, or from a nightly job using one agreed rate source plus your own rounding. Feed, page, JSON-LD and the ECC invoice then agree.
  2. Dynamic FX only for markets you don’t advertise locally. Let Google’s conversion handle those ads off the base-currency feed.
  3. Build the feed from Shopify’s contextual pricing. The Admin API returns the price of a variant in a given market context. Write that exact value to the Merchant API (price.amountMicros + currencyCode) instead of recomputing FX in middleware.
  4. Register FX in the market registry. The feed builder and the edge Worker read these fields, so a market can’t be advertised in local currency unless its prices are fixed.
{
  "market": "GB",
  "fxMode": "fixed",
  "rateSource": "KONP",
  "taxDisplay": "inclusive",
  "localCurrencyFeed": true
}

Revenue and WMS risk register

Thirteen risks, sorted fastest first; IDs stay stable as rows are added. Five bite on the first order. Assign each an owner before a registry row goes live.

IDRiskGapChannel hitSpeedDetection signalPre-launch check
R1Orders post to the wrong sales orgG1Order captureImmediateOrder errors by VKORGRegistry row has VKORG, VTWEG, SPART
R2Price falls back to a default or FX valueG4Margin, Shopping disapprovalsImmediatePrice-mismatch alerts; price disapprovalsA004/KONP exist for the sales area
R3Duplicate sales orders from name collisions or webhook retriesG6Overshipment, refundsImmediateDuplicate BSTKD countBSTKD = {shop}:{order GID} + webhook ID
R4Middleware calls the Shopify Admin API from an IP outside a public app’s allowlist and gets 403HostOrder reads, inventory pushes, conversionsImmediate, from 2026-11-20403 rate per integrationDev Dashboard traffic test passes for every caller
R5A webhook, OAuth, CORS or AS2 endpoint still points at the old hostG9Orders, EDIImmediateWebhook failure rate; AS2 MDN failuresNo hardcoded host strings left
R6Feed link doesn’t match the claimed site, or 404sG9Shopping ads, free listingsHours to daysDisapprovals by feed label; 404 rateCrawl every feed link: 200 on the claimed site
R13Feed price drifts from the page: dynamic FX, IP-based currency or location-based VATG4, G9Shopping ads, free listingsHours to daysMerchant Center price updates and price-mismatch disapprovalsfxMode: fixed for every locally advertised market; feed link carries the market path
R7Case GTIN where the each GTIN is expected, or the reverseG3Fulfillment, refunds, ShoppingDaysWMS unmatched-GTIN count; EDI 997 rejectsEvery item has valid EA and CS GTINs
R8A Shopify location isn’t mapped to WERKS/LGORTG5Oversell, stockoutsDaysInventory sync errors per locationEvery location GID maps in the registry
R9Joins on a localized handle break per languageG2, G8WMS SKU match, itemGroupIdDaysUnmatched-SKU count; item-group splitsNo join keyed on a handle or URL
R10Consent starts empty on the new origin, or never reaches the gateG7Compliance, email revenueWeeks, high severityConsent coverage per marketConsent keyed on customer GID + jurisdiction
R11Cookie and attribution reset on a new registrable domainHostPaid media (CPA, ROAS)Indirect, weeksGA4 self-referrals; consent rate per hostSubfolders, or cross-domain linking set up
R12Re-indexing, hreflang conflicts, redirect chainsG9Organic search, AEOGradual, weeksIndexed pages; rank on top revenue URLsCrawl confirms one-hop 301s

Sizing it

revenue at risk = baseline revenue per day × P(failure) × impairment while failing × days to detect and fix

Detection time is the term monitoring changes most: it moves from days to hours. So compare the expected loss with and without the detection signals above. For R1–R3 and R7–R8, add refunds, chargebacks, reships and trading-partner EDI chargebacks, which the formula misses.

In one line

ECC → Merchant through Xano gets products onto Google now, keeps them there through the S/4HANA migration, and keeps consent in a system built for it. It doesn’t avoid the upgrade; it makes it smaller, safer and no longer a commerce deadline.

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.

An alternative to a full S/4HANA upgrade

A full S/4HANA programme usually carries more than the ERP. Commerce feeds, the customer 360, consent and audiences move with it, often onto SAP’s add-ons or onto Salesforce. This page describes the other route: move the data that faces customers and Google out of ECC into Xano and Cloudflare now, and leave finance and logistics for the ERP migration.

It is an alternative to the scope of the upgrade, not to the upgrade itself. ECC support still ends, and FI/CO, MM, SD pricing and tax still need a supported ERP.

What moves from ECC to Xano and Cloudflare, and what it replaces in S/4HANA and Salesforce: products, customers, consent, orders and ads, and privacy requests, row by row. Below, the connections: Consent Mode v2 in the browser, the session ID through CRM Sync and Shopify to the ECC order, the release gate before Google Ads, Merchant Center without a gate, and BigQuery. Finance and logistics stay in ECC.

What moves

DataFrom ECCInto XanoAt the Cloudflare edgeRole it replaces
ProductsMARA, MAKT, MARM, MARD, A004 / KONPmerchant_product, in the Merchant API shapeMerchant feed sender (planned)Commerce catalog and feeds
CustomersKNA1, ADR6, ADRC, KNVVThe user table and identity_linkCRM Sync links visitor, Shopify customer and KUNNRCustomer 360 for marketing
ConsentZZ_MKT_OPTIN, /ACME/CONSENT, as evidence onlyThe consent log and the release gateCRM Sync: banner, region, GPC, signerConsent and preference management
Orders and adsVBAK / VBAP, with the Shopify order ID in BSTNKThe session-to-order join (planned)Conversion endpoint, behind the release gateAudiences and attribution
Privacy requestsCDHDR / CDPOS change historydsr_request, dsr_receiptCRM Sync fans each request outPrivacy request tooling

Orders themselves don’t move: the order stays in ECC, and only its reference rides to Google. ECC direct to Google explains why the product and people flows are kept apart.

One session ID ties the browser’s consent to the Shopify order and the ECC order. Nothing about a person reaches Google before the release gate.

StepWhereWhat
1BrowserConsent Mode v2 sets its default per region before any tag loads (denied where opt-in applies), then updates on the shopper’s choice: ad_storage, analytics_storage, ad_user_data, ad_personalization.
2Cloudflare: CRM Sync workerIssues the session_id and writes the consent row to Xano. Keeps the ad click (gclid, gbraid, wbraid) in visit_click only if ad_storage is granted.
3ShopifyCart attributes _crm_session and _crm_click (a key, never the raw click ID) become the order’s customAttributes. The storefront reads the Customer Privacy API.
4ECCMiddleware writes the Shopify order ID to VBAK-BSTNK. ECC never holds the session, the click or the e-mail. SAP confirms the sale, return or cancellation.
5Xano: release gateOn SAP’s confirmation, order → session → click, then the gate reads the person’s consent: latest decision wins, a tie revokes, no decision means denied.
DestinationThrough the gate?What goes
Google AdsYesOffline conversions against the click; Customer Match with ad_user_data and ad_personalization per person; returns as adjustments.
Google Merchant CenterNo: no personal dataProducts from merchant_product. versionNumber keeps an older batch from overwriting a newer one.
BigQuery, dataset crm_usStreamed by CRM Syncconsent_log with changed rows only (a consent history, not a poll trace) and channel_revenue for Shopify orders. Per-market datasets are added as markets are.

Steps 2 to 5 for the ad click are the session-to-order join in Plan: Xano buildout, which is planned, not live.

Benefits

  • Google and Shopify now, not after the migration. Products reach Merchant Center from the ECC data that exists today. Nothing waits for a go-live date.
  • A smaller S/4HANA project. Catalog content, consent, identity and audiences are out of scope. The migration is the finance and logistics core, which is the part SAP’s support dates actually force.
  • The commerce side doesn’t notice the migration. Offer IDs, Google’s product history, the consent log and the identity links all live outside the ERP. When ECC is replaced, only the source of the mapping changes. Most of the tables used here keep their names in S/4HANA (MARA, MAKT, KNA1, VBAK, VBAP, KONP), and those that don’t, such as MARD, are read through compatibility views. This book is generated from the DD03L export, so an S/4HANA export regenerates it.
  • Fewer add-on licences for these roles. The roles in the diagram don’t need a separate consent product, a separate customer data platform or a second CRM. What each would cost is outside this book.
  • One consent decision. Every payload to Google passes one release gate, reading one append-only, hash-chained log. Two systems can’t disagree about the same person, and the log is the evidence when a regulator asks.
  • The facts stay fixed. Identifiers, amounts, units, dates and stock are converted by fixed, tested rules (src/merchant.rs, tests/). Nothing generated rewrites them, in ECC or after it.

The alternatives

RouteWhat it meansWhen Google and consent workWhat to weigh
Full S/4HANA with SAP’s add-onsERP, commerce, customer data and consent move together, onto S/4HANA and SAP’s commerce and consent productsAt go-liveThe largest scope, one go-live date for everything, and add-on licences
S/4HANA plus SalesforceERP onto S/4HANA; customers, consent and audiences onto SalesforceAt go-live, plus the CRM integrationTwo vendors’ data models for the same person, and an integration between them
ECC plus Xano and Cloudflare now, S/4HANA core laterThe route on this pageNowA layer to run alongside ECC; the ERP migration still has to happen
Stay on ECC longerPaid extended maintenance (to 2030) or third-party supportOnly if a layer like this one is addedSupport cost and a fixed horizon; the layer works the same either way

The third and fourth routes combine: the layer doesn’t depend on when, or whether, the ERP moves.

Substitutes at the edge

Without an S/4HANA upgrade, and without buying a server-based application, ECC can stay as it is while the front ends change. Cloudflare Workers run the Rust gate compiled to WebAssembly in front of ECC. Each modern front end is a substitute that plugs into that one gate, so it can be swapped without touching ECC or the rules.

 Front ends (substitutes, swappable)
 Fiori-style UI5 app · AEM page or edge function · Xano + CRM plugin · a form
                    │
                    ▼
 Cloudflare: Workers + the Rust gate (WebAssembly)
   verify · parse into typed records · decide (consent, purpose, region) · receipt
                    │
     ┌──────────────┼───────────────────┐
     ▼              ▼                   ▼
 ECC (unchanged)   Xano (system of      Shopify · Google · BigQuery
 via a tunnel →    record: consent,     (destinations, after the gate)
 OData / RFC /     ledger, crosswalk)
 IDoc, read-mostly
SubstituteReplacesHow it connectsCatch
Fiori-style UI5 app at the edgeNew S/4HANA Fiori appsStatic UI5 served by a Worker, calling ECC’s OData services (SAP Gateway) through the gateECC has fewer, older OData services than S/4HANA; some screens need a custom service or a read model in Xano
AEM page or AEM edge functionA commerce or content front end tied to the ERP upgradeAEM renders; the gate decides what data and which tags reach itAdobe’s edge features differ by AEM product and licence: check what is licensed
Xano connected to BAU systems or a CRM pluginNew S/4HANA objects, a CDP or a new CRMXano holds consent, the ledger and the crosswalk; plugins read through the gateXano becomes core infrastructure: it needs an owner, backups and a region per regime
A formA custom ABAP transaction or a portalA Worker validates it, the gate decides, Xano records it; ECC receives a document only if it truly needs oneEvery document written to ECC counts under Digital Access

Why it holds without an upgrade

  • ECC stays the source of identity and blocking. Its core doesn’t change, and consent never lives in it (Consent gaps).
  • The rules travel as one crate. Rust compiled to WebAssembly runs in the Worker, browser islands, Shopify Functions and batch jobs, with one owner per decision (Parsing at the gate).
  • ECC is reached without opening it. A tunnel from the ECC network out to Cloudflare (for example Cloudflare Tunnel) means no inbound ports; the gate is the only route in.
  • Substitutes are swappable. Fiori, AEM, a Xano screen and a form all call the same gate. Changing the front end changes nothing in ECC or in the rules.

Conditions to state plainly

  1. Read-mostly. Reading ECC carries little exposure under Digital Access; orders, returns or form submissions written back into ECC are counted. Settle the licence model first (Licensing penalties by flow).
  2. ECC’s support clock still runs. This buys time and moves value out of ECC; it does not extend ECC’s maintenance (see below).
  3. SAP doesn’t support the edge layer. The gate, the Worker and Xano are yours to run: each needs an owner, an availability target and a defined failure mode (Function gating).
  4. ECC’s interfaces set the limit. Data with no OData service, RFC module or IDoc needs one built in ECC: ABAP work.
  5. Each platform’s own rules still apply. Shopify’s IP allowlist and expiring tokens, and the exempt, permanent custom-app tokens on ERP links (Shopify’s deadlines).

The rule: ECC stays where it is, mostly read; Cloudflare and the Rust gate sit in front; consent and decisions live in Xano; front ends are substitutes that all call the same gate; and every write back to ECC is a licence question settled before it ships.

What this doesn’t replace

  • The ERP. FI/CO, MM postings and inventory, SD pricing conditions, tax and logistics stay in ECC until they move to S/4HANA or another ERP.
  • The support deadline. Standard maintenance for ECC ends at the end of 2027; paid extended maintenance runs to 2030.
  • The consent check for people. Customer data reaches Google only through the release gate. ECC’s opt-in flags are evidence for it, never the decision.
  • Work still to be built. The Merchant feed sender and the session-to-order join are planned, not live. See Plan: Xano buildout.

Function gating across clouds

Once data moves from SAP on AWS or Azure to Shopify, Cloudflare and Google Cloud, ERP is no longer the hub. In a single-ERP estate SAP’s batch schedule was the control; spread across clouds, the only shared point is the release gate. Every flow (the Merchant feed, a BigQuery segment, an audience, an agent call) now depends on it being up, current, and the same everywhere. No cloud provider supplies that gate: each has its own functions, identity, logs and residency controls, and the decision falls between them.

 AWS / Azure                  Cloudflare                     Google Cloud / Shopify
 SAP ECC or S/4 (RISE)  ──▶   Workers (edge, consent)  ──▶   BigQuery, Merchant, Ads
 IDoc / RFC / CSV             Xano release gate              Shopify Admin API, Shopify Functions
         └─────────────── every hop asks the gate ───────────────┘

The dependency gaps

GapWhat goes wrongWhat closes it
AvailabilityThe gate is a single point of failure for every exportA failure mode per purpose: fail closed for ads and audiences; order fulfilment (the contract) is never gated
Freshness at the edgeConsent cached at the edge outlives a withdrawal. Cloudflare KV is eventually consistent: a write can take about 60 seconds to reach every locationRevocations read from a strongly consistent store (a Durable Object, or Xano live); cache only grants, with a short expiry
Identity across cloudsAWS IAM, Microsoft Entra, Google Cloud IAM and Shopify app tokens don’t trust each other, so secrets get copied into eachWorkload identity federation and short-lived tokens; no long-lived keys stored per cloud
The rule forksThe same rule is rewritten for Lambda, Azure Functions, Workers, Cloud Functions and Shopify Functions, and the copies driftCompile the rule once. Rust to WebAssembly runs in a Worker and in a Shopify Function, and as a native or Python module elsewhere (see Why 11ty, and when Astro)
Residency in transitBoth ends are in the EU, but a hop is processed in a US region or at a global edgeA route pinned per regime, checked per hop, not only per endpoint; regional processing settings at the edge
Retries and duplicatesA retry between clouds creates a second order, feed item or audience memberAn idempotency key made at the source and carried to every destination
Audit across cloudsEach cloud’s logs show only its own hop; no one can reconstruct a decisionOne correlation ID per decision, a receipt in the Xano ledger for every export, UTC timestamps throughout
Rule versionsA rule changes during a batch, and part of it is exported under the old oneEvery gate rule versioned; the version written on each receipt
EgressEvery hop between clouds is a data-transfer charge, worse with full extractsDeltas, not full tables; one region per regime
OwnershipEach cloud team owns its hop; no one owns the decisionOne owner for the gate and its rules; every platform calls it rather than reimplementing it

What this means for a programme

  • The licence position stays manageable. Porting SAP data out to Shopify, Cloudflare and Google Cloud is mostly reads, which carry little exposure under Digital Access. The gate doesn’t change that; any write back (orders, returns) still counts. See Licensing penalties by flow.
  • The gate is core infrastructure, not a feature. It needs an availability target, a defined failure mode, a release process and an owner, as the ERP had. Most programmes design the data movement and leave the gate for later; that is where they fail.
  • Consent stays where the gaps put it. The gate reads the append-only ledger described in Consent gaps; no cloud on the route holds its own copy of the decision.

The rule: moving SAP data across clouds removes ERP as the hub and makes the release gate the dependency every flow shares. Build it once, run it everywhere (Rust to WebAssembly), read consent from a store that is always current, keep each hop in its regime, and leave one receipt per decision.

Shopify’s 2026–27 token and allowlist deadlines

Shopify is tightening how public apps hold Admin API tokens, which puts two of the gaps above (identity and freshness) on a deadline. Both rules apply to public apps only; custom apps and apps a merchant creates in their own admin are exempt.

RuleWhat it doesDeadline (11:59 PM ET)Without it
IP allowlistLimits the networks an app’s Admin API tokens can be used from; other sources get 403Nov 12, 2026 for apps using bulk operations (bulkOperationRunQuery, bulkOperationRunMutation); Nov 20, 2026 for all other public appsBulk queries and mutations blocked (Nov 12); delisted from the App Store, no new installs, and flagged in the merchant’s Settings > Apps (Nov 20); merchants see a warning in the admin (Jan 15, 2027); Admin API requests fail (Apr 1, 2027). Existing installs keep working until Apr 1, 2027
Expiring offline tokensBackground (“offline”) access tokens last 1 hour and renew through a refresh token: 90 days when issued, replaced with a new one on every refreshJan 1, 2027 (the migration deadline; the later dates are notice for merchants, not extra time)Delisted and blocked from new installs, and flagged in the merchant’s Settings > Apps; existing installs keep working (Jan 1); merchants see a warning in the admin (Jan 15); Admin API requests with a non-expiring token return 403 (Apr 1, 2027)

New public apps have had to use expiring offline tokens since April 1, 2026; the Jan 1, 2027 date is for apps listed before that.

Sources: IP allowlists are now required for public apps, Restrict API access with an IP allowlist, Use expiring offline access tokens.

Allowlisting an app that runs on Cloudflare

Workers and Pages have no fixed outbound address, and Shopify’s network lookup (GeoLite) finds no ASN for Workers egress, so allowing Cloudflare’s ASN (13335) blocked every request in the Dev Dashboard’s test, even though Shopify’s guidance for serverless hosts is to allow the provider’s ASNs (requests with no ASN data are rejected). What works is Cloudflare’s published ranges (IPv4, IPv6), split to fit Shopify’s limits (IPv4 /16 or narrower, IPv6 /32 or narrower, up to 250 entries): 47 entries. Run the Dev Dashboard’s test against the last 30 days of traffic before turning enforcement on.

The limit of this: Cloudflare’s network is shared, so a leaked token still works from anyone’s Worker. It meets the rule; it is not isolation. Anything that calls Shopify from outside Cloudflare with the same token (Xano, a script, a webhook processor elsewhere) is blocked, so route those calls through the gate.

Not to be confused with network_access. The [network_access] section of shopify.app.toml, added in the same October 2026 security update, is a different control: it declares the outside hosts an app’s code loads from or sends requests to on store pages (allowed_sources, HTTPS origins) and the hosts shoppers can follow links to without an exit notice (allowed_navigation_hosts, up to 20). It applies once deployed with shopify app deploy. It does not restrict where Admin API tokens can be used; the IP allowlist is set only in the Dev Dashboard.

What the allowlist reaches in a Cloudflare and Xano stack

The allowlist applies to one direction only: calls into Shopify’s Admin API with a public app’s token. Calls from Shopify (webhooks), calls to Xano, Google or Webflow, and sign-in through Shopify’s Customer Account API are outside it. Checked on a live stack after enforcement was turned on:

PartIts path to ShopifyAffected?
PIM Sync (catalog, prices, translations to Webflow)Workers → Admin GraphQL, one request at a time. Reads page through products(first:, after:) with a cursor, plus single lookups (product, markets, locales, metafield definitions). Writes are ordinary mutations, one product or collection per call: productUpdate, metafieldsSet, translationsRegister, priceListFixedPricesAdd, productCreateMedia, publish and unpublish. It never calls bulkOperationRunQuery or bulkOperationRunMutationNo. Its Workers egress from Cloudflare, the token refresh that runs every 15 minutes kept succeeding, and the Nov 12 rule blocks only those two bulk mutations, which it doesn’t call
Webhooks into XanoShopify → Worker → XanoNo. Inbound to the app, not a call into the Admin API
The Configurator (one console in the Webflow Designer, a desktop app or a browser)Browser → Worker → ShopifyNo. The page never calls Shopify itself; the Worker does
BYO Cloudflare (a merchant’s own Cloudflare account)Their Worker → Admin APINo. Every Cloudflare account egresses from the same published ranges
BYO Xano (a merchant’s own Xano instance)Xano → Admin API directlyYes, with a public app’s token: 403. Route the call through a Worker, or allow the instance’s fixed outbound IP if its plan has one (a few entries at most, out of 250). Unaffected with the merchant’s own custom-app token, which is exempt
Login, Claims and Extras (see below)Worker → Customer Account API, Google, Xano; one Admin API lookup from the WorkerNo
Logs(none)Turn on Workers Logs ([observability] enabled = true in wrangler.toml) on every Worker that calls Shopify, so a 403 after enforcement can be searched rather than guessed at. Log shop domains and status codes, never tokens, secrets or a shopper’s email

The rule for BYO setups: Admin API calls with the public app’s token leave from Cloudflare. The merchant’s own Xano stays the system of record behind the Worker.

Login, TLS and /auth/me: Claims and Extras

TLS login. TLS (Transport Layer Security) is the encryption behind https://. A TLS login means every step of sign-in travels encrypted: the password or the OAuth code from the browser to Cloudflare’s edge, and the Worker’s own calls on to Xano, Google and Shopify. TLS protects the connection, not the identity: it stops anyone on the network reading or altering the login, but it doesn’t say who the person is. That is what the signed token does. Three separate controls, at three layers:

LayerControlAnswers
NetworkShopify’s IP allowlistIs this call coming from an allowed network?
TransportTLS (HTTPS)Can anyone read or change it on the way?
IdentityA signed session token (JWT), checked on every requestWho is this, and are they still allowed?

The login flow. A person signs in with email and password, Google, or Shopify’s Customer Account API (OpenID Connect, which is not covered by the Admin API allowlist). The Worker checks the result, links the identity to one person in Xano, and returns a signed session token. Logging out puts the token on a revocation list, so a copy left in a browser stops working at once rather than at expiry.

Claims. The facts about who the person is and which accounts are theirs, kept in Xano: the user ID, the linked provider identities (a Google subject ID, a Shopify customer ID), language and verified email. A login attaches to an existing person by email only when the inbox is proven.

Extras. The extra, per-person data a signed-in page may show beyond the claims, such as preferences and member-only content, kept in a separate Xano table so the claims stay minimal.

/auth/me. The endpoint the app calls on every open to ask “who is signed in?” It:

  1. reads the token from the Authorization: Bearer header and verifies its signature and expiry (401 if not);
  2. checks the person still exists and isn’t deleted, before anything writes (401 or 404 otherwise);
  3. reconciles the identities, linking a Google login and a Shopify customer to the same person; this is the one Admin API lookup in the flow, made by the Worker, so the allowlist passes it;
  4. returns logged_in, the user, the claims, the extras and the entitlement (what the person may do).

The entitlement it returns is a hint for the page, so it can hide controls the person can’t use. The Worker re-checks permissions on every request; nothing in the token or in /auth/me is trusted on its own.

Salt, hashing and encryption: what TLS doesn’t cover

TLS protects data while it moves: browser to Cloudflare, Worker to Xano, Worker to Shopify and Google. It does nothing for data once it’s stored. Four other controls cover that, and each one does a different job:

ControlDirectionUsed forIn this stack
TLSIn transitEvery connectionHTTPS from the browser to the Worker, and from the Worker to Xano, Shopify and Google
Salted password hashOne way: can be checked, never read backPasswordsThe Worker hashes; Xano stores only the salt and the hash
EncryptionTwo way: can be read back with the keyData the system must use again: files, configuration, tokensAES-GCM with 256-bit keys, under envelope encryption
Signed tokenChecked, not hiddenProving who a request is fromThe session token (JWT), signed with HMAC-SHA-256 using a secret only the Worker holds
Encryption at restStorageDisks and backupsThe cloud provider’s (Xano’s hosting, R2, KV)

What a salt is. A salt is a random value, different for every password, mixed in before hashing. Two people with the same password get different hashes, and a list of precomputed hashes for common passwords (a rainbow table) is useless, because each stored hash would need its own table. The salt is not secret; it is stored next to the hash. What it adds is that every password has to be attacked on its own.

How a password is stored here:

  1. The Worker generates a 16-byte random salt.
  2. It derives a 256-bit hash with PBKDF2-SHA-256 over 100,000 iterations. The iterations make each guess slow, so a stolen table of hashes is expensive to crack.
  3. Xano stores salt:hash. The password itself never reaches Xano, a log or a backup.
  4. At sign-in the Worker repeats the derivation with the stored salt and compares the result.

100,000 iterations is the maximum PBKDF2 allows in Cloudflare Workers, and below what OWASP currently recommends for PBKDF2-SHA-256 (600,000). Two ways to close the gap: a memory-hard hash (Argon2id, or bcrypt) compiled to WebAssembly in the Worker, or fewer passwords altogether, with sign-in through Google, Shopify or passkeys, where no password hash is stored at all.

Fail closed: the *sshole lesson. The OpenSSH bypass disclosed in November 2026 (sshhole.com) is a salt-and-hash bug. On musl-libc systems, crypt() returns * when it fails, a password over 256 characters makes it fail, and an account whose stored password is * (meaning “no password login”) then compares * with * and lets the login in. The rules that follow for any password check:

  • A failure is never a value that can match. If hashing fails, the check returns no; it never compares an error output.
  • A placeholder is never a hash. An empty field, * or ! means “no password”, and the check refuses before comparing. The check here returns no if the stored value doesn’t split into a salt and a hash.
  • Limit the input. Refuse passwords over a set length (for example 1,024 bytes) before hashing, rather than letting the hash function truncate or fail.
  • Compare in constant time (crypto.subtle.timingSafeEqual in Workers), so the time a comparison takes reveals nothing about how much of the hash matched.

Applying the rules: the password fix, test first

A review of this stack’s own sign-in against those four rules found two gaps. The stored-value check already failed closed, but the hash was compared as a string with ===, which stops at the first character that differs, and nothing limited the password’s length before the slow hash. The fix was written test first:

  1. The tests came first, and all 13 failed against the code as it was.
  2. One module (password.ts) replaced the inline functions, so the rules live in one place that can be tested on its own; signup, login and password reset all call it.
  3. All 13 passed, the full test gate ran before deploy, and an existing account signed in on production afterwards.
RuleBeforeAfterThe test that holds it
A placeholder is never a hashAn empty or one-part value returned noOnly a value of exactly the stored form (a 22-character salt, a colon, a 43-character hash) is considered at all*, !, '', :, null and others, each tried with a 300-character password, never verify; rows one character short or long are refused without being compared
A failure is never a value that can matchAn error while hashing would have thrownAny error is a refusal; a password that isn’t a string is refused, not crashed onNon-string passwords neither verify nor throw
Limit the inputNo upper limitAt most 1,024 bytes, counted in UTF-8 (a Korean character is 3 bytes), checked before any hashing; signup and reset say so, login answers “invalid credentials”1,025 bytes refused and 1,024 accepted; 342 three-byte characters (1,026 bytes) refused
Compare in constant timeString ===Byte comparison with crypto.subtle.timingSafeEqual in Workers, a constant-time loop elsewhere; empty values never matchCorrect for equal, first-byte, last-byte and different-length inputs; a static check that no string === remains
Existing passwords keep workingSame stored form: PBKDF2-SHA-256, 100,000 iterations, 16-byte saltA row hashed the old way still verifies, and a wrong password against it doesn’t

The one change a user could notice: a password longer than 1,024 bytes can no longer be set, and one set earlier would need a reset. The tests run in the deploy gate, so a later change that brings back a string comparison, an inline copy of the hashing, or a bare length check fails the build before it ships.

Envelope encryption for files. Each protected file (a 3D asset, for example) gets its own random 256-bit content key, which encrypts the file with AES-GCM; the ciphertext goes to R2. The content key is itself encrypted (“wrapped”) under a key-encryption key, derived with PBKDF2 from a master secret, a salt for that file and a key version. Only the wrapped key is stored, in KV. Rotating one file’s key re-wraps one small value instead of re-encrypting everything, and the master secret never leaves the Worker.

What Xano adds. Xano’s endpoints are HTTPS only, and its own password field type stores a hash rather than the password. Xano’s built-in authentication issues tokens encrypted as JWE, not merely signed. It also has security functions for hashing, HMAC and AES encryption, for teams that keep this logic inside Xano. Here the Worker does the hashing and the encryption, so Xano holds salts, hashes and ciphertext, and a copy of the Xano database on its own gives up no passwords and no plaintext files. Check your Xano plan’s settings for encryption at rest and backups.

The rule: TLS for the wire, a salted slow hash for passwords, encryption for anything that must be read back, a signature for identity, and every check failing closed.

mTLS: proving the caller is one of your machines

Ordinary TLS proves the server to the caller. Mutual TLS (mTLS) also makes the caller present a certificate you issued, checked during the TLS handshake, before a single request byte is read. It answers “is this one of my machines?” It does not answer who the person is, or whether a record can be trusted later. Those are other layers, and a stack needs each one for its own job:

LayerWhat it provesExample in this stack
mTLSThe connecting machine holds a certificate you issuedMuleSoft or SAP calling a B2B endpoint
Webhook HMACThe event really came from Shopify, for that apporders/paid to /webhooks/shopify
Bearer token (JWT)Which signed-in person is callingA buyer issuing a certificate at /attest
API keyWhich system or tenant is callingA Worker calling Xano
Signed certificate (Ed25519)A record was signed by your key and not changed since; anyone can check it laterLicense and attestation certificates, checked against /.well-known/jwks.json

Which platforms do what.

  • Cloudflare, inbound: API Shield checks client certificates at the edge. Every plan can use mTLS with a Cloudflare-managed certificate authority (CA); Enterprise can upload its own CAs. This is the mTLS for a MuleSoft-to-Cloudflare handoff.
  • Cloudflare, outbound: a Worker’s mTLS binding gives it a fetch() that presents a client certificate in the handshake. If the destination is itself proxied by Cloudflare, the call fails with a 520, so check where the destination is hosted first.
  • Xano: it can present a client certificate on outbound calls, but has no documented way to require one on its own endpoints. A Worker presenting a certificate to Xano would be checked by nobody, so keep calling Xano with its API key, and if something must reach Xano over mTLS, end the mTLS in front of it (Cloudflare, or a Rust gateway) and call Xano from there.

Where it fits. Put mTLS on the paths machines use, not on the storefront. For example, a /b2b/* path or a separate hostname for MuleSoft or SAP, with an API Shield rule requiring a valid client certificate and the existing API key still checked behind it. A stolen key alone then gets no one in, and a stolen certificate alone doesn’t either.

What mTLS does not do. It doesn’t map a certificate to a user or role (matching the certificate’s name to a caller is application logic), and it doesn’t revoke a certificate by itself: keep a revocation list (CRL) or use OCSP in the verifier.

On the IP allowlist. A Rust gateway on a static IP gives Shopify’s IP allowlist a single address to trust. That is tighter, but not required: Workers meet Shopify’s rule today by allowlisting Cloudflare’s published ranges (see “Allowlisting an app that runs on Cloudflare”), at the cost of trusting all of Cloudflare’s address space rather than one machine.

In Rust, Axum with rustls 0.23 ends mTLS like this. Leave out .allow_unauthenticated(), which would let callers without a certificate through. Tutorials written for rustls 0.21 (AllowAnyAuthenticatedClient, with_safe_defaults()) no longer compile.

#![allow(unused)]
fn main() {
use std::sync::Arc;
use axum_server::tls_rustls::RustlsConfig;
use rustls::server::WebPkiClientVerifier;

// client_ca_roots: the CA that issued your partners' certificates.
let verifier = WebPkiClientVerifier::builder(Arc::new(client_ca_roots)).build()?;
let config = rustls::ServerConfig::builder()
    .with_client_cert_verifier(verifier)
    .with_single_cert(server_certs, server_key)?;
axum_server::bind_rustls(addr, RustlsConfig::from_config(Arc::new(config)))
    .serve(app.into_make_service())
    .await?;
}

RuBAC compared with perimeter login (SAP role login)

Perimeter login decides access once, at the door. An SAP GUI logon is the familiar example: the user enters a client (the Client field, such as 400, chooses which company’s data set inside the system), a user name, a password and a logon language. Once past that screen, the user’s roles (built in transaction PFCG) decide what they can do. Each role carries authorization objects, such as S_TCODE for which transactions may run and field values such as a company code, and ABAP programs test them with AUTHORITY-CHECK. The roles are loaded into the user’s buffer at logon, so a role change generally takes effect at the next logon. The rest of the perimeter is the network around it: the VPN or the corporate network the SAP system sits inside.

That is RBAC (role-based access control): access follows the job title. It works inside one system with a known set of employees. It strains when the people are customers, partners and agents, when the permission has to follow a purchase or a consent rather than a job, and when the same permission must hold across WordPress, AEM, Salesforce, Webflow and Shopify at once.

RuBAC (rule-based access control) decides every request against rules over the current facts, not against a role handed out at login. A rule reads: this person may use pim.webflow if a license granting that term exists, hasn’t expired or been revoked, and consent for this purpose is in force in their region. The login only establishes who the person is; the entitlement register decides what they may do, each time they try.

Perimeter login (SAP roles, RBAC)RuBAC with an entitlement register
Where access is decidedOnce, at logon; then the session’s role bufferOn every request, by the Worker reading the register
What a permission isA role assigned to a user by an administratorA record: a license with its terms, granted by a purchase, an invitation or an admin, with a date and a proof
Who it’s forEmployees inside one systemCustomers, partners, merchants and AI agents, across several platforms
A change takes effectGenerally at the next logonOn the next request
RevocationRemove the role; open sessions keep the buffered authorizationsDelete or expire the record; the next request is refused
InputsUser, role, authorization object valuesIdentity plus the license terms, expiry, consent, region and the destination asked for
AuditChange documents on users and roles; security audit logGrant is an insert, revoke is a delete, audit is a select, each row with a timestamp and a receipt
Trust after loginThe session is trusted once it’s insideNothing is trusted on its own: not the token, not the page, not /auth/me
Across platformsEach system keeps its own rolesOne register; each platform renders and the Worker decides

How the two meet. An enterprise keeps SAP’s roles for employees working inside SAP; nothing here replaces them. What RuBAC adds sits outside the ERP: the permissions for people and agents who never get an SAP user, checked live through the same gate that checks consent. On an account page this shows as a list of licenses, each with its grant date, its terms (for example pim.sync, pim.webflow, pim.omnibus) and a proof link (a receipt that can be verified), beside an activity log of consent decisions. The login screen offers email, Shopify and Google; whichever is used, the same register answers.

One login, three ways in: email and password, Shopify, or Google. Any of them leads to the same person in the register.

The account page after sign-in. Each license row is a grant with its date, its terms and a verifiable proof; the activity log below records each consent decision and how it was made. A SAP logon screen has no equivalent of either: its roles are assigned behind the logon, and the user doesn’t see them.

The rule: perimeter login asks “are you inside?” once. RuBAC asks “may this person do this, now?” every time.

Which integrations the token rule reaches

The line that matters is public app or custom app, not how long a job runs.

IntegrationUsually connects asCoveredWho acts
Bulk import and export (Matrixify and similar)Public appYesThe vendor; the merchant may need to re-authorise
Fulfilment and warehouse (ShipHero, ShipBob and similar)Public appYesThe vendor
Email and CRM (Klaviyo and similar)Public appYesThe vendor
Loyalty and reviews appsPublic appYesThe vendor
Salesforce, SAP or NetSuite through middleware (Boomi, Celigo, MuleSoft, a custom connector)Often a custom app in the merchant’s admin, its static token pasted into the middlewareNo: exemptNo one is required to
The same middleware installed as a vendor’s public appPublic appYesThe vendor

The ERP link is the surprise. A custom-app token feeding SAP or Salesforce is exempt from both rules, so it never expires, works from anywhere and often can write orders and customers: frequently the most exposed credential in the store. Keep it read-mostly (see Licensing penalties by flow), hold it in one place behind the gate, and rotate it even though Shopify doesn’t force it.

How tokens worked before

Until expiring offline tokens, background tokens did not expire. An app’s token lasted until the app was uninstalled or the merchant revoked it, and expiry was not something anyone managed. (The Dev Dashboard is Shopify’s newer app-management console, replacing app management in the Partners Dashboard; WebAssembly belongs to Shopify Functions, covered below.)

EraHow an app got accessExpiryHow access ended
Private apps (deprecated around 2022)Created in the merchant’s admin: an API key and password sent with every requestNeverDelete the private app
Public app, OAuth offline tokenThe merchant approves scopes once; the app stores a permanent token in its own databaseNever, until uninstall, a revoke, or a scope change that needs re-approvalUninstall or revoke
Public app, OAuth online tokenTied to one logged-in staff member24 hours, or when that person logs out of the admin, whichever comes firstExpires on its own
Custom app (replaced private apps)The merchant creates the app and copies a static shpat_ token, shown onceNeverUninstall the custom app
Embedded app, token exchange (from around 2024)The app swaps the browser’s session token for an Admin API token, with no redirectOffline tokens from the exchange were still non-expiring at firstUninstall or revoke
Expiring offline token (required for public apps from Jan 1, 2027)An offline access token plus a refresh tokenAccess token 1 hour; refresh token 90 days when issued, replaced on every refreshLapses if unused; uninstall or revoke

The dates are approximate; Shopify phased each change in. What “management” meant before:

  • Storage was the app’s job. Each app kept its offline token in its own database, with no lifetime or rotation tooling from Shopify.
  • Rotation meant reinstalling. Rotating the app’s client secret changed signing (webhooks, for example), but stored offline tokens generally kept working. Replacing a token meant re-running OAuth or reinstalling.
  • No network limits. Before the allowlist, a leaked offline token worked from anywhere, indefinitely.
  • Monitoring was optional. Apps watched for 401s and deleted stored tokens on the app/uninstalled webhook.

Shopify Functions never held tokens. Functions run inside Shopify as WebAssembly (written in Rust or JavaScript), receive the data their input query asks for, and return a decision (a discount, a delivery option, a checkout validation). They make no network calls, so they were never part of the token problem, and they can’t ask the gate either: the gate’s decision has to be written beforehand where the Function reads it (see Parsing at the gate).

Why it matters now. Most long-running integrations were built when an offline token was permanent: they store one token and use it forever, with no refresh step. Moving to expiring tokens means each needs a refresh step, one place that refreshes, and a way to survive 90 quiet days. Custom-app ERP links skip all of it, because they are exempt, which is why they remain the most exposed credential in most stores.

Shopify and Google: both access tokens last one hour

The same design applies to both platforms, because both issue access tokens that last one hour:

Shopify Admin API (expiring offline token)Google APIs (OAuth 2.0: Ads, BigQuery, Merchant Center, YouTube)
Access token1 hour (expires_in 3600)1 hour (expires_in about 3599)
Refresh token90 days when issued; replaced on every refreshLong-lived and usually not replaced; it stops working when the user revokes access, after six months unused, when the user changes the password (for Gmail scopes), past the per-client limit of live refresh tokens, or after 7 days for an app whose consent screen is still in Testing
Server-to-server, no person presentClient credentials: a public app signs a JWT (RS256 or ES256) and gets a token of up to 1 hour, with no refresh token; a custom app on its own organization’s stores sends its client secret and gets 24 hoursA service account: the backend signs a JWT and gets a token of up to 1 hour, with no refresh token
A dead refresh token401 invalid_request; the merchant reopens the app400 invalid_grant; the user grants access again

So a job that pulls from Shopify and writes to BigQuery or Google Ads holds two one-hour tokens with different refresh rules. Give each its own owner in the job (the TokenOwner pattern below), refresh each before it expires, and never assume one’s lifetime from the other’s. Shopify’s rotating refresh token is the stricter of the two: two workers refreshing at once break it, which is not true of Google’s.

Signing in as the app: RS256 or ES256, not EdDSA

A background job with no merchant present (a nightly sync, a cron sweep) can get its own Admin token without a refresh token. Shopify has two versions of this, and which one an app gets depends on how it is distributed:

Custom app, stores in its own organizationPublic app, any store that installed it
What the app sendsclient_id and client_secretclient_id and a signed client_assertion (no secret)
Token lifetime24 hours (expires_in 86399)Up to 1 hour (expires_in 3599); read the value, don’t assume it
Refresh tokenNoneNone
Who can use itOnly when the app and the store belong to the same Shopify organizationAny store that has installed the app and approved its scopes

Shopify accepts two signing algorithms for the assertion: RS256 (RSA, 2048 to 8192 bits) and ES256 (EC, P-256). EdDSA (Ed25519) is not on the list. A design that labels its fallback “Ed25519 signer” should use ES256 instead. ES256 is the nearest equivalent: small keys and fast signing, and Cloudflare Workers’ WebCrypto supports it.

The request is a form post to https://{shop}.myshopify.com/admin/oauth/access_token:

grant_type=client_credentials
client_id=<app client ID>
client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer
client_assertion=<JWT signed with the app's private key>

The assertion is a short JWT that Shopify checks part by part:

PartValue
alg (header)RS256 or ES256, matching the registered key
kid (header)The ID of an active public key on the app
iss, subThe app’s client ID
audhttps://{shop}.myshopify.com/admin/oauth/access_token, the store’s permanent domain
iat, expNow, and at most 300 seconds later
jtiUnique; Shopify accepts each one once per app, across all stores

Because each jti is accepted once, sign a new assertion for every request, retries included. Don’t send a client secret, an Authorization: Basic header or a scope in the same request. The public key is registered as a JWK (with kid, alg and use: "sig") in the Dev Dashboard, under the app’s Settings → Credentials → Public keys. The dashboard does not accept PEM.

Why it matters for long-running work. For a public app this replaces the refresh-token chain. Each time it needs Shopify, the job signs a new assertion and gets a new one-hour token: there is no refresh token to store, rotate or lose, no 90-day expiry, and no dead refresh token that waits on the merchant to reconnect. What remains is the install itself: the store has to keep the app installed with its scopes approved.

Keep it apart from other signing keys. A platform that already signs its own documents (license certificates, attestations) with an Ed25519 key keeps that key for that purpose. The Shopify assertion key is a separate ES256 key per app: the private half held as a secret in the Worker, the public half in the Dev Dashboard, and a new kid on every rotation.

In Rust, with the jsonwebtoken, serde and uuid crates, the assertion is a few lines. shop is the permanent domain (example.myshopify.com) and pem the PKCS#8 private key:

#![allow(unused)]
fn main() {
use jsonwebtoken::{encode, Algorithm, EncodingKey, Header};
use serde::Serialize;

#[derive(Serialize)]
struct Assertion<'a> { iss: &'a str, sub: &'a str, aud: String, iat: u64, exp: u64, jti: String }

fn client_assertion(client_id: &str, shop: &str, kid: &str, pem: &[u8], now: u64) -> jsonwebtoken::errors::Result<String> {
    let mut header = Header::new(Algorithm::ES256); // RS256 also accepted; EdDSA is not
    header.kid = Some(kid.to_string());
    let claims = Assertion {
        iss: client_id, sub: client_id,
        aud: format!("https://{shop}/admin/oauth/access_token"),
        iat: now, exp: now + 60,              // at most 300 seconds
        jti: uuid::Uuid::new_v4().to_string(), // new for every request, retries included
    };
    encode(&header, &claims, &EncodingKey::from_ec_pem(pem)?)
}
}

Migrating stored tokens: the options

An app built the old way holds a database of permanent offline tokens: one per shop, no expiry date, no refresh token. Before Jan 1, 2027 it has five ways forward (migration guide):

#OptionMerchant actionBest for
1Exchange each stored token for an expiring pair: POST /admin/oauth/access_token with grant_type=urn:ietf:params:oauth:grant-type:token-exchange, the stored token as subject_token (type urn:shopify:params:oauth:token-type:offline-access-token), the same requested_token_type, and expiring=1NoneAny app with working stored tokens: the main path
2The template flag: future: { expiringOfflineAccessTokens: true } in shopify.server.ts, then shopify app deployNoneApps on Shopify’s Remix or React Router template, which then store and refresh the tokens itself
3Application-only access (client credentials)NoneBackground sync; no long-lived token stays in the database
4Re-authenticate when the merchant opens the app (token exchange with the session’s ID token)Opens the appShops whose stored token is already dead, or whose exchange returns invalid_subject_token
5A merchant-created custom appCreates it in the adminEnterprise setups; custom apps are exempt

Doing nothing: delisted with no new installs on Jan 1, 2027 (existing installs keep working); merchants warned on Jan 15; from Apr 1, 2027 every Admin API call with the old token returns 403 (“Non-expiring access tokens are no longer accepted for the Admin API”).

The database change behind option 1:

  • New columns per shop: access_token, access_expires_at (now plus expires_in), refresh_token, refresh_expires_at (90 days when issued), and a lock or version column.
  • Delete the old token once the exchange succeeds: migration permanently invalidates it for Admin API calls.
  • One shop at a time, never two workers on the same shop. If a response is lost, the same request within seven days returns the same pair.
  • Refresh dormant shops at least once every 90 days, or the next job needs the merchant.
  • Treat 401 invalid_request on refresh as final: mark the shop “reopen the app” instead of retrying.
  • Shopify’s pages don’t give a rate limit for exchanging many shops, or say whether migration can be undone. Assume it can’t, and pace the batch.

By integration type: Klaviyo, Gorgias and Sprinklr, Attentive, Matrixify

The names describe the shape of each integration. They are not a statement about any vendor’s readiness; most will have migrated or will migrate before the deadline.

Integration shapeWhat it does with the tokenWhat breaks firstPath
Klaviyo-style (email, marketing)Continuous background sync of customers, orders and catalog for thousands of shops; writes email consent backSync workers on many machines refresh the same shop at once and break each other’s refresh tokenOption 1 in a paced batch with one token owner per shop, or option 3 so nothing is stored
Gorgias / Sprinklr-style (helpdesk, social care)Agents look up orders and customers on demand and act (refund, cancel, change an address); background pulls tooA refund in the middle of a ticket fails on an expired tokenOption 1; refresh before any action if under five minutes remain. Enterprise setups on per-merchant custom apps (option 5) are exempt
Attentive-style (SMS)High-volume, two-way sync of SMS subscribers and consentA compliance gap, not just an outage: a consent write that gets 403 or 401 means an unsubscribe never reaches Shopify, and another tool may keep texting the personOption 1, plus a dead-letter queue for failed consent writes and a daily reconciliation of consent between the two systems
Matrixify-style (bulk import, export, platform migration)Jobs of several hours; occasional use; scheduled feeds; bulk operations for exports and large numbers of mutations for imports; runs on the vendor’s serversThe 90-day refresh token lapses between uses, and a long job outlives several one-hour tokensOption 1, plus a background refresh for dormant shops every 60 to 80 days, one token owner that import and export workers ask, and checkpoints with writes keyed by row. Option 3 for scheduled jobs

For a merchant before a large migration with a Matrixify-style tool:

  • Open the app shortly before the run, so a quiet connection gets a fresh token.
  • Split very large imports by collection or date range, so a failure costs one batch.
  • Keep the source files and a pre-import export, so a half-finished import can be rolled back.
  • After Apr 1, 2027, a 403 about non-expiring tokens means the vendor hasn’t migrated.
  • For a subscriber or customer migration, reconcile email and SMS consent afterwards: a partial failure can leave people with the wrong status.

The common point: the token change is a data-management change, not only an authentication change. Each shape needs one owner per credential, refresh before expiry, one shop at a time, writes that are safe to retry, and a list of shops that need the merchant. The Klaviyo- and Attentive-style shapes add reconciliation, so a consent withdrawal is never lost; the Matrixify-style shape adds refreshes for dormant shops and checkpoints, so a quiet connection or a long job isn’t.

Dead letters: when a write can’t land

Webhooks make a promise awkward to keep. The sender wants a quick 2xx; Shopify and Webflow retry a failure a few times and then may switch the subscription off. So most handlers answer 200 whatever happens. The risk is that 200 also means “done” to the sender, which never sends it again: if the write behind it failed, the work is gone and nothing records it.

A dead-letter queue closes that gap. Work that fails is set aside with its error, instead of being retried forever or dropped, and a scheduled job delivers it later. The name comes from the post office’s dead-letter office for mail that can’t be delivered.

StepWhat happens
1. The write failsA 401, rejected data (userErrors), a missing credential, or the other side unreachable. The write reports the failure; it doesn’t return quietly
2. Save before answeringThe work is stored with its error and the time of the first failure, keyed by what it is (the item, the person), so the same work failing twice is one entry. Then the handler answers 200
3. Retry on a scheduleA cron delivers what it can and deletes it; what still fails waits longer each time (15 minutes, doubling, up to 6 hours)
4. Newer winsA newer change that lands clears the older saved one; a change from the other system after the failure supersedes it, so old data never overwrites new
5. Don’t hammer a dead credentialA shop waiting for the merchant to reconnect is skipped until it’s reconnected. A dead-letter refresh is the same idea for tokens: a refresh token that returns 401 invalid_request is final, so the shop is marked, the work waits, and it’s replayed after the merchant reopens the app
6. Say what is lateAnything pending past a set time (24 hours here) is logged as overdue on every run, where someone will see it

Applying it: two webhook fixes, test first

The same review that found the password gaps found this one in two public apps of this stack. Both answered 200 on a failed write and kept nothing. Each fix was written test first: the tests failed against the live code, passed after the change, and the fix was deployed and merged.

Reviews app: privacy webhooksPIM sync: Webflow to Shopify edits
What was lostA customer data request, a customer erasure or a shop erasure that failed to reach the worker doing it. The failure was logged; Shopify was told 200 and never resentA Webflow CMS edit (description, tags, metafields, a collection’s title or publish state) whose Shopify write failed. Webflow was told {processed: true}; a failed collection was even recorded as synced
Why it mattersLegal: Shopify gives 30 days to answer a data request, and an erasure that silently didn’t happen reads like one that didData: the storefront and the CMS drift apart, and nobody knows which edits are missing
Saved asdsr:pending:<type>:<shop>:<customer>webflow_dlq:<itemId>, holding the newest version of the edit
Retried byA new cron, every 30 minutesThe existing 15-minute cron, right after it refreshes tokens, so an edit waiting on a token goes out in the same run
LateOVERDUE after 24 hours; PAST DEADLINE after 30 daysOVERDUE after 24 hours, noting when the shop needs the merchant to reconnect
Tests1211

The rule from both: a 200 to the sender is a promise that the work is either done or saved. Answering 200 without either is how data drops between intervals: between one webhook and the next cron, between a token dying and a merchant reconnecting, between a failure and someone reading the log.

Example: a nightly SAP load through a bulk loader, longer than an hour

A common pattern: SAP (ECC or S/4HANA) exports materials, prices and stock every night, and a Matrixify-style bulk loader writes them to Shopify as a bulk mutation. Shopify doesn’t name any loader in its announcements; the example is the shape, not a vendor. With 200,000 variants the load takes two to three hours, so it outlives at least two access tokens.

The point that makes it workable: a bulk operation runs on Shopify’s side. The token is needed only to start the job, to check on it, and to fetch the result; nothing calls the Admin API while Shopify is applying the rows. So the token has to be fresh at four moments, not for three hours straight.

Time (UTC)StepToken needed?What can go wrong
01:00SAP extracts the night’s changes (change pointers on MATMAS, condition records for prices, stock by plant) to a CSV or IDoc fileNo (SAP side)The extract runs while users are still changing prices: take a consistent cut-off time and record it
01:20The loader maps SAP fields to Shopify: MATNR to SKU and handle, MAKTX to title, KBETR and KONWA to price and currency; it writes a JSONL file, one line per productNoUnit and currency conversions; a MATNR with leading zeros becoming a different SKU
01:30stagedUploadsCreate, upload the JSONL, then bulkOperationRunMutation (for example with productSet)Yes: refresh first if under five minutes remainSince Nov 12, 2026, blocked if the call comes from a server outside the app’s IP allowlist
01:30 to 03:45Shopify applies the rows. The loader waits for the bulk_operations/finish webhook, or polls the operation’s statusYes, for each poll. The 01:30 token expired at 02:30Polling with the expired token gets 401. The poller must ask the token owner, not keep its own copy
03:45Download the result file: one line per input line, with any errorsOnly to read the operation’s result URLPer-line errors (a missing option value, an invalid price) don’t fail the whole job; they have to be read
04:00Retry only the failed lines as a second, smaller bulk operation; reconcile counts against SAP; save a checkpointYesA full rerun instead of a retry of the failures doubles the load and the risk

What keeps the nightly load safe:

  • One token owner for the shop, which the starter, the poller and the downloader all ask. Two of them refreshing at once breaks Shopify’s rotating refresh token.
  • A nightly load keeps the refresh token alive. Each night’s refresh resets the clock, so the 90-day expiry is a risk only when the loads stop (a migration pause, a holiday freeze).
  • Calls from the allowed network. Starting and polling must come from servers in the app’s allowlist: the loader vendor’s, or a Worker if you run the loader.
  • Writes keyed by SKU or handle (productSet with an identifier), so retrying a line updates the same product instead of creating a second one.
  • No overlap. If last night’s operation is still running when tonight’s starts, wait or skip; check the operation’s status first. Shopify limits how many bulk operations a shop can run at once (check the current limit for your API version).
  • A cut-off time and a checkpoint. Record which SAP extract each load applied, so the next night’s delta starts from the right point and an audit can say which SAP state the storefront showed.
  • Bulk scopes. Shopify’s Nov 5, 2026 update says bulk queries and bulk mutations will each need their own access scope. Apps that ran a bulk operation in the last 180 days get them granted automatically; a loader that has been idle longer has to request them.
  • The deadline. The same update’s summary says “November 11” for apps using bulk operations, while its body and table say November 12, 11:59 PM ET. Plan for the 11th.

Where it isn’t a bulk operation. Inventory by location, metafields written one at a time, or an importer that sends ordinary mutations row by row makes thousands of Admin API calls over the three hours. That load needs everything in Threads, tasks and async in a long-running Rust job: refresh during the run, a bounded queue, a cap on concurrent requests to stay inside Shopify’s rate limit, idempotent writes and checkpoints.

Shopify to Google Merchant Center: sync on change or morning updates

Once the night’s load reaches Shopify, the same products have to reach Google Merchant Center, which feeds Shopping ads, free listings and YouTube shopping. There are two ways to move them, and they fail differently.

Sync on changeMorning updates
HowA Shopify webhook (products/update, inventory_levels/update) reaches the Worker, which sends that one product to Google’s Merchant APIOne scheduled batch after the night’s load finishes and reconciles: a feed file Google fetches, or a batch of Merchant API calls
How fresh Google isMinutes after the changeUp to a day old by evening
A price or stock change at 14:00Reaches Google within minutesAds show the old price until tomorrow morning; Google can flag a mismatch with the landing page and disapprove the item
A 200,000-variant bulk load at 01:30Floods: each updated product can fire a webhook, so Google receives 200,000 single updates over three hours, against its API quotasOne batch after 04:00, built from the bulk operation’s result file
What Google sees mid-loadA half-loaded catalog: some products with new prices, some with oldOnly the finished, reconciled state
Retries and orderWebhooks can arrive late, twice or out of order; each update needs a timestamp check so an older one doesn’t overwrite a newer oneOne run, one checkpoint; easy to rerun
TokensThe Worker holds a Google token (one hour) and refreshes it all dayOne Google token for a short run
Best forPrice, sale price and availability: the fields that cause disapprovals and pricing-law problems when staleTitles, descriptions, images, categories, product attributes: the fields that change with the catalog, not by the minute

The usual answer is both, split by field:

 SAP nightly ─▶ bulk load to Shopify (01:30–03:45) ─▶ reconcile ─▶ morning batch to Merchant Center (04:15)
                                                                    all fields, from the result file

 Shopify during the day ─▶ webhook ─▶ Worker (the gate) ─▶ Merchant API, price and availability only
                                       ignores changes made by the bulk load itself
  • During the bulk load, pause the on-change path (or let the Worker ignore updates tagged as coming from the load), then send one batch from the result file. Otherwise Google gets the catalog half-finished and the quota is spent three hours early.
  • During the day, send only the fields that matter by the minute: price, sale price, availability. A merchandiser’s price change or a sell-out reaches Google in minutes.
  • One record decides. The Worker sends Google what the system of record (Xano, behind the gate) says, keyed by the same product ID the crosswalk assigned, not whatever field arrived last.
  • Keep every product refreshed within 30 days. Merchant Center lets products expire when nothing has updated them for 30 days, so a product that never changes still needs the morning batch to touch it.
  • Two one-hour tokens. The day path holds a Google token as well as Shopify’s; each gets its own owner and its own refresh, as in Shopify and Google: both access tokens last one hour.

Where Shopify’s own Google channel fits. The Google & YouTube app syncs Shopify products to Merchant Center on its own schedule, and suits a store whose catalog lives in Shopify. Where SAP owns the catalog and Shopify is one destination, the split above gives control over timing: which fields are live within minutes, and when the catalog as a whole changes. Use one path per field, never two writers for the same field.

The data layer. Merchant Center performance and product status also come back to BigQuery through the Merchant Center transfer, once a day. That is reporting, not sync: it shows what Google held yesterday, which is the check that the morning batch and the day path are doing their jobs (see Extending the data: BigQuery transfers).

Where long-running work breaks with expiring tokens

FailureWhyWhat closes it
A long paginated pull fails partwayThe access token lasts one hour, so a longer job outlives itRefresh during the job; prefer bulk operations, which run on Shopify’s side and need the token only to start and poll
A seasonal job can’t runA refresh token not used within 90 days expires (a quarterly reconciliation, a holiday fulfilment sync, a points-expiry run). Shopify then returns 401 with invalid_request, and the merchant has to reopen the appStore sessions for the refresh token’s full life, refresh at least once before day 90, and test seasonal jobs before they’re needed
Two workers break each otherEvery refresh returns a new refresh token. The old one stays usable only until the newer one is used, a new token is acquired, 30 days pass after its first use, or its 90-day expiry, whichever comes first. A worker still holding the old one then failsOne refresher per shop, with a lock; every other worker asks it for the current token and always stores the newest refresh token
Copies go staleThe token was copied into a warehouse, an iPaaS or XanoOne place refreshes; the others fetch from it, as every other decision goes through the gate
The refresh token is lostA failed write, a wiped session store, a migration that went wrongShopify’s October 2026 update adds client credentials for public apps: the backend signs a short-lived JWT with the app’s private key (its public key registered in the Dev Dashboard) and gets an access token for a store that has the app installed, valid up to one hour, with no refresh token. The migration guide still treats an invalid refresh token as “the merchant must reopen your app”, so confirm which path applies before relying on it

Where long jobs should run

A job that runs for more than an hour (a catalog load, an ERP reconciliation, a long import) raises two separate questions: where it runs, and how it keeps access. A server answers the first. It doesn’t answer the second: the access token still lasts one hour wherever the job runs, so a server job refreshes during the run like any other.

JobBest fitWhy
Large export or import of catalog or ordersShopify bulk operationsShopify runs the job; the token is needed only to start it, check on it and download the result
Hours of per-record work (transforms, ERP lookups, retries)A server, container or queue workerRuns as long as needed, keeps state in memory, and has a fixed outbound IP for the allowlist
A long job split into short stepsCloudflare Workflows, or Queues with Durable ObjectsEach step is short, retries on its own and gets the current token, so no run outlives a token
The gate, webhooks, the app proxy, short reads and writesCloudflare WorkersRequests take milliseconds to seconds; per-request CPU limits are in minutes, not hours
A vendor’s import tool you don’t controlThe vendor’s serversAsk how its long jobs refresh tokens and whether it uses bulk operations
 Cloudflare Worker (gate)  ── starts the job, decides consent, issues the receipt
        │
        ├─ small or medium:   Workflow steps on Cloudflare (each step gets the current token)
        ├─ catalog-sized:     a Shopify bulk operation (Shopify does the work)
        └─ hours of custom work: a server or queue worker (fixed IP, one token owner, checkpoints)
                                   │
                                   └─ reports back to the gate → receipt in Xano

Threads, tasks and async in a long-running Rust job

On a server, the Rust core runs long loads on Tokio, Rust’s most widely used async runtime. Its model, briefly:

  • Async tasks, not one thread each. async fn code pauses at each .await (a network call, a channel send) and lets other work run. Tokio runs thousands of these tasks on a small pool of OS threads, about one per CPU core.
  • tokio::spawn starts a background task; a JoinSet collects a group of them and reports each result, so a failure isn’t lost.
  • CPU-heavy work goes to spawn_blocking. Parsing a large page or converting ECC records holds a thread for a while; spawn_blocking runs it on a separate pool so the async threads keep serving network calls.
  • Bounded channels give backpressure. If writing is slower than fetching, the producer waits instead of filling memory.
  • A semaphore caps work in flight, which keeps the job under Shopify’s rate limits. Shopify limits GraphQL by query cost and reports the remaining budget in each response: slow down when it runs low.
  • Ownership carries over. The token pair has one owner behind a lock; tasks borrow a copy of the current access token. The compiler rejects code that shares the pair without the lock.
  • Cancellation is explicit. A CancellationToken lets a deploy or shutdown stop the job between pages, after the last checkpoint, instead of mid-write.

Shopify’s cursor pagination is sequential (each page gives the cursor for the next), so the fetch runs as one producer in order, and the parallel part is the transform and write. A sketch, compiled against Tokio, with the Shopify call, the Rust core and Xano left as stubs:

#![allow(unused)]
fn main() {
use std::sync::Arc;
use std::time::{Duration, Instant};
use tokio::sync::{mpsc, Mutex, Semaphore};
use tokio::task::JoinSet;
use tokio_util::sync::CancellationToken;

type Res<T> = Result<T, Box<dyn std::error::Error + Send + Sync>>;

#[derive(Clone)]
pub struct AccessToken { pub value: String, pub expires_at: Instant }

pub struct Row { pub id: String, pub raw: String }
pub struct Batch { pub cursor: Option<String>, pub rows: Vec<Row> }

/// The one owner of a shop's tokens. Every task borrows the current access token through `current()`;
/// only the owner refreshes, under a lock, and it always keeps the newest refresh token.
pub struct TokenOwner { inner: Mutex<(AccessToken, String)> }

impl TokenOwner {
    pub fn new(access: AccessToken, refresh_token: String) -> Self {
        Self { inner: Mutex::new((access, refresh_token)) }
    }

    pub async fn current(&self) -> Res<AccessToken> {
        let mut guard = self.inner.lock().await; // one refresher per shop
        let left = guard.0.expires_at.saturating_duration_since(Instant::now());
        if left < Duration::from_secs(5 * 60) {
            let (access, refresh_token) = refresh(&guard.1).await?; // returns a new pair every time
            *guard = (access, refresh_token);
        }
        Ok(guard.0.clone())
    }
}

/// Long load: one producer walks Shopify's cursor pages in order (cursors are sequential),
/// a bounded channel applies backpressure, and a limited number of workers transform and write.
pub async fn run_load(owner: Arc<TokenOwner>, start: Option<String>, cancel: CancellationToken) -> Res<()> {
    let (tx, mut rx) = mpsc::channel::<Batch>(8); // at most 8 pages waiting

    let producer = {
        let owner = owner.clone();
        let cancel = cancel.clone();
        tokio::spawn(async move {
            let mut cursor = start;
            loop {
                if cancel.is_cancelled() { break; }
                let token = owner.current().await?; // fresh token for every page
                let (rows, next) = fetch_page(&token, cursor.as_deref()).await?;
                tx.send(Batch { cursor: cursor.clone(), rows }).await?;
                match next { Some(n) => cursor = Some(n), None => break }
            }
            Res::Ok(())
        })
    };

    let limit = Arc::new(Semaphore::new(4)); // workers in flight, kept under the API's rate limit
    let mut workers = JoinSet::new();
    while let Some(batch) = rx.recv().await {
        let permit = limit.clone().acquire_owned().await?;
        workers.spawn(async move {
            let _permit = permit; // released when this task ends
            let records = tokio::task::spawn_blocking(move || parse(batch.rows)).await?; // CPU work off the async threads
            write_idempotent(&records).await?; // keyed by record ID, so a replay is harmless
            save_checkpoint(batch.cursor.as_deref()).await
        });
    }
    while let Some(done) = workers.join_next().await { done??; }
    producer.await??;
    Ok(())
}
}

What each part closes from the failure table above:

Part of the sketchFailure it closes
TokenOwner::current() refreshes under a lock, five minutes before expiry, and stores the new pairA long pull failing partway; two workers breaking each other’s refresh token
One producer, cursor pages in orderPages fetched out of order or twice
mpsc::channel(8)Memory filling up when writes are slower than fetches
Semaphore::new(4)Hitting Shopify’s rate limit with too many requests in flight
spawn_blocking(parse)Network calls stalling behind CPU-heavy parsing
write_idempotent + save_checkpointA job that stops at hour two starting over, or writing records twice when it resumes
CancellationTokenA deploy or shutdown cutting a write in half

Rust’s non-blocking runners compared with useState in JavaScript

Rust adds code runners that don’t block: Tokio tasks (spawn, JoinSet), a separate pool for heavy work (spawn_blocking), and coordination built into the runtime (channels, semaphores, cancellation). Together they manage data while it moves: how much is in flight, who owns it, where to resume, and when to stop. React’s useState does something else. It holds a value for one component on one screen, re-renders when the value changes, and loses it when the page reloads or the tab closes.

Rust with TokioJavaScript with React useState
What it managesData in flight across a long job: pages, tokens, checkpointsOne component’s display state in one browser tab
Where it runsA server, for hours if needed, on several threadsThe shopper’s or merchant’s browser, for as long as the tab stays open
Doing work at onceTasks run in parallel on a thread pool; CPU-heavy parsing moves to spawn_blocking so network calls keep movingOne event loop per tab. async/await interleaves waiting but doesn’t run in parallel; heavy work freezes the page unless it moves to a Web Worker
Limits and backpressureBuilt in: a bounded mpsc channel and a SemaphoreNone. Each fetch starts at once unless you write the limit yourself
Who may change the dataThe compiler enforces one owner, or a lock; two writers changing the same value at once can’t compileAny code holding the setter can change it; a stale value from an earlier render can overwrite a newer one
Surviving a failuresave_checkpoint and idempotent writes resume where the job stoppedState is gone on reload; nothing resumes
Stopping cleanlyCancellationToken finishes the current write, then stopsClosing the tab stops everything mid-request

In business terms: useState is a note on one person’s desk, useful while they’re working on the screen in front of them. The Rust runners are the operations floor behind it: a controlled intake queue, a work-in-progress limit, a capacity cap on partner systems, a separate back office for heavy work, restart points, and an orderly close. The page can show progress with useState; the record of what was loaded, and from where to continue, belongs to the server and to Xano.

The two aren’t rivals. A merchant’s admin screen uses useState to show a load’s progress bar; the load itself runs in Rust on a server and reports its checkpoint, which the screen reads. Keep anything that must survive a reload, a retry or a deploy out of component state.

Inside a Cloudflare Worker there is no Tokio thread pool. A Worker runs one event loop per isolate; Rust compiled for it is async (through wasm-bindgen-futures) but single-threaded, and each request has CPU-time limits. The same crate’s logic (types, parsing, decide) runs there; the hour-long orchestration does not. Split it into Workflow steps or queue messages, or run it on a server with Tokio.

Certification and authorization impact

The two rules reach further than the App Store listing. The Shopify side decides whether an app can be listed and installed. The merchant’s own certifications decide whether its auditors accept how integrations hold credentials.

On Shopify’s side

WhatImpact
App Store listing and reviewAn app missing either rule is delisted and can’t take new installs, and an app under review should meet both before it’s approved. Check the current App Store requirements before submitting
Built for Shopify statusDepends on being listed and meeting the App Store requirements, so delisting puts it at risk. Check the current Built for Shopify criteria
Protected customer data accessApproved per app and per level. The rules don’t change the approval itself, but a token that can be used from anywhere and never expires is hard to defend in the data-protection answers that approval asks for
Merchant authorization (OAuth)Moving to expiring tokens can force a re-authorization. A refresh token that lapsed after 90 days does too. Plan it so merchants aren’t asked to re-approve scopes unexpectedly. Never widen scopes in the same change
Custom apps in the merchant’s adminExempt from both rules. The merchant’s admin staff own the token, the scopes and the rotation, so the merchant’s own controls have to cover them

On the merchant’s certifications

The token and allowlist rules map onto access-control requirements most frameworks already have. The mapping below is a guide for preparing evidence; the auditor decides what counts.

FrameworkRequirement it touchesEvidence the rules provideGap the exempt custom-app token leaves
SOC 2 (Trust Services Criteria, CC6)Logical access: restrict access, authenticate system accounts, limit access from outside the boundaryExpiring tokens; an allowlist limiting the networks a token can be used from; Dev Dashboard logs of client IPsA static token in middleware, usable from anywhere, often with write scopes
ISO/IEC 27001:2022 (Annex A)Authentication information, secure authentication, access rights (A.5.17, A.8.5, A.5.18)Token lifetime and rotation; network restriction; one owner per credentialNo forced rotation, and the credential is copied into several systems
PCI DSS v4.0 (Requirement 8)Accounts used by systems and applications: managed, protected and changed periodically based on a risk analysis (8.6)Expiring and rotating tokens for public appsCustom-app tokens feeding order or payment-adjacent systems need their own rotation schedule. Card data itself stays out of Shopify app tokens
GDPR / UK GDPR (Art. 32)Security of processing appropriate to the riskShort-lived credentials, network limits, an audit trail per decisionA long-lived token with customer scopes, held by a processor, without its own limits
SAP’s own certification of an integrationSAP certifies the connector, not the Shopify side—The Shopify credential the connector uses is out of scope for SAP’s certification and has to be covered by the merchant’s controls

What to put in the evidence pack

  • Each public app’s allowlist and enforcement state, with the date it was turned on and the traffic test result.
  • Proof that installs use expiring offline tokens, plus the session lifetime that keeps refresh tokens alive.
  • An inventory of custom-app tokens: where each is stored, its scopes, its owner and its rotation date.
  • A receipt for each export from the gate’s ledger (Function gating), so access can be traced per decision, not just per system.

Before Jan 1

  • List the store’s installed apps and ask each vendor whether it has moved to expiring offline tokens.
  • Find the custom apps whose tokens sit in ERP or middleware: exempt, but review their scopes and rotation, and allowlist them too where the platform allows.
  • Run each seasonal job once, early, so a lapsed refresh token shows up before the season does.
  • Treat the deadline as a review point: an app that stops on Apr 1 is the moment to decide whether to replace it with a build behind the same gate.

Terms

TermStands forWhat it means here
ASNAutonomous System NumberThe number identifying one network operator’s part of the internet: Cloudflare is 13335, Amazon Web Services 16509, Google 15169. Shopify’s allowlist can accept ASNs instead of addresses, meaning “any request from this operator’s network”. It depends on Shopify’s lookup (GeoLite) matching the request to an ASN, which failed for Cloudflare Workers egress
Short-lived token(not an acronym)An access token that expires quickly. Shopify’s expiring offline access token lasts one hour, so a stolen copy stops working on its own
Refresh token(not an acronym)The longer-lived token (90 days when issued) used to get a new access token. Shopify replaces it on every refresh
IPInternet ProtocolAn address such as 104.16.0.0 (IPv4) or 2606:4700:: (IPv6)
CIDRClassless Inter-Domain RoutingThe /16 or /32 notation for a block of IP addresses. A smaller number after the slash means a larger block
OAuthOpen AuthorizationHow a merchant approves an app’s access and the app receives its tokens
JWTJSON Web TokenA signed token. In Shopify’s client credentials flow, the app’s backend signs one with its private key to get an access token
JWKJSON Web KeyThe public key, registered in the Dev Dashboard, that Shopify uses to check that JWT
GIDGlobal IDShopify’s identifiers, such as gid://shopify/Product/123
Client assertion(not an acronym)A short JWT the app signs to prove it is the app, sent instead of a client secret when asking Shopify for a token
RS256RSA signature with SHA-256One of the two algorithms Shopify accepts for a client assertion (RSA keys of 2048 to 8192 bits)
ES256ECDSA on P-256 with SHA-256The other algorithm Shopify accepts; small keys and fast signing, the nearest equivalent to Ed25519
EdDSAEdwards-curve Digital Signature AlgorithmSigning with Ed25519 keys. Not accepted by Shopify for client assertions; fine for a platform’s own certificates
kidKey IDThe label in a signed token’s header saying which registered public key checks it; a new one on every key rotation
jtiJWT IDA unique ID per token. Shopify accepts each client assertion’s jti once per app, across all stores
mTLSMutual Transport Layer SecurityTLS in which the caller also presents a certificate you issued, checked in the handshake; proves the machine, not the person
CACertificate authorityWhoever issues and signs certificates; for mTLS, the CA you trust for your callers’ certificates
API Shield(Cloudflare product)Cloudflare’s API protection; its mTLS rules require a valid client certificate on chosen hostnames or paths
CRL / OCSPCertificate Revocation List / Online Certificate Status ProtocolThe two ways to tell a verifier a certificate has been withdrawn before it expires
Dead-letter queue(not an acronym)Where work that failed is set aside with its error, to be retried on a schedule instead of being dropped or retried forever
Dead-letter refresh(not an acronym)A token refresh that can never succeed (401 invalid_request): stop retrying, mark the shop, keep its waiting work, and replay it after the merchant reconnects
Bulk operation(not an acronym)A job Shopify runs on its own side over a whole dataset, started with bulkOperationRunQuery (export to a JSONL file) or bulkOperationRunMutation (apply an uploaded JSONL file), then polled or reported by the bulk_operations/finish webhook. Not the same as mutations with “bulk” in their name, such as productVariantsBulkUpdate, which are ordinary single requests. The Nov 12, 2026 allowlist rule applies to bulk operations only
APIApplication Programming InterfaceThe Admin API is how apps read and write store data
TLSTransport Layer SecurityThe encryption behind https://. A TLS login keeps every step of sign-in encrypted in transit; it protects the connection, not the identity
Salt(not an acronym)A random value, different for every password, mixed in before hashing so identical passwords give different hashes. Stored beside the hash; not secret
PBKDF2Password-Based Key Derivation Function 2A slow, salted hash for passwords and for deriving keys from a secret; its iterations set how slow
AES-GCMAdvanced Encryption Standard, Galois/Counter ModeTwo-way encryption that also detects tampering; used here with 256-bit keys
JWEJSON Web EncryptionA token whose contents are encrypted, not only signed; Xano’s built-in auth tokens use it
OIDCOpenID ConnectThe sign-in standard on top of OAuth that Google and Shopify’s Customer Account API use to say who a person is
Claims(not an acronym)The facts about who a signed-in person is and which accounts are linked to them, kept in Xano
Extras(not an acronym)Extra per-person data a signed-in page may show, kept apart from the claims
/auth/me(an endpoint)Answers “who is signed in?”: verifies the token, then returns the user, claims, extras and entitlement
RBACRole-based access controlAccess follows an assigned role, as with SAP roles built in PFCG and loaded at logon
RuBACRule-based access controlEvery request is decided by rules over current facts: a license and its terms, its expiry, consent and region
Perimeter login(not an acronym)Access decided once at the door (a logon screen, a VPN); inside, the session is trusted
Entitlement register(not an acronym)The record of who holds which license terms, read by the Worker on every request
BYOBring your ownA merchant running the stack on their own Cloudflare account or Xano instance

References

Parsing at the gate: Shopify and Webflow

Shopify and Webflow apps send the same kinds of data (customers, products, content, events) in different shapes. When both share one Cloudflare Worker as the gating endpoint, the Worker does the same five things to every request before anything reaches Xano, BigQuery or Basin:

 Shopify                              Webflow
 webhooks · app proxy · Web Pixel     webhooks · Data API · site custom code · Designer Extension
         │                                     │
         └───────────────┬─────────────────────┘
                         ▼
 Cloudflare Worker (one gating endpoint)
   1. verify   the signature (HMAC), the timestamp, the shop or site
   2. parse    into a typed Rust struct (compiled to WebAssembly)
   3. normalise ISO 3166 codes, UTC timestamps, money as micros, IDs as GIDs
   4. decide   consent and purpose from the ledger, through the release gate
   5. record   an idempotency key and a receipt, then forward
                         │
                         ▼
 Xano (system of record) · Basin Pipelines (events) · BigQuery (Google joins)

The rule from Function gating across clouds applies: steps 2 to 4 are one Rust crate, not a parser per app. The ECC side of the book already works this way; Shopify and Webflow are two more inputs to it.

Where each app’s data comes in

App surfaceWhat arrivesHow it’s verifiedParsing notes
Shopify webhooksJSON for orders, customers, products, refunds; the GDPR topics (customers/data_request, customers/redact, shop/redact)X-Shopify-Hmac-Sha256 over the raw bodyPayloads are REST-shaped: a numeric id plus admin_graphql_api_id (the GID). Keep the GID. Delivery is at least once and can arrive out of order: deduplicate on the webhook ID
Shopify app proxyStorefront requests forwarded from /apps/… to the WorkerA signature query parameter (HMAC over the other parameters)Shopify strips cookies on the proxy; the shopper arrives as logged_in_customer_id and shop, not as a session cookie
Shopify Web PixelStandard customer events: page_viewed, product_viewed, product_added_to_cart, checkout_started, checkout_completedRuns in Shopify’s sandbox; posts to the WorkerShopify applies its Customer Privacy API before the pixel runs; the gate records the consent the pixel ran under, it doesn’t override it
Shopify FunctionsDiscount, delivery and checkout logic, in WebAssemblyRuns inside ShopifyNo network calls. A Function can’t ask the gate; the gate’s decision has to be written beforehand (to a metafield the Function’s input query reads)
Shopify Admin GraphQLProducts, variants, markets, translations, on requestApp access tokencamelCase fields, GIDs, MoneyV2 (amount as a decimal string, currencyCode)
Webflow webhooksForm submissions, CMS item changes, site publishx-webflow-signature (HMAC) with x-webflow-timestamp; reject stale timestampsRetries on failure: deduplicate on the item ID and timestamp
Webflow Data APICMS items, locales, assetsSite or app tokenfieldData is keyed by each field’s slug; option fields return option IDs, reference fields return item IDs, rich text is HTML, images are {fileId, url, alt}; isDraft, isArchived, lastPublished decide what’s live; each locale is its own item version (cmsLocaleId)
Webflow site custom codeOne tag in the head that loads the islands and the consent checkServed by the WorkerWebflow has no consent API of its own: the edge banner and the Worker’s session decision are the consent layer
Webflow Designer ExtensionThe designer’s app inside the DesignerWebflow’s extension authReads classes, data-* attributes and components: the same contract Beautiful Soup reads from an export (see What is ABAP?)

One record from three shapes

The same product, as each source sends it, and as the gate writes it:

FieldECCShopifyWebflow CMSAfter the gate
IDMATNR 000000000000012345gid://shopify/Product/9001 (webhook: id: 9001)Item ID 64f…, slug heated-mat-queenProduct key from the Xano crosswalk, with all three kept
TitleMAKT-MAKTX per language keytitle, translations per localefieldData.name per cmsLocaleIdText per BCP 47 locale
PriceKONP-KBETR 129.00, KONWA USDMoneyV2 {"amount": "129.0", "currencyCode": "USD"}A number field, currency implied by the site{amountMicros: 129000000, currency: "USD"}
UpdatedDATS + server local timeISO 8601 UTClastUpdated ISO 8601UTC with a sequence number
Live?LVORM deletion flagstatus ACTIVE / DRAFT / ARCHIVEDisDraft, isArchivedOne status enum

Gaps the shared endpoint has to cover

GapWhyWhat the gate does
Shopify Functions can’t call outNo network access inside a FunctionWrites the decision ahead of time where the Function reads it; a stale decision expires
Out-of-order webhooksBoth platforms retry; an update can arrive after a newer oneCompare the source’s timestamp with the stored one; the newer wins, the older is receipted and dropped
Two sources of consentShopify’s Customer Privacy API on the storefront, the edge banner on WebflowOne ledger subject per person; both decisions recorded with their source and banner version
No cookie on the app proxyShopify strips itSession tied by the signed logged_in_customer_id or a signed token, never a cookie
Webflow fields keyed by slugA designer renaming a field’s slug breaks a parser that hard-codes itMap slugs in one place (the crosswalk), fail the build or the request loudly on an unknown slug
Drafts and localesWebflow and Shopify both hold unpublished and per-locale versionsOnly published, current-locale versions forward; drafts never leave
Personal data in eventsForm submissions and checkout events can carry names and e-mailsPseudonymise before Basin; personal data goes to Xano only, under the gate

The rule: one endpoint, one parser, one ledger. Shopify and Webflow keep their own surfaces; the Worker verifies, parses into the same typed record, and asks the same gate, so a product, a person or a consent decision means the same thing whichever app sent it.

One Rust crate, layered into WebAssembly: ownership, Javy and conditional loading

The gate’s rules live in one Rust crate (src/release_gate.rs: decide(destination, subject, rows) -> Decision). The same crate can be compiled into each layer that has to apply them, including a Shopify Function, which can’t call the gate itself. What makes that safe is Rust’s ownership model; what makes it cheap is loading each piece only where and when it’s needed.

Ownership, in one paragraph

In Rust every value has exactly one owner. Other code can borrow it, either read-only (many at once) or to change it (one at a time), and the compiler checks both rules before the program runs. When the owner goes out of scope the value is freed. There is no garbage collector, so a WebAssembly module built from Rust carries no runtime to manage memory: it is small, starts fast and behaves the same on every run. Two classes of bug that matter when parsing untrusted input, reading freed memory and two writers changing the same data, can’t compile.

The model maps onto the gate. One owner per decision: the Worker owns it, writes it once, and every other layer only borrows a read-only copy. The same rule in the type system is the same rule in the architecture.

The layers

LayerBuild targetWho loads it, and whenNetworkWhat it does with the decision
Cloudflare Worker (the gate’s endpoint)WebAssembly for Workers, through workers-rs / wasm-bindgenBundled at deploy; your code decides per request which routes instantiate itYesOwns it: reads the ledger, calls decide, writes the result
Shopify Function (discount, delivery, checkout validation)WebAssembly (WASI), built by the Shopify CLIShopify runs it, only when that function is active for the shop and the cart or checkout reaches itNoneBorrows it: reads the decision the Worker wrote to a metafield, through the Function’s input query
Browser islandWebAssembly, wasm-bindgenThe Worker adds its tag to the page only after the session’s consent decisionThrough the WorkerUses it for display only (a price preview, a converter); never decides
Native and PythonNative binary; Python extension (PyO3)Batch jobs, the design pipelineYesReads it, never writes consent

Rust or Javy for a Shopify Function

Shopify Functions can be written in Rust or in JavaScript. JavaScript Functions are compiled with Javy, a Bytecode Alliance project started at Shopify, which builds a WebAssembly module that runs your JavaScript inside an embedded JavaScript engine (QuickJS).

RustJavaScript through Javy
What’s in the moduleYour compiled logic onlyYour script plus a JavaScript engine to run it (Javy can link the engine separately to keep the module small)
MemoryOwnership, decided at compile time; no garbage collectorThe engine’s garbage collector, inside the module
Size and speedSmaller and faster for the same logicLarger, and more instructions per run
Shopify’s limitsFurther from Functions’ size, memory and instruction limitsCloser to them as the logic grows
Reuse in other layersThe same crate as the Worker and the batch toolsThe same JavaScript can run in a Worker directly, but not in the Rust core
Best forRules shared with the gate; anything heavy (many cart lines, pricing, parsing)Small, Function-only logic a JavaScript team owns

Shopify publishes the current Function limits and recommends Rust where performance matters; check them before choosing. For this layer the deciding point is reuse: a Rust Function reads the decision with the same type the Worker wrote it with, so the two can’t drift.

The decision as a shared type

The Worker serialises a decision with an expiry; the Function deserialises it with the same struct and refuses one that’s stale. A sketch, built on the crate’s existing Decision:

#![allow(unused)]
fn main() {
use serde::{Deserialize, Serialize};

/// Written once by the Worker (the owner) to an app metafield; read-only everywhere else.
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PublishedDecision {
    pub destination: String,   // e.g. "member_price", "audience"
    pub allowed: bool,         // release_gate::Decision.allowed
    pub reason: String,        // release_gate::Decision.reason
    pub rule_version: u32,     // which version of the rules decided it
    pub expires_at: i64,       // Unix seconds; after this the decision is not trusted
}

impl PublishedDecision {
    /// Borrows `self` read-only: checking a decision never changes it.
    pub fn is_current(&self, now: i64) -> bool {
        now < self.expires_at
    }
}
}

In the Function, a missing, unreadable or expired decision falls back to the safe default for its purpose: deny for anything that grants a member price, a discount tied to consent or an audience; ignore (proceed normally) for anything that is part of fulfilling the order. The time the Function compares against has to come from its input, since a Function has no network and no clock of its own to trust.

Conditional loading, server side

Loading each piece only where it is needed keeps every layer small and keeps decisions where they belong:

  • In the Worker, the module is bundled at deploy, but it doesn’t have to run on every request. Instantiate the Rust core only on routes that parse or decide (webhooks, the app proxy, exports), keep it for the isolate’s lifetime, and let static pages skip it.
  • For the browser, the Worker decides on the server which island tags to add (HTMLRewriter), after the consent check. A visitor who hasn’t consented never downloads a module they aren’t allowed to run. That’s the same consent-first rule as What is ABAP? → islands, applied to WebAssembly.
  • For Shopify Functions, Shopify does the loading: a Function runs only when it is active for the shop and the cart or checkout reaches it. What you control is its input: the input query asks only for the fields and the metafield the decision needs, so the Function reads less and runs fewer instructions.

The rule: one crate, one owner per decision. The Worker owns and writes; Shopify Functions, browser islands and batch tools borrow and read; each layer loads the module only when its route, its consent state or Shopify’s activation needs it.

Bringing security and data in house

Introduction: layers of security, not just login

SAP, WordPress and Magento all secure data the same way: at sign-in, by role. Once a user is signed in, their role decides what they can do, and nothing is checked again.

SystemRole modelCheckedWhat it doesn’t cover
SAP ECC / S/4HANARoles built in PFCG from authorization objects (S_TABU_DIS for tables, F_KNA1_BUK for customers by company code)At login and when a transaction startsData read through RFC, IDoc or a direct database connection. A role with table access sees every row in clear text
WordPressRoles and capabilities (administrator, editor, current_user_can('edit_posts'))At login, then per action against the roleAny plugin with database access, and the wp_users / wp_usermeta tables in a database dump
Magento / Adobe CommerceAdmin roles with ACL resources (Magento_Customer::manage), plus integration tokensAt admin login and per controllerCustomer and order tables are readable by any extension, any integration token with the resource, and any copy of the database

Login is a door, not a vault. If one session is stolen, one token leaks, one plugin is compromised or one database dump is copied, every row that role could see is exposed. Penetration tests and breach reports on all three platforms come back to this point: the role was right, but nothing checked the request or the data after sign-in.

The layers in this chapter reinforce the login rather than replace it. Each one checks something different, so a failure in one is caught by the next:

 1  Edge          WAF rules, rate limits, Turnstile        → is this a person, from a sane place, at a sane rate?
 2  Request       HMAC signature, session-token JWT        → did Shopify / Webflow / our own app really send it?
 3  Login + role  SAP role, WP capability, Magento ACL,    → who is this, and what may their role do?
                  CRM Sync entitlement
 4  Rule          RuBAC: consent, region, purpose, time    → may THIS action happen to THIS record, right now?
                  checked on every change, not once
 5  Row           per-row encryption (kid), signature,     → if the database leaks, is each row still unreadable,
                  hash chain                                 and is any edit detectable?
  • Rules (layer 4) are role-based access turned into rule-based access: the decision is made for each request and each record, using facts the role can’t know, such as this customer’s consent, this market’s law and this export’s purpose. See RuBAC compared with perimeter login.
  • Row-based encryption (layer 5) means each sensitive row is encrypted with a data key named by its kid, and signed and chained to the row before it. An administrator, an integration or a database dump without the key gets ciphertext. A changed row breaks the chain. Rotating a key re-encrypts rows a batch at a time, without taking the table offline. The Xano examples below (consent_records, entitlement_signing_keys, JWE) are this layer.

SAP, WordPress and Magento keep their own logins and roles. The layers sit in front of them (edge, request) and behind them (rule, row), so a stolen login alone no longer reaches the data.

Keys at every layer

Every gate in this book trusts one thing: a key. This chapter lists the keys in the CRM Sync stack and what each one signs or proves, along with where it is kept, how it is checked and how it rotates. It covers Xano’s working examples, the signing keys Shopify and Webflow use for apps and Designer Extensions, and the Cloudflare layer in front of them all (Workers, Turnstile and the WAF).

 Visitor / bot           Cloudflare edge                         Apps and systems of record
 ─────────────           ─────────────────────────────────       ──────────────────────────
 browser form   ──▶  WAF rules ─▶ Turnstile ─▶ Worker  ──▶  Xano (env keys, signed ledger)
 Shopify        ──▶  webhook HMAC / session token JWT  ──▶  Shopify Admin API (IP allowlist)
 Webflow        ──▶  webhook signature / Designer idToken ─▶  Webflow Data API (site token)
                     └── each hop checks a key; none of them reuses another's ──┘

Three rules hold throughout. A key is generated, not typed (openssl rand -hex 32 or the platform’s own “create secret”). It lives in one secret store per runtime: Worker secrets, Xano environment variables, or the platform’s dashboard. It is recorded by fingerprint only: no key value appears in this book, in a log or in chat.

Working examples in Xano

Each technique, and where it runs in the CRM Sync workspace (workspace 4).

What it showsWhere
HMAC-SHA256 with a key from the environmentads_export/record_conversion and rebuild_audiences (functions 122, 123): order_id|hmac_sha256:$env.ADS_HMAC_KEY
SHA-256 hashing for Google matchingads_export/rebuild_audiences: $email|sha256
A shared secret that fails closed, split by scope, with Basic auth decodedads_export/authorize (function 126): base64_decode, separate read and write keys, a 32-character minimum, refused if the two keys match
A rate-limited rebuildPOST /rebuild refuses a second run within 10 minutes with HTTP 429
JWE decryptionAPI group SamsungPay (69): decrypts the wallet’s payment credential and never stores or logs the plaintext
EdDSA signing keys and rotationTables entitlement_signing_keys (192) and entitlement_keys (191)
Signed, hash-chained recordsconsent_records (183): record_hash, prev_hash, kid, and an EdDSA JWS signature on every new row
A secret-gated release checkrelease_gate (function 115, API group 76) using env RELEASE_GATE_SECRET

The key matters more than the function. Xano’s encrypt, decrypt and JWE use a key you supply, so generate it with openssl rand -hex 32 or Xano’s “Create secret key” and keep it in an environment variable. Randomness and custody decide the strength, which is what the eMudhra certificate failure showed.

Live and verified on 31 October 2026: the read key returns the CSV (HTTP 200) and the write key is refused on it (403). The read key is refused on a rebuild (403), the first rebuild runs (200), and a second within 10 minutes is refused (429). Consent-record signatures and the Samsung Pay JWE path are live.

Function, table and API group numbers are workspace identifiers, not credentials.

Which kind of key: platform-issued or in-house owned

Keys in this stack come from two places, and the difference decides who can rotate or revoke them.

KindExamplesWho owns itWhat it proves
Platform-issuedShopify app client secret, Webflow app client secret, Webflow site API token, Turnstile secret keyThe platform. It issues the key and can rotate or revoke itThat a request came from Shopify, Webflow or Cloudflare, or is allowed into their APIs
In-house owned: a Consulting Team Purchase / AttestationThe EdDSA entitlement signing key (entitlement_signing_keys, 192), the consent-ledger signature (consent_records, 183), ADS_HMAC_KEY, RELEASE_GATE_SECRETYou. Generated in your own Xano and Worker, never handed to a platformThat your system granted something: a capability, a consent, a release

The signing key behind a capability is the in-house kind. When a team, such as a consulting team working for a brand, buys a capability, the purchase is the grant. The Worker records it in the team’s entitlement and signs it with the in-house EdDSA key, under a kid. That signed grant is an attestation: anyone holding the public key can check it, and no platform can forge, rent or withdraw it. Rotating the key adds a new kid; grants already signed keep their old kid and still verify (entitlement_keys, 191).

Example: Channel managers. Channel Publish is bought this way. Minting a tracked link or QR code requires a signed-in account that holds the Channel Publish capability. Every mint and every scan lands in the buyer’s own ledger, never a third party’s. The team’s channel managers publish under a grant the team owns, attested by an in-house key, not a key rented from a link or QR service.

Signing keys for Shopify apps and extensions

One Shopify app has one client secret (the “API secret key” in the Dev Dashboard), and Shopify uses it to sign four different things. Public apps that sign in as themselves add a second key pair, covered in Signing in as the app.

What Shopify signsHeader or fieldAlgorithm and encodingHow the Worker checks it
Webhooks (orders, customers, GDPR topics)X-Shopify-Hmac-Sha256HMAC-SHA256 over the raw body, base64verifyShopifyHmac: recompute over the body as received, then compare in constant time. Parse the JSON only after it passes
Session tokens from the admin, checkout and Thank you page UI extensionsAuthorization: Bearer <jwt>JWT, HS256, signed with the client secret; expires after one minuteverifyToken(tok, appSecret), then dest must equal the shop and aud the app’s client ID. A token proves the shop, not the buyer: the Thank you page handler reads the order’s own customer from Shopify (handleCheckoutAdsConsent)
OAuth install callbackhmac query parameterHMAC-SHA256 over the other parameters, sorted, hexCheck before exchanging the code; reject a shop that isn’t *.myshopify.com
App proxy requests from the storefrontsignature query parameterHMAC-SHA256 over the sorted parameters joined with no separator, hexCheck on every proxied request; the proxy adds logged_in_customer_id, which is only trustworthy after this check
Client credentials assertion (public apps, no merchant present)client_assertionRS256 or ES256 key pair; Shopify holds the public keySigned by the app, verified by Shopify; never EdDSA

Rotation. Rotating the client secret in the Dev Dashboard gives a new secret before the old one is revoked. For that window, hold both in the Worker (SHOPIFY_APP_SECRET and SHOPIFY_APP_SECRET_PREVIOUS), accept a signature that matches either, then delete the old one once it’s revoked. A per-tenant secret in KV rotates the same way, one tenant at a time.

The same check in Rust, for a gate compiled once and run in a Worker or a native service (see One Rust crate, layered into WebAssembly):

use base64::{engine::general_purpose::STANDARD, Engine};
use hmac::{Hmac, Mac};
use sha2::Sha256;

/// Shopify webhook: HMAC-SHA256 of the raw body, base64. Tries the current secret, then the
/// previous one while a rotation is in progress. `verify_slice` compares in constant time.
pub fn shopify_webhook_ok(raw_body: &[u8], header_b64: &str, secrets: &[&str]) -> bool {
    let Ok(expected) = STANDARD.decode(header_b64.trim()) else { return false };
    secrets.iter().filter(|s| !s.is_empty()).any(|secret| {
        let mut mac = Hmac::<Sha256>::new_from_slice(secret.as_bytes()).expect("any key length");
        mac.update(raw_body);
        mac.verify_slice(&expected).is_ok()
    })
}

Signing keys for Webflow apps and Designer Extensions

A Webflow Data Client app (OAuth) has a client ID and client secret. A Designer Extension runs inside the Designer as an iframe with no secret of its own, so anything it sends has to be proved some other way. A site API token is a bearer token for one site, and it signs nothing.

KeyWhat it signs or provesHow the Worker checks it
App client secretWebhooks from an OAuth app: x-webflow-signature is HMAC-SHA256 (hex) over `${x-webflow-timestamp}:${rawBody}`verifyWebflowSignature: refuse a timestamp more than 5 minutes old (replay), recompute, compare in constant time
Designer Extension ID tokenWhich Webflow user is in the Designer: webflow.getIdToken() returns a short-lived JWTSend it to the Worker; the Worker calls POST https://api.webflow.com/v2/token/resolve with the app’s access token and gets the user back. The extension never holds a reusable key
Site API token (Site settings → Apps & Integrations → API access)Calls into the Data API for one site; signs nothingKeep in Worker secrets, never in the extension or a page. Revoke any token that hasn’t been used recently
Site webhooks created with a site tokenNot signed. No signature header is sentTreat as unverified: re-read the item from the Data API by ID before acting, rather than trusting the payload

The gap in the Design Auth extension today. It asks for an admin key or a crm_t_… tenant token and sends it as a bearer token on every call. The token is scoped to one brand and isn’t saved when you sign out, but it is still a long-lived key typed into a browser. Moving to webflow.getIdToken() plus /v2/token/resolve replaces it with a token that expires within minutes and names the user. The Worker then maps that user to a tenant and its entitlements, the same way the sign-in page does.

/// Webflow webhook: hex HMAC-SHA256 over "timestamp:body", refused if older than five minutes.
pub fn webflow_webhook_ok(raw_body: &str, sig_hex: &str, ts_ms: i64, now_ms: i64, secret: &str) -> bool {
    if secret.is_empty() || (now_ms - ts_ms).abs() > 5 * 60 * 1000 { return false; }
    let Ok(expected) = hex::decode(sig_hex) else { return false };
    let mut mac = Hmac::<Sha256>::new_from_slice(secret.as_bytes()).expect("any key length");
    mac.update(format!("{ts_ms}:{raw_body}").as_bytes());
    mac.verify_slice(&expected).is_ok()
}

One Worker, the same for every platform

The Worker in front of a Webflow site is the same Worker as the one in front of a Shopify store, and the same one in front of Magento, WordPress, Drupal or a Next.js, Astro or Vue app. It has the same code, deploy, secret store and edge rules. The theme loads the same way too: the Worker is the route in front of the site, so it adds the same consent, Turnstile and behaviour scripts to every page through HTMLRewriter, whatever the theme or CMS. No platform plugin has to carry the security; the platform keeps its own login and roles (layer 3), and the Worker adds the rest.

PlatformWhere the Worker sitsHow a request is provedTenant keyTheme
ShopifyRoute in front of the storefront domain; app and webhook endpointsWebhook HMAC, session token JWT, app proxy signatureShop domainLiquid theme or Hydrogen; scripts added at the edge
WebflowRoute in front of the published site; Webflow Cloud apps run on WorkersWebhook signature, Designer Extension ID tokenSite IDWebflow design output; scripts added at the edge
Magento / Adobe CommerceRoute in front of the storefront; webhooks and integration calls go to the WorkerIts webhook signature or a shared secret, checked in the Worker; the admin integration token stays in Worker secretsStore / website codeLuma or Hyvä theme unchanged; scripts added at the edge
WordPress / WooCommerceRoute in front of the site; WooCommerce webhooks go to the WorkerWooCommerce’s webhook signature (HMAC-SHA256, base64), or a shared secret for custom hooksSite domainAny theme; scripts added at the edge, no security plugin required
Drupal / Drupal CommerceRoute in front of the siteA shared-secret HMAC from the sending moduleSite domainAny theme; scripts added at the edge
Next.js, Astro, Vue (Nuxt)The app can run on Workers itself (OpenNext for Next.js, the Cloudflare adapter for Astro, Nitro for Nuxt), or the Worker sits in frontThe app’s own session, plus the same signed-request check for anything machine-to-machineDomain or app IDThe app’s components; the same scripts, loaded the same way

What changes from one row to the next is only how the request is proved. That is one match arm in the gate. The edge rules, the tenant config, the Xano release gate, the consent ledger and the in-house attestations are shared. Adding a platform means adding one arm, not another security stack.

In the browser, a Webflow page and a Shopify page are both just HTML. If the head and footer code is identical, the same script loads from the same Worker URL and runs in the same browser runtime, and the function behaves the same on either platform.

WebflowShopify
HeadSite settings → Custom code → Head code (or per page)theme.liquid before </head>, or an app embed block
FooterSite settings → Custom code → Footer codetheme.liquid before </body>, or an app embed block
The line (example path)<script src="https://<your-worker>/stack.js" data-tenant="…" defer></script>The same line

Keep the head and footer to that one loader line. The Worker serves the code behind it, so a change ships once to every platform, with nothing to re-paste. WordPress, Magento, Drupal and a Next.js, Astro or Vue app load the same line in their own head and footer.

What still differs is what the script finds on the page. Each difference is a small check inside the same script, not a second script:

  • Platform objects: Shopify has window.Shopify and the Customer Privacy API for consent; Webflow has Webflow and no built-in consent API.
  • Markup: class names, form markup and where product data sits.
  • Forms: a Webflow form posts to Webflow (with Turnstile built in), a Shopify form posts to Shopify. A form that posts to the Worker behaves the same on both.

Where identical head and footer code doesn’t reach:

  • Shopify checkout doesn’t run theme head or footer code. There, the restricted blocks take over: checkout UI extensions for the screen, Shopify Functions for the decision (see Stack, heap and runtime).
  • Server-side work, meaning signatures, keys, R2 and the ledger, stays in the Worker.

So there are three layers: the browser layer is one script, loaded the same way everywhere; the checkout layer is Shopify’s blocks; the server layer is the Worker.

Shopify and Webflow side by side

Compared layer by layer, the two differ only in the format each platform uses to sign a request, and both use HMAC-SHA256 checked in constant time.

LayerShopifyWebflowSame in the Worker?
EdgeWAF rules, rate limits, TurnstileWAF rules, rate limits, TurnstileYes: one zone, one rule set
Request proofX-Shopify-Hmac-Sha256, base64, over the raw bodyx-webflow-signature, hex, over timestamp:body, 5-minute windowYes: HMAC-SHA256 + timingSafeEqualHex; only the encoding differs
App userSession token (JWT, HS256, app secret): dest = shopDesigner Extension ID token, resolved with WebflowYes: a short-lived token, mapped to one tenant
TenantShop domain (*.myshopify.com)Site IDYes: the same per-tenant KV config
Rule and rowXano release gate, consent ledger, entitlement attestationsThe sameYes: one Xano system of record
OutboundAdmin API, from Cloudflare’s ranges (IP allowlist)Data API, with the site token from Worker secretsYes: both calls leave from the Worker, never the browser

In Rust, the difference fits in one match; everything after it is shared:

pub enum Platform { Shopify, Webflow /* Magento, WordPress, Drupal, App: one more arm each */ }

/// One gate for every platform. Only how the signature is read differs.
pub fn signed_by_platform(p: Platform, raw_body: &str, headers: &Headers, secrets: &[&str], now_ms: i64) -> bool {
    match p {
        Platform::Shopify => shopify_webhook_ok(raw_body.as_bytes(), headers.get("x-shopify-hmac-sha256"), secrets),
        Platform::Webflow => {
            let ts = headers.get("x-webflow-timestamp").parse().unwrap_or(0);
            secrets.iter().any(|s| webflow_webhook_ok(raw_body, headers.get("x-webflow-signature"), ts, now_ms, s))
        }
    }
    // Then, for both: resolve the tenant, ask the release gate, write the receipt.
}

Where it differs: stacks that own their compile, data load and encryption

The Worker can sit in front of anything. The difference is behind it. A Gadget app, a React Router 7 + Prisma app or a Firebase-hosted app may end up on the same kind of data store (Postgres, or a document store), but what can compile, load and encrypt that data depends on the file stack: the framework’s build, the ORM’s migrations and the host’s runtime. WordPress plugins work the same way: ACF and WooCommerce compile to their own PHP and write to their own SQL tables, released through their own update and publish system.

StackCompiles withData store and how data loadsEncryption depends onChanging the shape of data
Gadget (hosted Shopify app)Gadget’s build and runtimeGadget’s Postgres-backed models; Shopify data arrives through Gadget’s syncGadget’s field types and environment variablesModel changes are Gadget migrations, on Gadget’s platform
React Router 7 + Prisma (Shopify’s app template)Vite / React Router buildPrisma schema → prisma migrate → the app’s own databaseApp code and the host’s secret storeALTER TABLE migrations; rows rewritten in place
Firebase Hosting (with Functions or App Hosting)The framework’s build, deployed by FirebaseFirestore or Cloud SQL, written by FunctionsGoogle’s at-rest encryption, plus app code for fieldsDocuments overwritten; a new shape means a backfill script
WordPress: ACFPHP, loaded by WordPress on each requestField values in wp_postmeta; field groups as posts or JSONThe database server, if anything; no field encryption by defaultupdate_field overwrites the previous value
WordPress: WooCommercePHP, released through plugin updatesOrders in its own tables (HPOS) or wp_posts; schema changes run on plugin updateThe database server; payment data stays with the gatewayPlugin-update migrations, on the plugin’s schedule
Worker + Xano (in house)Rust → WebAssembly, or TypeScript, compiled once for every platformXano as system of record; the Worker loads through the release gateYour keys (kid), per rowNew version, old one kept: append-only, signed, chained

Non-destructive data fine-tuning isn’t possible in the first five. Tuning data means refining a field, a mapping, a translation, a consent wording or a price rule. In those stacks a change overwrites the row, or runs a migration that rewrites the table on the stack’s own release schedule. The old value is gone unless a backup is restored. Nobody can show which version a past export, order or decision used, and a migration that goes wrong can’t be undone row by row.

In house, every change is a new version. The Worker and Xano write a new row that names the rule version and the kid. The old row still verifies, and its hash chain shows the order of edits. The release gate decides which version each platform reads. Fine-tuning becomes a new version the gate points at, and rolling back means pointing it at the old one, with no restore and no migration. The platform’s own store still holds its working copy for its pages, but the record, the keys and the history stay with you.

Stack, heap and runtime: Shopify blocks vs the Worker

“Stack” above means the tech stack: framework, build, ORM and host. In memory terms, the stack and the heap are two areas inside the runtime, and neither is the logic itself:

TermWhat it isIn a Worker
RuntimeRuns the compiled code and provides its memoryThe V8 isolate, with WebAssembly inside it (PHP for WordPress, Node for Firebase Functions)
Logic / functionThe compiled instructionsverifyShopifyHmac, release_gate, the Rust .wasm
StackShort-lived memory per function call, freed when the call returnsThe frame of shopify_webhook_ok while it runs: flags, lengths, timestamps
HeapMemory that grows as needed and lives as long as its ownerEverything loaded: the request body, an R2 file, parsed CSV rows, a decrypted record

A decrypted row or a loaded key sits on the heap. In Rust, ownership frees it the moment its owner goes out of scope, and zeroize wipes the bytes first. In JavaScript or PHP the garbage collector frees it later, unwiped.

A Shopify block is a restricted slot in Shopify’s runtime. A Shopify Function (discounts, delivery and payment customisations, cart and checkout validation) is your logic compiled to WebAssembly and run by Shopify with a small, fixed memory and instruction budget. Theme app blocks and checkout UI extensions are the same idea for the screen: they render in a slot Shopify controls, from a limited set of components, in a sandbox.

Shopify Function (a block)The Worker
RuntimeShopify’s, running your .wasmCloudflare’s V8 isolate, deployed by you
LogicOne function, with a strict size limitThe whole gate: any number of routes and functions
Stack and heapSmall and fixed, with an instruction budget per run; exceed either and the function fails and Shopify falls backRoughly 128 MB per isolate, CPU time you configure
LoadOnly what the input query asks for; Shopify loads it and hands it inAnything: R2, Xano, KV, Shopify, Webflow
NetworkNoneYes
OutputOperations Shopify applies: a discount, hide this option, block this checkoutAny response, write or signed receipt
KeysNone inside the functionYour secrets and your kid

The split: the block holds the small, fast decision that must happen inside checkout. The Worker holds everything that needs keys, network, files or history: signatures, the release gate, R2, the ledger. The same Rust crate compiles to both, so the rule is written once (see Rust or Javy for a Shopify Function). Shopify revises the Function limits; check the Shopify Functions reference for current figures before relying on one.

One store for every file type: R2 behind the same gate

Data is one half of bringing things in house; files are the other. Media, docs and Markdown, Rust books, video, responsive source sets, 3D models and any other MIME type can share one R2 resource, behind the same Worker and the same gate. R2 charges no egress fees, and the Worker that reads it runs on the same network, so serving a file to Shopify, Webflow, an app or a buyer adds no cross-cloud transfer charge. That is the egress gap closed for files.

 Shopify storefront ─┐
 Webflow site ───────┤                       ┌─ media/   images, source sets (resized at the edge)
 WordPress, Magento ─┼─▶ Worker (one gate) ─▶│  docs/    Markdown, PDFs, Rust books
 Next / Astro / Vue ─┤   entitlement,        │  video/   MP4, HLS segments (range requests)
 Desktop / PWA app ──┘   consent, signature  └─ 3d/      glTF / USDZ, encrypted, gated
                                               one R2 bucket · no public access · no egress fee
File typeStored asServed by the Worker asGate decides
Media (images)One original per imagesrcset variants resized at the edge (Cloudflare Images)Public, or by entitlement for a gated asset
Source setThe original plus its widths, generated on requestimage/avif, image/webp or image/jpeg, chosen by the browser’s AcceptWhich widths and formats a page may ask for
Docs / Markdown.md and PDF objectsRendered HTML, or the raw filePublic docs, or a signed-in reader’s licence
Rust booksThe built mdBookStatic HTML, CSS and search indexPublic, or a client’s private edition
VideoMP4 or HLS segmentsRange requests (206 Partial Content)Who may stream, and from which country
3DglTF, GLB, USDZ, encrypted at restDecrypted per request for a buyer, never a copyable public fileThe purchase attestation (see 3D Publisher)
Any MIME typehttpMetadata.contentType on the objectThe stored Content-Type; never guessed from the nameThe object’s own metadata, read by the gate

One resource, one gate, for data and metadata alike. The bucket has no public access and no public r2.dev URL. Every read goes through the Worker’s R2 binding, so the same check that guards an API call guards a file: the tenant, the entitlement or purchase attestation, consent, and the signature of the request. Metadata is gated too. An object’s custom metadata (owner, licence, kid, rule version, GTIN) is read by the gate and only shown to callers the gate allows, so a file’s existence and its details don’t leak through a listing or a header.

Webflow and Shopify are consolidated. Neither platform keeps its own copy. Shopify Files and Webflow’s asset library each hold a separate copy with its own public URL and permissions, so a file uploaded to both is two files to revoke. Pointing both at the Worker’s URL leaves one file, with one permission and one delete:

Separate platform storesOne R2 store behind the Worker
Copies of a fileOne per platform (Shopify Files, Webflow assets, the app’s bucket)One
Who can read itAnyone with each platform’s public CDN URLWhoever the gate allows, checked on every read
Revoking accessDelete it in each platform, and hope nothing cached the URLChange the grant once; the next read is refused
EgressEach cloud’s own transfer pricing, plus copies between themNone from R2
Changing a fileRe-upload to each platformNew object version; the gate decides which version each platform reads

A Webflow image field copies the file into Webflow’s assets when it’s set, so use a link field or an embed pointing at the Worker’s URL to keep the file in R2. In Shopify, reference the Worker’s URL from a metafield or the theme rather than uploading to Files.

/// One gate for every file type: no public bucket, the Worker reads R2 only after the check passes.
async fn serve_file(req: &Request, env: &Env, key: &str) -> worker::Result<Response> {
    let bucket = env.bucket("MEDIA")?;
    let Some(head) = bucket.head(key).await? else { return Response::error("Not found", 404) };
    let meta = head.custom_metadata()?;                  // owner, licence, kid, rule version
    if !gate_allows(req, env, &meta).await? {           // tenant, attestation, consent, signature
        return Response::error("Not found", 404);       // a refused file looks like a missing one
    }
    let Some(obj) = bucket.get(key).execute().await? else { return Response::error("Not found", 404) };
    let ct = obj.http_metadata().content_type.unwrap_or_else(|| "application/octet-stream".into());
    let mut res = Response::from_stream(obj.body().expect("body").stream()?)?;
    res.headers_mut().set("Content-Type", &ct)?;        // the stored MIME type, never guessed
    Ok(res)
}

Tools that give you no key: Matrixify, Airtable, SAP and ERP exports

Some tools stay in use even after everything else is in house: a bulk importer, a shared spreadsheet-database, a nightly ERP export. None of them gives the merchant a key. The credentials they run on belong to the vendor or the platform, or there are none at all, as with a CSV file on an SFTP server. The question for each one is whose key it is, and what your own ledger can prove about what it did.

ToolWhose keyWhat is signedWhat isn’tWhat you can revoke
Matrixify (public Shopify app)The vendor’s. Its client secret, a per-store access token, and its own IP allowlist, all held on its serversShopify signs its webhooks, admin session tokens and OAuth hmac with Matrixify’s secret; Matrixify checks themThe import file. A sheet uploaded or pulled from a URL, FTP, Dropbox or Google Drive carries no signature. Changes land in Shopify as overwritesUninstalling the app revokes its tokens. Nothing to rotate on your side
AirtableYours, but a bearer token. A personal access token or OAuth token, scoped to basesWebhook notifications carry X-Airtable-Content-MAC, an HMAC-SHA256 keyed with the MAC secret returned when the webhook is createdThe records. Anyone with edit access to the base changes the data, and the API returns the current value onlyThe token, in Airtable’s developer hub. Rotate it like any other secret
SAP / ERP export (CSV, flat file, IDoc file)None. A file written to SFTP, a share or a bucketNothing, unless the transfer is AS2 (EDI), where S/MIME signs the message, or the SFTP key proves the sender’s serverThe file’s content. Anyone who can write to the drop folder can change what gets loadedThe SFTP or share account. The file itself can’t be revoked once copied

If you keep using them, wrap them. The tool and its key stay as they are. The Worker adds the in-house layers around each run, so your ledger can prove what went in:

  1. Land the file in R2 first, behind the gate (see One store for every file type), not on a public URL or a shared drive. For an ERP export, the SFTP drop becomes a Worker upload or an R2 bucket the ERP writes to with its own scoped token.
  2. Fingerprint it and sign the receipt. The Worker computes SHA-256 of the file and writes a ledger row: file hash, source, job, row count, rule version, signed under your kid. That is the attestation the tool can’t give.
  3. Check before loading. The release gate checks the file against its schema, consent and market rules. A file that doesn’t match is held, not loaded halfway.
  4. Hand the tool a short-lived signed URL to that exact object for one run (Matrixify’s scheduled import from a URL, Airtable’s sync, the ERP’s pickup), instead of a standing link anyone could reuse.
  5. Record the result. The Worker records what the tool reports back (Matrixify’s job result, an Airtable webhook, the ERP’s acknowledgement) against the same receipt. Every value the tool changes can now be traced to one exact file.
Tool used directlyTool wrapped by the Worker
The fileOn a URL, drive or SFTP folder; anyone with access can change itOne R2 object behind the gate, hash recorded before the run
Who proves what was loadedThe vendor’s job log, in the vendor’s accountYour ledger: file hash, job, rule version, signed with your kid
A bad fileLoaded, then found later; Shopify values overwrittenHeld at the gate before the tool reads it
Undoing a runRe-import an older file, if someone kept itThe previous file is still in R2 under its hash; re-run it
Leaving the toolIts history stays with the vendorYour files and receipts stay with you

For SAP and other ERPs specifically: an export with no key is the normal case, not a mistake. ECC was never designed to sign a CSV. AS2 adds a signature in transit, but nothing records it once the file lands. Signing the receipt at the gate gives the export the same proof as a signed webhook, without changing the ERP. See SAP to Google over EDI for the IDoc route and a nightly SAP load through a bulk loader for the token side of the same job.

Workers, Turnstile and the WAF

The keys above prove who sent a request. Nothing so far stops a bot from filling in a public form or hammering a sign-in route. Three layers at the Cloudflare edge do that, and they run before the Worker spends any time on a request.

LayerStopsDoesn’t stopApplies to
WAF (managed rules, custom rules, rate limiting)Known attack patterns, floods, requests to admin paths from outsideA real browser driven by a scriptEverything on the zone, before the Worker runs
TurnstileAutomated form posts: sign-up, contact, review, sign-inA paid human solving it; a valid token replayed within 300 seconds if it isn’t checked server sidePages a person fills in
Worker checks (signatures, session tokens, Siteverify)Forged webhooks, calls from the wrong shop or site, tokens that don’t verifyAnything the WAF should have stopped firstEach route

Never put a challenge in front of a machine path. Shopify and Webflow webhooks, the app proxy and Designer Extension calls cannot solve a challenge. Exempt them from Turnstile and challenge rules, and rely on their signatures instead.

Turnstile on a Webflow site

Webflow has Turnstile built in. Under Site settings → Apps & Integrations, the “Cloudflare Turnstile spam protection” switches turn on bot blocking and spam filtering for every native form on the site. No site key is needed, and the site must be republished after either switch changes.

What each setting on this screen does:

SettingStateWhat it means
Cloudflare Turnstile spam protection: botsOnNative Webflow forms check a Turnstile token before accepting a submission
Turnstile: spam filteringOnSubmissions that pass the bot check are still scored, and spam is kept out of the form inbox. Turn this off if real submissions are being marked as spam
reCAPTCHA validationOff, no keysLeave off: Turnstile already covers the same forms. Turning it on makes every form without a reCAPTCHA field fail to submit
Restrict uploaded file accessOnFiles uploaded through forms open only for people logged in to the site (you, a client, collaborators). Turn it off only for an integration that must fetch the file, and know that the files become public
API access: CRM-BaseUsed within the last weekThe site token the CRM Sync Worker uses. Keep it in Worker secrets
API access: Config ManagerLast used 4 months agoAn unused token is a key with no owner. Revoke it, or record why it is kept
Webhooks(section below the tokens)Webhooks added here use the site token and are not signed; see the table above

Webflow’s built-in Turnstile covers native Webflow forms only. A form that posts straight to a Worker (a review form, the newsletter sign-up, a sign-in page served by the Worker) needs its own widget and its own Siteverify check.

Turnstile on a Worker route

  1. Create a widget in the Cloudflare dashboard under Turnstile → Add widget, listing the hostnames that will show it (for example crm-sync.dev). The dashboard gives a site key (public, goes in the page) and a secret key (private).
  2. Store the secret as a Worker secret, never in a page or wrangler.toml: npx wrangler secret put TURNSTILE_SECRET_KEY --config wrangler.toml --env="".
  3. Add the widget to the form: <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script> and <div class="cf-turnstile" data-sitekey="…" data-action="review-submit"></div>. The widget adds a cf-turnstile-response field to the form.
  4. In the Worker, call Siteverify before any other work and fail closed:
#[derive(serde::Deserialize)]
struct Siteverify { success: bool, hostname: Option<String>, action: Option<String> }

/// Turnstile Siteverify from a Worker (workers-rs). A token is single-use and valid for 300 seconds;
/// check the hostname and action too, so a token minted for another form or site is refused.
async fn turnstile_ok(token: &str, ip: Option<&str>, secret: &str, host: &str, action: &str) -> bool {
    if token.is_empty() || token.len() > 2048 { return false; }
    let mut form = vec![("secret", secret), ("response", token)];
    if let Some(ip) = ip { form.push(("remoteip", ip)); }
    let body = serde_urlencoded::to_string(&form).unwrap_or_default();
    let mut init = worker::RequestInit::new();
    init.with_method(worker::Method::Post).with_body(Some(body.into()));
    let mut headers = worker::Headers::new();
    let _ = headers.set("Content-Type", "application/x-www-form-urlencoded");
    init.with_headers(headers);
    let Ok(req) = worker::Request::new_with_init("https://challenges.cloudflare.com/turnstile/v0/siteverify", &init) else { return false };
    let Ok(mut res) = worker::Fetch::Request(req).send().await else { return false };
    match res.json::<Siteverify>().await {
        Ok(v) => v.success && v.hostname.as_deref() == Some(host) && v.action.as_deref() == Some(action),
        Err(_) => false,
    }
}
  1. Test with Cloudflare’s published test keys first (a site key that always passes, one that always fails), then switch to the real keys.

Turnstile setup links: Get started · Client-side rendering · Server-side validation (Siteverify) · Testing keys · Pre-clearance for WAF challenges · Turnstile in the dashboard

WAF rules for the Worker’s zone

These are recommended rules, written in Cloudflare’s rule language; adjust paths to the Worker’s routes. Order matters: exemptions first.

RuleExpressionAction
Machine paths skip challengesstarts_with(http.request.uri.path, "/webhooks/") or starts_with(http.request.uri.path, "/apps/")Skip: managed challenge and bot rules (signature checks run in the Worker)
Admin pagesstarts_with(http.request.uri.path, "/admin")Managed Challenge; the Worker still requires the crm_admin cookie
Sign-in and form postshttp.request.method eq "POST" and (starts_with(http.request.uri.path, "/auth/") or http.request.uri.path contains "/reviews")Rate limit: for example 10 requests per minute per IP, then block for 10 minutes
Managed rulesCloudflare Managed Ruleset (and the OWASP Core Ruleset on paid plans)Log first for a week, then block
Wrong countries for a regime (optional)ip.src.country in {"…"} and starts_with(http.request.uri.path, "/consent")Block, only where a residency rule requires it

Inside the Worker, the Rate Limiting binding ([[ratelimits]] in wrangler.toml) limits by any key the code knows, such as the shop domain or tenant, not just the IP. That is what keeps one tenant from using up another’s Shopify or Xano quota, which a per-IP WAF rule can’t do.

WAF links: Custom rules · Rate limiting rules · Managed rules · Workers Rate Limiting binding

The Shopify IP allowlist, seen from the Dev Dashboard

The allowlist is the outbound counterpart to the WAF. It limits where the app’s Admin API tokens can be used from, not who can reach the app. It is set per app in the Dev Dashboard under Settings → IP allowlist.

Feature on this screenWhat it doesFor an app on Cloudflare Workers
EnforcementOff: the policy is only tested. On: Admin API calls from anywhere else get 403Turn on only after Run test comes back clean
Always allowedDev previews on dev stores, and Direct API access from embedded admin pagesThe embedded app’s own browser calls don’t need an entry
IP addresses or CIDR rangesUp to 250 lines; IPv4 /16 or narrower, IPv6 /32 or narrowerCloudflare’s published ranges, split to fit: 47 entries (see Allowlisting an app that runs on Cloudflare)
Networks (ASN)Allow a provider’s whole networkLeave Cloudflare’s ASN 13335 out: Workers egress has no ASN in Shopify’s lookup, so it blocked every request in testing
Limit ASNs to countriesNarrows ASN entries to chosen countries; IP ranges aren’t affectedNot needed when no ASN is listed
Test against recent trafficReplays the policy against 30 days of Admin API calls and lists what would be blockedRun before each change; a Xano instance calling Shopify directly shows up here first

This screen is for the dropship reader app, a custom app, which is exempt from the public-app requirement; it is shown disabled for that reason. UCP, Reviews and PIM Sync, the public apps, have the 47 Cloudflare ranges in place and enforcement on.

Where the code is

CheckCode
Shopify webhook HMACworkers/crm-sync/src/index.ts, verifyShopifyHmac
Webflow webhook signatureworkers/crm-sync/src/index.ts, verifyWebflowSignature
Shopify session token (Thank you page)workers/crm-sync/src/index.ts, handleCheckoutAdsConsent
Constant-time compareworkers/crm-sync/src/index.ts, timingSafeEqualHex
Design Auth extension (bearer token today)extensions/design-auth/src/index.ts
Xano ads export, release gate, consent ledgerWorkspace 4: functions 115, 122, 123, 126; tables 183, 191, 192; API groups 69, 76

Checklist

  • Every secret generated, not typed; stored in Worker secrets or Xano env; recorded by fingerprint.
  • Shopify: webhook HMAC, session token dest/aud, OAuth hmac and app proxy signature all checked in constant time; two secrets held during a rotation.
  • Webflow: webhooks from the OAuth app (signed), not site-token webhooks; Designer Extension moved to getIdToken() + /v2/token/resolve; unused site tokens revoked.
  • Turnstile on every public form: Webflow’s switch for native forms, a widget plus Siteverify for Worker forms.
  • WAF: machine paths exempt from challenges; admin challenged; sign-in and form posts rate limited.
  • Shopify IP allowlist: Run test clean, then enforcement on, for every public app.
  • Key-less tools (Matrixify, Airtable, ERP exports): file landed in R2, hashed and signed under your kid, checked at the gate, handed over by a short-lived signed URL.

Data layer: ECC, Xano, Shopify and Google Cloud compared with Databricks, Snowflake and Fabric

The data layer in this book is ECC as the source, Xano as the system of record, Shopify as the storefront and Google Cloud (BigQuery, Merchant, Ads) for analytics and activation. Cloudflare Workers carry it at the edge. The usual alternative is a lakehouse or warehouse (Databricks, Snowflake or Microsoft Fabric) fed by ELT tools.

ECC + Xano + Shopify + Google CloudDatabricksSnowflakeMicrosoft Fabric
Shopify inShopify webhooks to Google Cloud Pub/Sub, then a BigQuery subscription into a table. BigQuery Data Transfer Service also has a Shopify connector, in Preview since 2026-01-28.Third-party ELT (Fivetran, Airbyte, Rivery, dlt), or Shopify → EventBridge → S3 → Auto LoaderThird-party ELT, or Shopify → EventBridge → S3 → SnowpipeNo native Shopify route: HTTPS webhooks into an Azure Function or Eventstreams, or ELT
Real timeShopify webhooks reach the Worker and Xano in seconds; Pub/Sub reaches BigQuery in near real timeNear real time only through an AWS event route you buildSame as DatabricksEventstreams, with an intake you build
Consent enforced in the pipeYes. The Worker verifies the webhook, checks consent and writes the ledger before anything lands. BigQuery gets only changed consent rows (crm_us.consent_log).Not by default. ELT copies what the API returns; policies apply after the data lands.Not by default. Masking and row-access policies apply after the data lands.Not by default. Purview policies apply after the data lands.
One consent decisionThe release gate in Xano, in front of every Google payload about a personBuilt in notebooks or Unity Catalog policies, downstream of the copyBuilt with masking and row-access policies, downstreamBuilt with Purview policies, downstream
ECC data inThe Rust converter in this book, from DD03L-shaped exports: typed and tested, no S/4HANA neededSAP connectors exist; the strongest assume S/4HANA and SAP Business Data CloudSAP connectors through partners; the same S/4HANA biasSAP mirroring and connectors; the same S/4HANA bias
Google activation (Merchant, Ads, Customer Match)Native: Merchant API, Google Ads and BigQuery are all Google, behind the release gateReverse-ETL tools (Hightouch, Census)Reverse-ETL toolsReverse-ETL tools
System of recordXano for customers, consent and products; the warehouse holds analytics onlyThe lakehouse tends to become the recordThe warehouse tends to become the recordOneLake tends to become the record
ResidencyPer-market BigQuery datasets (crm_us first); Xano instances per regionPer workspace regionPer account regionPer capacity region
Cost shapeWorkers, a Xano plan, BigQuery storage and queries: small to startCompute clusters plus ELT seatsCredits plus ELT seatsCapacity units plus ELT seats
Where it winsShopify and Google merchants, ECC shops without S/4HANA, consent-first commerceHeavy ML, data science teams, large-scale SparkEnterprise BI, data sharing, an existing Snowflake contractMicrosoft-standard enterprises: Power BI, Entra, Purview

One typed record, any destination

The converter turns ECC rows into Rust types once, with Serde derives on every struct. After that, the destination is a serializer, not a new integration: the same Product or customer record is written as whatever the target reads.

DestinationFormatToday
Google Merchant API v1JSON (productInputs)Built: src/merchant_api.rs, tests/merchant_api.rs
Merchant feed fileThe specification’s names and textBuilt: src/merchant.rs
XanoJSON records and CSV uploadsBuilt: xano-buildout
GraphQLschema.graphql from the same mapBuilt
BigQueryJSON rows (insertAll) or Pub/Sub messagesThrough the CRM Sync Worker
Databricks, Snowflake, FabricParquet or IcebergProposed: needs the Arrow / Parquet crates
Kafka, Pub/Sub, EventBridgeJSON or Avro messagesProposed

What stays fixed whatever the destination: names come from lib/naming.js, types from the DDIC (NUMC keeps its leading zeros, DATS 00000000 is None, amounts keep their scale), and the tests fail if a field goes missing. What doesn’t change either: any record about a person passes the release gate first. A new destination is a new output, never a way around consent.

Feeding the other three, governed

None of the three gets a consent-checked Shopify feed out of the box: ELT tools copy whatever the Admin API returns, and EventBridge or Pub/Sub deliver every event whatever the person’s consent. The same Worker intake can feed them, so a Databricks, Snowflake or Fabric shop keeps its warehouse and gets a governed Shopify feed:

Shopify webhook ─▶ Cloudflare Worker (verify HMAC, enforce consent, write ledger) ─▶ Xano (system of record)
                                                                          └─▶ Parquet / Iceberg in R2 or the client's S3
                                                                                └─▶ Databricks · Snowflake · Fabric · BigQuery

Today the Worker streams to Xano and BigQuery only. The Parquet / Iceberg export is proposed, not built. Cloudflare R2 can serve Iceberg tables through its catalog, which Snowflake and Databricks both read, so the export needs no new storage.

Cloudflare Basin compared with BigQuery

Cloudflare’s lake (now Basin: Basin Pipelines, Basin Catalog and Basin SQL, formerly Pipelines, R2 Data Catalog and R2 SQL) is open storage and a catalog at the edge, with no egress fees and a read-only query engine. BigQuery and the three platforms above are compute platforms: they write, transform, run ML and apply fine-grained access rules.

Cloudflare Basin (R2 + Iceberg)BigQuery
StorageParquet in R2, with an Iceberg REST catalog any Iceberg engine can readNative storage; BigLake Iceberg tables and external tables as options
IngestBasin Pipelines: streaming events with SQL transforms, fed straight from WorkersData Transfer Service connectors (Shopify, YouTube, Merchant Center, Ads), streaming, loads
QueryBasin SQL: distributed, read-only (Apache DataFusion); no Workers binding, queried by fetch()Full SQL with DML, BigQuery ML, Gemini
WritesPipelines, or an external engine (PyIceberg, Spark)INSERT, MERGE, UPDATE
EgressNone on R2Charged when data leaves Google Cloud
Fine-grained accessToken scope per bucket and catalog; no row-level security or column maskingRow-level security, policy tags, dynamic masking
ResidencyBucket jurisdiction (R2 has an EU jurisdiction); check the catalog and query engine follow itRegional and multi-region datasets
MaintenanceYou enable compaction and snapshot expiry; file count drives query timeManaged

What each is for in this layer

JobBetter fit
Edge events, consent and gate receipts, cheap long-term logsBasin
Shopify, YouTube, Merchant and Ads joins, segments, BigQuery MLBigQuery
One open copy of ECC extracts, read by several engines without egressR2 and Iceberg
Heavy transforms and an enterprise catalogDatabricks or Snowflake

Two consequences:

  • Basin has no column or row policies, so the release gate does that job. Keep personal data out of Basin, or pseudonymise it before Pipelines writes it: cohorts, receipts and hashed keys, not identities. See Function gating across clouds.
  • BigQuery doesn’t read R2 directly, as far as the current docs show (BigQuery Omni covers AWS S3 and Azure). Data for BigQuery is copied to Google Cloud Storage or loaded; Snowflake and Databricks read R2 through its S3-compatible API.

Basin was renamed recently and its docs are mid-migration: check pricing, limits and jurisdiction support on developers.cloudflare.com before quoting them.

Reading the table fairly

  • “Not by default” is not “can’t”. Each of the three can enforce policies once data has landed. The difference is where: here the check runs before anything is copied, and the ledger records why.
  • The ECC row is where this layer differs most. The other three platforms’ SAP paths mostly assume S/4HANA; this one works from ECC as it runs today. See An alternative to a full S/4HANA upgrade.
  • BigQuery’s own Shopify connector is in Preview; Fivetran and others list generally available connectors on the Google Cloud Marketplace. Sources: Load Shopify data into BigQuery, BigQuery release notes.

ERP programmes in public: penalties and lessons

Six companies whose SAP programmes are on the public record, with what each cost where it was reported. Only one is a clean case of an SAP rollout hurting the business. The others are a non-SAP add-on, a supply-network merger, two licence disputes over how other systems reached SAP data, and a consent fine with no ERP failure. Each has a lesson for a layer like the one in An alternative to a full S/4HANA upgrade.

CompanyWhere it failedSAP programmeWhat happenedPenalty or cost (as reported)Lesson for an ECC → Xano layer
RevlonE-commerce and channels: orders the ERP couldn’t fillSAP rollout at its Oxford, North Carolina plant, 2018Failure. Production and shipping were disrupted; a material weakness in financial reporting was disclosed, and the share price fell.About $54M in expenses to remedy the disruption, including about $10M in incremental production and labour costs; a shareholder class action alleges about $64M of net sales went unfulfilled.The ERP cutover reached customers. Keep commerce and feeds off the ERP’s critical path at go-live.
NikeGlobal channels: demand forecast wrong, too much of some shoes and too little of othersSAP as the ERP backbone, with i2 for demand planning, 2000–2001Failure, in the i2 add-on, not SAP. Nike moved its short- and medium-range planning into SAP afterwards.$80M to more than $100M in lost sales; the share price fell about 20%; class actions followed.Often misquoted as an SAP failure. A rushed, customised layer beside the ERP can fail on its own: build the layer to fixed, tested rules.
Coty (Kylie Cosmetics)Global: warehouses and planning consolidated across Europe and the USIntegrating about 40 P&G beauty brands, 2016–2019Supply-chain disruption. Coty attributed it to consolidating warehouses and planning centres; no source found blames SAP.About $150M hit from the disruptions (reported 2019).Kylie Cosmetics, launched on Shopify in 2015 and 51% bought by Coty for $600M in 2019, ran on its own. The trouble came when back-end operations were consolidated: keep the storefront’s record separate from the ERP merger.
DiageoGovernance: other channel systems reaching SAP dataRISE with SAP S/4HANA, a five-year programme with IBM from 2023In progress, not a failure. Earlier, in SAP v Diageo (2017), the UK High Court held that Diageo’s Salesforce-based systems accessing SAP data needed SAP licences (“indirect access”).£54.5M in additional licence fees (2017 ruling).The risk to check for this layer: non-SAP systems reading SAP data can carry licence fees. Read the client’s SAP contract terms on indirect or digital access before the exports start.
AB InBevGovernance: other systems reaching SAP dataSAP S/4HANA migration, prepared with Celonis process mining from 2018No reported migration failure; a licence dispute. In 2017 SAP claimed AB InBev breached its 2010 licence through unlicensed direct and indirect access to SAP systems and data, and underpaid fees.SAP sought damages of more than $600M. Settled on 30 June 2017; terms not disclosed.The same lesson as Diageo, at a larger claim: how other systems reach SAP data is a licence question. Settle it in the contract before any export or integration runs. Mapping processes before migrating (about 100 changes designed in) is the part that went well.
HondaGovernance: consent on the web channel and ad-tech vendorsHonda Australia: two divisions onto one S/4HANA core. Sundiro Honda (China): SAP Commerce Cloud, 2021No reported ERP failure; a consent penalty. In March 2025 California’s privacy regulator (CPPA) found American Honda’s cookie tool took two steps to opt out of advertising cookies and one to opt back in, asked for more information than needed to act on privacy requests, and had no compliant contracts with its ad-tech vendors.$632,500 fine under the CCPA (2025), plus changes to its consent tool and request process. Honda did not admit most findings.The penalty was in the consent layer, not the ERP. Opting out must be as easy as opting in, and every vendor that receives the data needs a contract: the banner and the release gate are where that is enforced.

The common thread

None of these is an ERP failing on its own terms. Each broke where the ERP meets the channels around it: e-commerce and retail orders it had to fill, the same products planned and shipped across global markets, and the governance that has to hold across every channel (licences for the systems that read ERP data, and consent for the people the channels reach).

RequirementWhat it takesCases
E-commerceOrders and feeds keep flowing while the ERP and the commerce APIs change underneathRevlon, and the escalation below
GlobalOne product record, priced, planned and stocked per marketNike, Coty
GovernanceLicences settled for every system that reads ERP data; consent enforced the same way on every channelDiageo, AB InBev, Honda

That is the scope of the layer in this book: the record that faces the channels (products, customers, consent) lives in Xano, is carried at the edge by Cloudflare, and passes one release gate, so the ERP can change without the channels breaking and every channel answers to the same rules. See An alternative to a full S/4HANA upgrade.

The next escalation: e-commerce, then agentic commerce

The ERP-to-e-commerce integration is where the next failures are scheduled. The commerce side is changing its data shapes and its credentials on fixed dates, whatever the ERP is doing:

ChangeDateWhat breaks in an SAP integration
Shopify’s REST Admin API is legacy; new public apps must use GraphQL onlyLegacy since 2024-10-01; GraphQL-only for new public apps since 2025-04-01Every mapping written against REST payloads: IDs become global IDs (gid://shopify/...), amounts become money objects, lists become cursor-paged connections
Shopify replaces non-expiring offline tokens with expiring ones (1 hour, with a 90-day refresh token)New public apps since 2026-04-01; all public apps by 2027-01-01; Admin API calls with the old tokens rejected from 2027-04-01Middleware that stored one token and never refreshed it stops: every call returns 403
GA4 renames and reshapes: conversion events become key events; Google recommends the Data Manager API over the Measurement Protocol for new server-to-server integrationsOngoing through 2026Revenue and conversion feeds built on the old event names and endpoints

Agentic commerce is the bigger problem. When an AI agent places the order through Shopify and Google’s UCP or Stripe’s ACP, the ERP integration has to accept an order that carries who authorised it, under which consent, and with which limits, and every channel has to answer to the same rules for an agent as for a person. That is governance multiplied by every agent, on top of the data-shape and token changes above.

The layer in this book takes both off the ERP: the GraphQL shapes and token refresh live in the Worker and Xano, the converted ECC record stays the same, and the release gate decides for agents as it does for people.

Reading the table

  • Penalties are as reported, not audited. Revlon’s $64M is an allegation in a shareholder suit; Nike’s loss is its own estimate, and sources give a range. Coty’s $150M is not attributed to an ERP.
  • Consent fines and wiretap suits are separate. Honda’s fine came from the regulator under the CCPA. California’s wiretap law (CIPA) is a different route: private suits over tracking that runs before or despite consent, with statutory damages of up to $5,000 per violation. No CIPA suit against Honda was found; in 2026 one was filed against Toyota, alleging tracking continued after visitors chose “decline”. Both point at the same control: nothing loads or sends before the consent decision, and a refusal is honoured everywhere.
  • The licence point applies to any layer. The exports in this book are batch extracts, not live users of SAP, but how a contract counts them is for the contract to say. SAP v Diageo and SAP’s claim against AB InBev, both in 2017, are why the question comes first. SAP changed its licensing model for indirect access in 2018 after customer pushback; which model a contract uses decides how exports are counted.

Licensing penalties by flow

Running SAP on external VMs carries no penalty of its own: SAP supports AWS, Azure and GCP. The costs come from four other places, and for a layer like this book’s, the first is the one that matters.

1. Other systems using SAP data. Under older user-based contracts, a non-SAP system reading or writing SAP data on behalf of people can be counted as needing SAP user licences: that is the Diageo and AB InBev lesson in the table above. SAP’s Digital Access model (2018) counts documents created in SAP by other systems instead, in nine types: sales, invoice, purchase, service and maintenance, manufacturing, quality management, time management, financial and material documents. Reading is generally not counted. Each flow in this book, under that model:

FlowExposure under Digital Access
ECC → Rust → Google Merchant (read materials, prices, stock)Low: a read
ECC → Xano for identity and blockingLow: a read
ECC → BigQuery extractsLow: a read
Shopify order → ECC sales order (VBAK / VBAP)Counted: a sales document, then deliveries and invoices follow
Returns and refunds posted to ECCCounted: sales, financial and material documents
Consent written to ECCAvoided by design: ECC never holds consent

Which model a contract uses decides how any of these is counted; a customer still on user-based licensing, never moved to Digital Access, carries the most risk. Read the contract before any flow that writes to SAP.

2. Certified VMs. SAP supports HANA and S/4HANA only on certified instance types and sizes for each cloud. An uncertified VM costs no fee, but support can be declined until a problem is reproduced on a supported setup.

3. HANA memory. HANA licences are often sized by memory. A larger VM costs nothing by itself; giving HANA more memory than is licensed leads to a true-up.

4. Network, contract and maintenance.

  • Egress. Moving SAP data between clouds or regions (S/4 on one cloud, BigQuery on another) incurs the provider’s data-transfer charges. Send deltas, not full extracts.
  • RISE with SAP. SAP runs the infrastructure; your own VMs can’t sit inside it, but they can connect to it. Extensions are expected on BTP and paid for with BTP credits. Running them on your own VMs or Kubernetes is allowed; point 1 still applies.
  • ECC maintenance. Mainstream maintenance ends in 2027; extended maintenance to 2030 costs about 2% a year more. Where the VMs run doesn’t change this; staying on ECC does. See An alternative to a full S/4HANA upgrade.
PenaltyTriggerHow to avoid it
Indirect / Digital Access feesOther systems creating SAP documentsRead-mostly flows; settle the licence model before writing orders back
Support declinedAn uncertified VM typeCertified instance types only
HANA licence true-upHANA memory beyond the licenceSize HANA to the licence
Egress chargesSAP data moved between clouds or regionsOne region per regime; deltas, not full extracts
Extended maintenance (about 2% a year)ECC past 2027Plan the move, or the alternative in this book

These are general terms as publicly reported; every contract differs. Confirm with the customer’s SAP account team or a licensing adviser before quoting any of them.

Sources

SAP standard tables

Module abap_to_rust::sap.

ABAP tableRustFieldsDescription
KNA1sap::Kna113General Data in Customer Master
ADR6sap::Adr68E-Mail Addresses (Business Address Services)
VBAKsap::Vbak8Sales Document: Header Data
KNVVsap::Knvv9Customer Master Sales Data
ADRCsap::Adrc13Addresses (Business Address Services)
VBAPsap::Vbap10Sales Document: Item Data
MARAsap::Mara19General Material Data
MAKTsap::Makt4Material Descriptions
CDHDRsap::Cdhdr9Change document header
CDPOSsap::Cdpos10Change document items
MARMsap::Marm13Units of Measure for Material
MARDsap::Mard7Storage Location Data for Material
MBEWsap::Mbew8Material Valuation
A004sap::A0049Material (sales organization / distribution channel / material)
KONPsap::Konp9Conditions (Item)
T001Wsap::T001w5Plants/Branches
TCURXsap::Tcurx2Decimal Places in Currencies
T179Tsap::T179t4Materials: Product Hierarchies: Texts

KNA1 → sap::Kna1

General Data in Customer Master

Key: MANDT + KUNNR

ABAP fieldRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
KUNNR (key)kunnrStringCHAR 10KUNNRCustomer Number
LAND1land1StringCHAR 3LAND1_GPCountry Key
NAME1name1StringCHAR 35NAME1_GPName 1
ORT01ort01StringCHAR 35ORT01_GPCity
PSTLZpstlzStringCHAR 10PSTLZPostal Code
REGIOregioStringCHAR 3REGIORegion
SPRASsprasStringLANG 1SPRASLanguage Key
ADRNRadrnrStringCHAR 10ADRNRAddress
ERDATerdatOption<chrono::NaiveDate>DATS 8ERDAT_RFCreated On
LOEVMloevmboolCHAR 1LOEVM_XCentral Deletion Flag
ZZ_MKT_OPTINzz_mkt_optinboolCHAR 1XFELDMarketing opt-in (custom append)
/ACME/GPCacme_gpcboolCHAR 1XFELDGlobal Privacy Control seen (namespaced append)

Generated Rust

// abap_to_rust::sap::Kna1
/// `KNA1`: General Data in Customer Master
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Kna1 {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `KUNNR` CHAR 10 (key): Customer Number
    #[serde(rename = "KUNNR")]
    pub kunnr: String,
    /// `LAND1` CHAR 3: Country Key
    #[serde(rename = "LAND1", default)]
    pub land1: String,
    /// `NAME1` CHAR 35: Name 1
    #[serde(rename = "NAME1", default)]
    pub name1: String,
    /// `ORT01` CHAR 35: City
    #[serde(rename = "ORT01", default)]
    pub ort01: String,
    /// `PSTLZ` CHAR 10: Postal Code
    #[serde(rename = "PSTLZ", default)]
    pub pstlz: String,
    /// `REGIO` CHAR 3: Region
    #[serde(rename = "REGIO", default)]
    pub regio: String,
    /// `SPRAS` LANG 1: Language Key
    #[serde(rename = "SPRAS", default)]
    pub spras: String,
    /// `ADRNR` CHAR 10: Address
    #[serde(rename = "ADRNR", default)]
    pub adrnr: String,
    /// `ERDAT` DATS 8: Created On
    #[serde(rename = "ERDAT", default, with = "crate::abap::dats")]
    pub erdat: Option<chrono::NaiveDate>,
    /// `LOEVM` CHAR 1: Central Deletion Flag
    #[serde(rename = "LOEVM", default, with = "crate::abap::xflag")]
    pub loevm: bool,
    /// `ZZ_MKT_OPTIN` CHAR 1: Marketing opt-in (custom append)
    #[serde(rename = "ZZ_MKT_OPTIN", default, with = "crate::abap::xflag")]
    pub zz_mkt_optin: bool,
    /// `/ACME/GPC` CHAR 1: Global Privacy Control seen (namespaced append)
    #[serde(rename = "/ACME/GPC", default, with = "crate::abap::xflag")]
    pub acme_gpc: bool,
}

impl Kna1 {
    pub const TABNAME: &'static str = "KNA1";
    pub const KEY: &'static [&'static str] = &["MANDT", "KUNNR"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("KUNNR", "kunnr"), ("LAND1", "land1"), ("NAME1", "name1"), ("ORT01", "ort01"), ("PSTLZ", "pstlz"), ("REGIO", "regio"), ("SPRAS", "spras"), ("ADRNR", "adrnr"), ("ERDAT", "erdat"), ("LOEVM", "loevm"), ("ZZ_MKT_OPTIN", "zz_mkt_optin"), ("/ACME/GPC", "acme_gpc")];
}

Sample record

As exported, with ABAP names and internal formats (fixtures/records/kna1.json, read by tests/convert.rs):

{"MANDT":"100","KUNNR":"0000012345","LAND1":"US","NAME1":"Example Retail Inc.","ORT01":"Los Angeles","PSTLZ":"90010","REGIO":"CA","SPRAS":"E","ADRNR":"0000098765","ERDAT":"20240115","LOEVM":"","ZZ_MKT_OPTIN":"X","/ACME/GPC":""}

ADR6 → sap::Adr6

E-Mail Addresses (Business Address Services)

Key: CLIENT + ADDRNUMBER + PERSNUMBER + DATE_FROM + CONSNUMBER

ABAP fieldRust fieldRust typeDDICData elementDescription
CLIENT (key)clientStringCLNT 3MANDTClient
ADDRNUMBER (key)addrnumberStringCHAR 10AD_ADDRNUMAddress Number
PERSNUMBER (key)persnumberStringCHAR 10AD_PERSNUMPerson Number
DATE_FROM (key)date_fromOption<chrono::NaiveDate>DATS 8AD_DATE_FRValid From
CONSNUMBER (key)consnumberStringNUMC 3AD_CONSNUMSequence Number
FLGDEFAULTflgdefaultboolCHAR 1AD_FLGDFNRDefault Address
FLG_NOUSEflg_nouseboolCHAR 1AD_FLNOUSEDo Not Use
SMTP_ADDRsmtp_addrStringCHAR 241AD_SMTPADRE-Mail Address

Generated Rust

// abap_to_rust::sap::Adr6
/// `ADR6`: E-Mail Addresses (Business Address Services)
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Adr6 {
    /// `CLIENT` CLNT 3 (key): Client
    #[serde(rename = "CLIENT")]
    pub client: String,
    /// `ADDRNUMBER` CHAR 10 (key): Address Number
    #[serde(rename = "ADDRNUMBER")]
    pub addrnumber: String,
    /// `PERSNUMBER` CHAR 10 (key): Person Number
    #[serde(rename = "PERSNUMBER")]
    pub persnumber: String,
    /// `DATE_FROM` DATS 8 (key): Valid From
    #[serde(rename = "DATE_FROM", with = "crate::abap::dats")]
    pub date_from: Option<chrono::NaiveDate>,
    /// `CONSNUMBER` NUMC 3 (key): Sequence Number
    #[serde(rename = "CONSNUMBER")]
    pub consnumber: String,
    /// `FLGDEFAULT` CHAR 1: Default Address
    #[serde(rename = "FLGDEFAULT", default, with = "crate::abap::xflag")]
    pub flgdefault: bool,
    /// `FLG_NOUSE` CHAR 1: Do Not Use
    #[serde(rename = "FLG_NOUSE", default, with = "crate::abap::xflag")]
    pub flg_nouse: bool,
    /// `SMTP_ADDR` CHAR 241: E-Mail Address
    #[serde(rename = "SMTP_ADDR", default)]
    pub smtp_addr: String,
}

impl Adr6 {
    pub const TABNAME: &'static str = "ADR6";
    pub const KEY: &'static [&'static str] = &["CLIENT", "ADDRNUMBER", "PERSNUMBER", "DATE_FROM", "CONSNUMBER"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("CLIENT", "client"), ("ADDRNUMBER", "addrnumber"), ("PERSNUMBER", "persnumber"), ("DATE_FROM", "date_from"), ("CONSNUMBER", "consnumber"), ("FLGDEFAULT", "flgdefault"), ("FLG_NOUSE", "flg_nouse"), ("SMTP_ADDR", "smtp_addr")];
}

Sample record

As exported, with ABAP names and internal formats (fixtures/records/adr6.json, read by tests/convert.rs):

{"CLIENT":"100","ADDRNUMBER":"0000098765","PERSNUMBER":"","DATE_FROM":"00010101","CONSNUMBER":"001","FLGDEFAULT":"X","FLG_NOUSE":"","SMTP_ADDR":"orders@example.com"}

VBAK → sap::Vbak

Sales Document: Header Data

Key: MANDT + VBELN

ABAP fieldRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
VBELN (key)vbelnStringCHAR 10VBELN_VASales Document
ERDATerdatOption<chrono::NaiveDate>DATS 8ERDATCreated On
ERZETerzetOption<chrono::NaiveTime>TIMS 6ERZETEntry Time
AUARTauartStringCHAR 4AUARTSales Document Type
KUNNRkunnrStringCHAR 10KUNAGSold-To Party
NETWRnetwrrust_decimal::DecimalCURR 15,2NETWR_AKNet Value
WAERKwaerkStringCUKY 5WAERKDocument Currency

Generated Rust

// abap_to_rust::sap::Vbak
/// `VBAK`: Sales Document: Header Data
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Vbak {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `VBELN` CHAR 10 (key): Sales Document
    #[serde(rename = "VBELN")]
    pub vbeln: String,
    /// `ERDAT` DATS 8: Created On
    #[serde(rename = "ERDAT", default, with = "crate::abap::dats")]
    pub erdat: Option<chrono::NaiveDate>,
    /// `ERZET` TIMS 6: Entry Time
    #[serde(rename = "ERZET", default, with = "crate::abap::tims")]
    pub erzet: Option<chrono::NaiveTime>,
    /// `AUART` CHAR 4: Sales Document Type
    #[serde(rename = "AUART", default)]
    pub auart: String,
    /// `KUNNR` CHAR 10: Sold-To Party
    #[serde(rename = "KUNNR", default)]
    pub kunnr: String,
    /// `NETWR` CURR 15,2: Net Value
    #[serde(rename = "NETWR", default)]
    pub netwr: rust_decimal::Decimal,
    /// `WAERK` CUKY 5: Document Currency
    #[serde(rename = "WAERK", default)]
    pub waerk: String,
}

impl Vbak {
    pub const TABNAME: &'static str = "VBAK";
    pub const KEY: &'static [&'static str] = &["MANDT", "VBELN"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("VBELN", "vbeln"), ("ERDAT", "erdat"), ("ERZET", "erzet"), ("AUART", "auart"), ("KUNNR", "kunnr"), ("NETWR", "netwr"), ("WAERK", "waerk")];
}

Sample record

As exported, with ABAP names and internal formats (fixtures/records/vbak.json, read by tests/convert.rs):

{"MANDT":"100","VBELN":"0000500123","ERDAT":"20261104","ERZET":"101500","AUART":"OR","KUNNR":"0000012345","NETWR":"258.00","WAERK":"USD"}

KNVV → sap::Knvv

Customer Master Sales Data

Key: MANDT + KUNNR + VKORG + VTWEG + SPART

ABAP fieldRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
KUNNR (key)kunnrStringCHAR 10KUNNRCustomer Number
VKORG (key)vkorgStringCHAR 4VKORGSales Organization
VTWEG (key)vtwegStringCHAR 2VTWEGDistribution Channel
SPART (key)spartStringCHAR 2SPARTDivision
KDGRPkdgrpStringCHAR 2KDGRPCustomer Group
WAERSwaersStringCUKY 5WAERS_V02DCurrency
AUFSDaufsdStringCHAR 2AUFSD_VOrder Block for Sales Area
LOEVMloevmboolCHAR 1LOEVM_VDeletion Flag for Sales Area

Generated Rust

// abap_to_rust::sap::Knvv
/// `KNVV`: Customer Master Sales Data
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Knvv {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `KUNNR` CHAR 10 (key): Customer Number
    #[serde(rename = "KUNNR")]
    pub kunnr: String,
    /// `VKORG` CHAR 4 (key): Sales Organization
    #[serde(rename = "VKORG")]
    pub vkorg: String,
    /// `VTWEG` CHAR 2 (key): Distribution Channel
    #[serde(rename = "VTWEG")]
    pub vtweg: String,
    /// `SPART` CHAR 2 (key): Division
    #[serde(rename = "SPART")]
    pub spart: String,
    /// `KDGRP` CHAR 2: Customer Group
    #[serde(rename = "KDGRP", default)]
    pub kdgrp: String,
    /// `WAERS` CUKY 5: Currency
    #[serde(rename = "WAERS", default)]
    pub waers: String,
    /// `AUFSD` CHAR 2: Order Block for Sales Area
    #[serde(rename = "AUFSD", default)]
    pub aufsd: String,
    /// `LOEVM` CHAR 1: Deletion Flag for Sales Area
    #[serde(rename = "LOEVM", default, with = "crate::abap::xflag")]
    pub loevm: bool,
}

impl Knvv {
    pub const TABNAME: &'static str = "KNVV";
    pub const KEY: &'static [&'static str] = &["MANDT", "KUNNR", "VKORG", "VTWEG", "SPART"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("KUNNR", "kunnr"), ("VKORG", "vkorg"), ("VTWEG", "vtweg"), ("SPART", "spart"), ("KDGRP", "kdgrp"), ("WAERS", "waers"), ("AUFSD", "aufsd"), ("LOEVM", "loevm")];
}

ADRC → sap::Adrc

Addresses (Business Address Services)

Key: CLIENT + ADDRNUMBER + DATE_FROM + NATION

ABAP fieldRust fieldRust typeDDICData elementDescription
CLIENT (key)clientStringCLNT 3MANDTClient
ADDRNUMBER (key)addrnumberStringCHAR 10AD_ADDRNUMAddress Number
DATE_FROM (key)date_fromOption<chrono::NaiveDate>DATS 8AD_DATE_FRValid From
NATION (key)nationStringCHAR 1AD_NATIONAddress Version
NAME1name1StringCHAR 40AD_NAME1Name 1
CITY1city1StringCHAR 40AD_CITY1City
POST_CODE1post_code1StringCHAR 10AD_PSTCD1Postal Code
STREETstreetStringCHAR 60AD_STREETStreet
COUNTRYcountryStringCHAR 3LAND1Country Key
REGIONregionStringCHAR 3REGIORegion
LANGUlanguStringLANG 1SPRASLanguage Key
TEL_NUMBERtel_numberStringCHAR 30AD_TLNMBR1Telephone
DEFLT_COMMdeflt_commStringCHAR 3AD_COMMCommunication Method

Generated Rust

// abap_to_rust::sap::Adrc
/// `ADRC`: Addresses (Business Address Services)
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Adrc {
    /// `CLIENT` CLNT 3 (key): Client
    #[serde(rename = "CLIENT")]
    pub client: String,
    /// `ADDRNUMBER` CHAR 10 (key): Address Number
    #[serde(rename = "ADDRNUMBER")]
    pub addrnumber: String,
    /// `DATE_FROM` DATS 8 (key): Valid From
    #[serde(rename = "DATE_FROM", with = "crate::abap::dats")]
    pub date_from: Option<chrono::NaiveDate>,
    /// `NATION` CHAR 1 (key): Address Version
    #[serde(rename = "NATION")]
    pub nation: String,
    /// `NAME1` CHAR 40: Name 1
    #[serde(rename = "NAME1", default)]
    pub name1: String,
    /// `CITY1` CHAR 40: City
    #[serde(rename = "CITY1", default)]
    pub city1: String,
    /// `POST_CODE1` CHAR 10: Postal Code
    #[serde(rename = "POST_CODE1", default)]
    pub post_code1: String,
    /// `STREET` CHAR 60: Street
    #[serde(rename = "STREET", default)]
    pub street: String,
    /// `COUNTRY` CHAR 3: Country Key
    #[serde(rename = "COUNTRY", default)]
    pub country: String,
    /// `REGION` CHAR 3: Region
    #[serde(rename = "REGION", default)]
    pub region: String,
    /// `LANGU` LANG 1: Language Key
    #[serde(rename = "LANGU", default)]
    pub langu: String,
    /// `TEL_NUMBER` CHAR 30: Telephone
    #[serde(rename = "TEL_NUMBER", default)]
    pub tel_number: String,
    /// `DEFLT_COMM` CHAR 3: Communication Method
    #[serde(rename = "DEFLT_COMM", default)]
    pub deflt_comm: String,
}

impl Adrc {
    pub const TABNAME: &'static str = "ADRC";
    pub const KEY: &'static [&'static str] = &["CLIENT", "ADDRNUMBER", "DATE_FROM", "NATION"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("CLIENT", "client"), ("ADDRNUMBER", "addrnumber"), ("DATE_FROM", "date_from"), ("NATION", "nation"), ("NAME1", "name1"), ("CITY1", "city1"), ("POST_CODE1", "post_code1"), ("STREET", "street"), ("COUNTRY", "country"), ("REGION", "region"), ("LANGU", "langu"), ("TEL_NUMBER", "tel_number"), ("DEFLT_COMM", "deflt_comm")];
}

VBAP → sap::Vbap

Sales Document: Item Data

Key: MANDT + VBELN + POSNR

ABAP fieldRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
VBELN (key)vbelnStringCHAR 10VBELN_VASales Document
POSNR (key)posnrStringNUMC 6POSNR_VASales Document Item
MATNRmatnrStringCHAR 18MATNRMaterial Number
ARKTXarktxStringCHAR 40ARKTXShort Text
KWMENGkwmengrust_decimal::DecimalQUAN 15,3KWMENGOrder Quantity
VRKMEvrkmeStringUNIT 3VRKMESales Unit
NETWRnetwrrust_decimal::DecimalCURR 15,2NETWR_APNet Value
WAERKwaerkStringCUKY 5WAERKDocument Currency
WERKSwerksStringCHAR 4WERKS_EXTPlant

Generated Rust

// abap_to_rust::sap::Vbap
/// `VBAP`: Sales Document: Item Data
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Vbap {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `VBELN` CHAR 10 (key): Sales Document
    #[serde(rename = "VBELN")]
    pub vbeln: String,
    /// `POSNR` NUMC 6 (key): Sales Document Item
    #[serde(rename = "POSNR")]
    pub posnr: String,
    /// `MATNR` CHAR 18: Material Number
    #[serde(rename = "MATNR", default)]
    pub matnr: String,
    /// `ARKTX` CHAR 40: Short Text
    #[serde(rename = "ARKTX", default)]
    pub arktx: String,
    /// `KWMENG` QUAN 15,3: Order Quantity
    #[serde(rename = "KWMENG", default)]
    pub kwmeng: rust_decimal::Decimal,
    /// `VRKME` UNIT 3: Sales Unit
    #[serde(rename = "VRKME", default)]
    pub vrkme: String,
    /// `NETWR` CURR 15,2: Net Value
    #[serde(rename = "NETWR", default)]
    pub netwr: rust_decimal::Decimal,
    /// `WAERK` CUKY 5: Document Currency
    #[serde(rename = "WAERK", default)]
    pub waerk: String,
    /// `WERKS` CHAR 4: Plant
    #[serde(rename = "WERKS", default)]
    pub werks: String,
}

impl Vbap {
    pub const TABNAME: &'static str = "VBAP";
    pub const KEY: &'static [&'static str] = &["MANDT", "VBELN", "POSNR"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("VBELN", "vbeln"), ("POSNR", "posnr"), ("MATNR", "matnr"), ("ARKTX", "arktx"), ("KWMENG", "kwmeng"), ("VRKME", "vrkme"), ("NETWR", "netwr"), ("WAERK", "waerk"), ("WERKS", "werks")];
}

MARA → sap::Mara

General Material Data

Key: MANDT + MATNR

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
MATNR (key)idmatnrStringCHAR 18MATNRMaterial Number
ERSDAersdaOption<chrono::NaiveDate>DATS 8ERSDACreated On
LVORMlvormboolCHAR 1LVOMADeletion Flag at Client Level
MTARTmtartStringCHAR 4MTARTMaterial Type
MATKLgoogle_product_categorymatklStringCHAR 9MATKLMaterial Group
MEINSmeinsStringUNIT 3MEINSBase Unit of Measure
BRGEWshipping_weightbrgewrust_decimal::DecimalQUAN 13,3BRGEWGross Weight
GEWEIproduct_weight shipping_weightgeweiStringUNIT 3GEWEIWeight Unit
NTGEWproduct_weightntgewrust_decimal::DecimalQUAN 13,3NTGEWNet Weight
EAN11gtin identifier_existsean11StringCHAR 18EAN11International Article Number (EAN/UPC)
NUMTPgtinnumtpStringCHAR 2NUMTPCategory of EAN
MFRNRbrandmfrnrStringCHAR 10MFRNRManufacturer (vendor number)
MFRPNmpn identifier_existsmfrpnStringCHAR 40MFRPNManufacturer Part Number
PRDHAproduct_typeprdhaStringCHAR 18PRODH_DProduct Hierarchy
WRKSTmaterialwrkstStringCHAR 48WRKSTBasic Material
SATNRitem_group_idsatnrStringCHAR 18SATNRGeneric Article (IS-Retail)
INHALunit_pricing_measureinhalrust_decimal::DecimalQUAN 13,3INHALNet Contents (IS-Retail)
INHMEunit_pricing_measureinhmeStringUNIT 3INHMEContent Unit (IS-Retail)

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::Mara
/// `MARA`: General Material Data
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Mara {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `MATNR` CHAR 18 (key): Material Number
    #[serde(rename = "MATNR")]
    pub matnr: String,
    /// `ERSDA` DATS 8: Created On
    #[serde(rename = "ERSDA", default, with = "crate::abap::dats")]
    pub ersda: Option<chrono::NaiveDate>,
    /// `LVORM` CHAR 1: Deletion Flag at Client Level
    #[serde(rename = "LVORM", default, with = "crate::abap::xflag")]
    pub lvorm: bool,
    /// `MTART` CHAR 4: Material Type
    #[serde(rename = "MTART", default)]
    pub mtart: String,
    /// `MATKL` CHAR 9: Material Group
    #[serde(rename = "MATKL", default)]
    pub matkl: String,
    /// `MEINS` UNIT 3: Base Unit of Measure
    #[serde(rename = "MEINS", default)]
    pub meins: String,
    /// `BRGEW` QUAN 13,3: Gross Weight
    #[serde(rename = "BRGEW", default)]
    pub brgew: rust_decimal::Decimal,
    /// `GEWEI` UNIT 3: Weight Unit
    #[serde(rename = "GEWEI", default)]
    pub gewei: String,
    /// `NTGEW` QUAN 13,3: Net Weight
    #[serde(rename = "NTGEW", default)]
    pub ntgew: rust_decimal::Decimal,
    /// `EAN11` CHAR 18: International Article Number (EAN/UPC)
    #[serde(rename = "EAN11", default)]
    pub ean11: String,
    /// `NUMTP` CHAR 2: Category of EAN
    #[serde(rename = "NUMTP", default)]
    pub numtp: String,
    /// `MFRNR` CHAR 10: Manufacturer (vendor number)
    #[serde(rename = "MFRNR", default)]
    pub mfrnr: String,
    /// `MFRPN` CHAR 40: Manufacturer Part Number
    #[serde(rename = "MFRPN", default)]
    pub mfrpn: String,
    /// `PRDHA` CHAR 18: Product Hierarchy
    #[serde(rename = "PRDHA", default)]
    pub prdha: String,
    /// `WRKST` CHAR 48: Basic Material
    #[serde(rename = "WRKST", default)]
    pub wrkst: String,
    /// `SATNR` CHAR 18: Generic Article (IS-Retail)
    #[serde(rename = "SATNR", default)]
    pub satnr: String,
    /// `INHAL` QUAN 13,3: Net Contents (IS-Retail)
    #[serde(rename = "INHAL", default)]
    pub inhal: rust_decimal::Decimal,
    /// `INHME` UNIT 3: Content Unit (IS-Retail)
    #[serde(rename = "INHME", default)]
    pub inhme: String,
}

impl Mara {
    pub const TABNAME: &'static str = "MARA";
    pub const KEY: &'static [&'static str] = &["MANDT", "MATNR"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("MATNR", "matnr"), ("ERSDA", "ersda"), ("LVORM", "lvorm"), ("MTART", "mtart"), ("MATKL", "matkl"), ("MEINS", "meins"), ("BRGEW", "brgew"), ("GEWEI", "gewei"), ("NTGEW", "ntgew"), ("EAN11", "ean11"), ("NUMTP", "numtp"), ("MFRNR", "mfrnr"), ("MFRPN", "mfrpn"), ("PRDHA", "prdha"), ("WRKST", "wrkst"), ("SATNR", "satnr"), ("INHAL", "inhal"), ("INHME", "inhme")];
}

MAKT → sap::Makt

Material Descriptions

Key: MANDT + MATNR + SPRAS

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
MATNR (key)matnrStringCHAR 18MATNRMaterial Number
SPRAS (key)titlesprasStringLANG 1SPRASLanguage Key
MAKTXtitlemaktxStringCHAR 40MAKTXMaterial Description

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::Makt
/// `MAKT`: Material Descriptions
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Makt {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `MATNR` CHAR 18 (key): Material Number
    #[serde(rename = "MATNR")]
    pub matnr: String,
    /// `SPRAS` LANG 1 (key): Language Key
    #[serde(rename = "SPRAS")]
    pub spras: String,
    /// `MAKTX` CHAR 40: Material Description
    #[serde(rename = "MAKTX", default)]
    pub maktx: String,
}

impl Makt {
    pub const TABNAME: &'static str = "MAKT";
    pub const KEY: &'static [&'static str] = &["MANDT", "MATNR", "SPRAS"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("MATNR", "matnr"), ("SPRAS", "spras"), ("MAKTX", "maktx")];
}

CDHDR → sap::Cdhdr

Change document header

Key: MANDANT + OBJECTCLAS + OBJECTID + CHANGENR

ABAP fieldRust fieldRust typeDDICData elementDescription
MANDANT (key)mandantStringCLNT 3MANDTClient
OBJECTCLAS (key)objectclasStringCHAR 15CDOBJECTCLObject Class (DEBI = customer)
OBJECTID (key)objectidStringCHAR 90CDOBJECTVObject Value
CHANGENR (key)changenrStringCHAR 10CDCHANGENRChange Number
USERNAMEusernameStringCHAR 12CDUSERNAMEUser who changed it (a batch user shows here)
UDATEudateOption<chrono::NaiveDate>DATS 8CDDATUMDate
UTIMEutimeOption<chrono::NaiveTime>TIMS 6CDUZEITTime
TCODEtcodeStringCHAR 20CDTCODETransaction
CHANGE_INDchange_indStringCHAR 1CDCHNGINDHChange Type (U / I / D)

Generated Rust

// abap_to_rust::sap::Cdhdr
/// `CDHDR`: Change document header
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Cdhdr {
    /// `MANDANT` CLNT 3 (key): Client
    #[serde(rename = "MANDANT")]
    pub mandant: String,
    /// `OBJECTCLAS` CHAR 15 (key): Object Class (DEBI = customer)
    #[serde(rename = "OBJECTCLAS")]
    pub objectclas: String,
    /// `OBJECTID` CHAR 90 (key): Object Value
    #[serde(rename = "OBJECTID")]
    pub objectid: String,
    /// `CHANGENR` CHAR 10 (key): Change Number
    #[serde(rename = "CHANGENR")]
    pub changenr: String,
    /// `USERNAME` CHAR 12: User who changed it (a batch user shows here)
    #[serde(rename = "USERNAME", default)]
    pub username: String,
    /// `UDATE` DATS 8: Date
    #[serde(rename = "UDATE", default, with = "crate::abap::dats")]
    pub udate: Option<chrono::NaiveDate>,
    /// `UTIME` TIMS 6: Time
    #[serde(rename = "UTIME", default, with = "crate::abap::tims")]
    pub utime: Option<chrono::NaiveTime>,
    /// `TCODE` CHAR 20: Transaction
    #[serde(rename = "TCODE", default)]
    pub tcode: String,
    /// `CHANGE_IND` CHAR 1: Change Type (U / I / D)
    #[serde(rename = "CHANGE_IND", default)]
    pub change_ind: String,
}

impl Cdhdr {
    pub const TABNAME: &'static str = "CDHDR";
    pub const KEY: &'static [&'static str] = &["MANDANT", "OBJECTCLAS", "OBJECTID", "CHANGENR"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDANT", "mandant"), ("OBJECTCLAS", "objectclas"), ("OBJECTID", "objectid"), ("CHANGENR", "changenr"), ("USERNAME", "username"), ("UDATE", "udate"), ("UTIME", "utime"), ("TCODE", "tcode"), ("CHANGE_IND", "change_ind")];
}

CDPOS → sap::Cdpos

Change document items

Key: MANDANT + OBJECTCLAS + OBJECTID + CHANGENR + TABNAME + TABKEY + FNAME + CHNGIND

ABAP fieldRust fieldRust typeDDICData elementDescription
MANDANT (key)mandantStringCLNT 3MANDTClient
OBJECTCLAS (key)objectclasStringCHAR 15CDOBJECTCLObject Class
OBJECTID (key)objectidStringCHAR 90CDOBJECTVObject Value
CHANGENR (key)changenrStringCHAR 10CDCHANGENRChange Number
TABNAME (key)tabnameStringCHAR 30TABNAMETable Name
TABKEY (key)tabkeyStringCHAR 70CDTABKEYChanged Table Record Key
FNAME (key)fnameStringCHAR 30FIELDNAMEField Name
CHNGIND (key)chngindStringCHAR 1CDCHNGINDChange Type (U / I / E / D)
VALUE_NEWvalue_newStringCHAR 254CDFLDVALNNew Value
VALUE_OLDvalue_oldStringCHAR 254CDFLDVALOOld Value

Generated Rust

// abap_to_rust::sap::Cdpos
/// `CDPOS`: Change document items
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Cdpos {
    /// `MANDANT` CLNT 3 (key): Client
    #[serde(rename = "MANDANT")]
    pub mandant: String,
    /// `OBJECTCLAS` CHAR 15 (key): Object Class
    #[serde(rename = "OBJECTCLAS")]
    pub objectclas: String,
    /// `OBJECTID` CHAR 90 (key): Object Value
    #[serde(rename = "OBJECTID")]
    pub objectid: String,
    /// `CHANGENR` CHAR 10 (key): Change Number
    #[serde(rename = "CHANGENR")]
    pub changenr: String,
    /// `TABNAME` CHAR 30 (key): Table Name
    #[serde(rename = "TABNAME")]
    pub tabname: String,
    /// `TABKEY` CHAR 70 (key): Changed Table Record Key
    #[serde(rename = "TABKEY")]
    pub tabkey: String,
    /// `FNAME` CHAR 30 (key): Field Name
    #[serde(rename = "FNAME")]
    pub fname: String,
    /// `CHNGIND` CHAR 1 (key): Change Type (U / I / E / D)
    #[serde(rename = "CHNGIND")]
    pub chngind: String,
    /// `VALUE_NEW` CHAR 254: New Value
    #[serde(rename = "VALUE_NEW", default)]
    pub value_new: String,
    /// `VALUE_OLD` CHAR 254: Old Value
    #[serde(rename = "VALUE_OLD", default)]
    pub value_old: String,
}

impl Cdpos {
    pub const TABNAME: &'static str = "CDPOS";
    pub const KEY: &'static [&'static str] = &["MANDANT", "OBJECTCLAS", "OBJECTID", "CHANGENR", "TABNAME", "TABKEY", "FNAME", "CHNGIND"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDANT", "mandant"), ("OBJECTCLAS", "objectclas"), ("OBJECTID", "objectid"), ("CHANGENR", "changenr"), ("TABNAME", "tabname"), ("TABKEY", "tabkey"), ("FNAME", "fname"), ("CHNGIND", "chngind"), ("VALUE_NEW", "value_new"), ("VALUE_OLD", "value_old")];
}

MARM → sap::Marm

Units of Measure for Material

Key: MANDT + MATNR + MEINH

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
MATNR (key)matnrStringCHAR 18MATNRMaterial Number
MEINH (key)meinhStringUNIT 3LRMEIAlternative Unit of Measure
UMREZumrezrust_decimal::DecimalDEC 5UMREZNumerator for Conversion to Base Unit
UMRENumrenrust_decimal::DecimalDEC 5UMRENDenominator for Conversion to Base Unit
EAN11gtinean11StringCHAR 18EAN11International Article Number (EAN/UPC)
NUMTPgtinnumtpStringCHAR 2NUMTPCategory of EAN
LAENGshipping_lengthlaengrust_decimal::DecimalQUAN 13,3LAENGLength
BREITshipping_widthbreitrust_decimal::DecimalQUAN 13,3BREITWidth
HOEHEshipping_heighthoeherust_decimal::DecimalQUAN 13,3HOEHEHeight
MEABMshipping_length shipping_width shipping_heightmeabmStringUNIT 3MEABMUnit of Dimension
BRGEWbrgewrust_decimal::DecimalQUAN 13,3BRGEWGross Weight
GEWEIgeweiStringUNIT 3GEWEIWeight Unit

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::Marm
/// `MARM`: Units of Measure for Material
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Marm {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `MATNR` CHAR 18 (key): Material Number
    #[serde(rename = "MATNR")]
    pub matnr: String,
    /// `MEINH` UNIT 3 (key): Alternative Unit of Measure
    #[serde(rename = "MEINH")]
    pub meinh: String,
    /// `UMREZ` DEC 5: Numerator for Conversion to Base Unit
    #[serde(rename = "UMREZ", default)]
    pub umrez: rust_decimal::Decimal,
    /// `UMREN` DEC 5: Denominator for Conversion to Base Unit
    #[serde(rename = "UMREN", default)]
    pub umren: rust_decimal::Decimal,
    /// `EAN11` CHAR 18: International Article Number (EAN/UPC)
    #[serde(rename = "EAN11", default)]
    pub ean11: String,
    /// `NUMTP` CHAR 2: Category of EAN
    #[serde(rename = "NUMTP", default)]
    pub numtp: String,
    /// `LAENG` QUAN 13,3: Length
    #[serde(rename = "LAENG", default)]
    pub laeng: rust_decimal::Decimal,
    /// `BREIT` QUAN 13,3: Width
    #[serde(rename = "BREIT", default)]
    pub breit: rust_decimal::Decimal,
    /// `HOEHE` QUAN 13,3: Height
    #[serde(rename = "HOEHE", default)]
    pub hoehe: rust_decimal::Decimal,
    /// `MEABM` UNIT 3: Unit of Dimension
    #[serde(rename = "MEABM", default)]
    pub meabm: String,
    /// `BRGEW` QUAN 13,3: Gross Weight
    #[serde(rename = "BRGEW", default)]
    pub brgew: rust_decimal::Decimal,
    /// `GEWEI` UNIT 3: Weight Unit
    #[serde(rename = "GEWEI", default)]
    pub gewei: String,
}

impl Marm {
    pub const TABNAME: &'static str = "MARM";
    pub const KEY: &'static [&'static str] = &["MANDT", "MATNR", "MEINH"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("MATNR", "matnr"), ("MEINH", "meinh"), ("UMREZ", "umrez"), ("UMREN", "umren"), ("EAN11", "ean11"), ("NUMTP", "numtp"), ("LAENG", "laeng"), ("BREIT", "breit"), ("HOEHE", "hoehe"), ("MEABM", "meabm"), ("BRGEW", "brgew"), ("GEWEI", "gewei")];
}

MARD → sap::Mard

Storage Location Data for Material

Key: MANDT + MATNR + WERKS + LGORT

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
MATNR (key)matnrStringCHAR 18MATNRMaterial Number
WERKS (key)werksStringCHAR 4WERKS_DPlant
LGORT (key)lgortStringCHAR 4LGORT_DStorage Location
LABSTavailabilitylabstrust_decimal::DecimalQUAN 13,3LABSTUnrestricted-Use Stock
INSMEavailabilityinsmerust_decimal::DecimalQUAN 13,3INSMEStock in Quality Inspection
SPEMEavailabilityspemerust_decimal::DecimalQUAN 13,3SPEMEBlocked Stock

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::Mard
/// `MARD`: Storage Location Data for Material
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Mard {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `MATNR` CHAR 18 (key): Material Number
    #[serde(rename = "MATNR")]
    pub matnr: String,
    /// `WERKS` CHAR 4 (key): Plant
    #[serde(rename = "WERKS")]
    pub werks: String,
    /// `LGORT` CHAR 4 (key): Storage Location
    #[serde(rename = "LGORT")]
    pub lgort: String,
    /// `LABST` QUAN 13,3: Unrestricted-Use Stock
    #[serde(rename = "LABST", default)]
    pub labst: rust_decimal::Decimal,
    /// `INSME` QUAN 13,3: Stock in Quality Inspection
    #[serde(rename = "INSME", default)]
    pub insme: rust_decimal::Decimal,
    /// `SPEME` QUAN 13,3: Blocked Stock
    #[serde(rename = "SPEME", default)]
    pub speme: rust_decimal::Decimal,
}

impl Mard {
    pub const TABNAME: &'static str = "MARD";
    pub const KEY: &'static [&'static str] = &["MANDT", "MATNR", "WERKS", "LGORT"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("MATNR", "matnr"), ("WERKS", "werks"), ("LGORT", "lgort"), ("LABST", "labst"), ("INSME", "insme"), ("SPEME", "speme")];
}

MBEW → sap::Mbew

Material Valuation

Key: MANDT + MATNR + BWKEY + BWTAR

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
MATNR (key)matnrStringCHAR 18MATNRMaterial Number
BWKEY (key)bwkeyStringCHAR 4BWKEYValuation Area
BWTAR (key)bwtarStringCHAR 10BWTAR_DValuation Type
VPRSVcost_of_goods_soldvprsvStringCHAR 1VPRSVPrice Control (S standard / V moving average)
VERPRcost_of_goods_soldverprrust_decimal::DecimalCURR 11,2VERPRMoving Average Price
STPRScost_of_goods_soldstprsrust_decimal::DecimalCURR 11,2STPRSStandard Price
PEINHcost_of_goods_soldpeinhrust_decimal::DecimalDEC 5PEINHPrice Unit

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::Mbew
/// `MBEW`: Material Valuation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Mbew {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `MATNR` CHAR 18 (key): Material Number
    #[serde(rename = "MATNR")]
    pub matnr: String,
    /// `BWKEY` CHAR 4 (key): Valuation Area
    #[serde(rename = "BWKEY")]
    pub bwkey: String,
    /// `BWTAR` CHAR 10 (key): Valuation Type
    #[serde(rename = "BWTAR")]
    pub bwtar: String,
    /// `VPRSV` CHAR 1: Price Control (S standard / V moving average)
    #[serde(rename = "VPRSV", default)]
    pub vprsv: String,
    /// `VERPR` CURR 11,2: Moving Average Price
    #[serde(rename = "VERPR", default)]
    pub verpr: rust_decimal::Decimal,
    /// `STPRS` CURR 11,2: Standard Price
    #[serde(rename = "STPRS", default)]
    pub stprs: rust_decimal::Decimal,
    /// `PEINH` DEC 5: Price Unit
    #[serde(rename = "PEINH", default)]
    pub peinh: rust_decimal::Decimal,
}

impl Mbew {
    pub const TABNAME: &'static str = "MBEW";
    pub const KEY: &'static [&'static str] = &["MANDT", "MATNR", "BWKEY", "BWTAR"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("MATNR", "matnr"), ("BWKEY", "bwkey"), ("BWTAR", "bwtar"), ("VPRSV", "vprsv"), ("VERPR", "verpr"), ("STPRS", "stprs"), ("PEINH", "peinh")];
}

A004 → sap::A004

Material (sales organization / distribution channel / material)

Key: MANDT + KAPPL + KSCHL + VKORG + VTWEG + MATNR + DATBI

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
KAPPL (key)kapplStringCHAR 2KAPPLApplication (V = sales)
KSCHL (key)price sale_pricekschlStringCHAR 4KSCHACondition Type (PR00 = price)
VKORG (key)vkorgStringCHAR 4VKORGSales Organization
VTWEG (key)vtwegStringCHAR 2VTWEGDistribution Channel
MATNR (key)matnrStringCHAR 18MATNRMaterial Number
DATBI (key)price sale_price sale_price_effective_datedatbiOption<chrono::NaiveDate>DATS 8KODATBIValid To
DATABprice sale_price sale_price_effective_datedatabOption<chrono::NaiveDate>DATS 8KODATABValid From
KNUMHknumhStringCHAR 10KNUMHCondition Record Number

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::A004
/// `A004`: Material (sales organization / distribution channel / material)
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct A004 {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `KAPPL` CHAR 2 (key): Application (V = sales)
    #[serde(rename = "KAPPL")]
    pub kappl: String,
    /// `KSCHL` CHAR 4 (key): Condition Type (PR00 = price)
    #[serde(rename = "KSCHL")]
    pub kschl: String,
    /// `VKORG` CHAR 4 (key): Sales Organization
    #[serde(rename = "VKORG")]
    pub vkorg: String,
    /// `VTWEG` CHAR 2 (key): Distribution Channel
    #[serde(rename = "VTWEG")]
    pub vtweg: String,
    /// `MATNR` CHAR 18 (key): Material Number
    #[serde(rename = "MATNR")]
    pub matnr: String,
    /// `DATBI` DATS 8 (key): Valid To
    #[serde(rename = "DATBI", with = "crate::abap::dats")]
    pub datbi: Option<chrono::NaiveDate>,
    /// `DATAB` DATS 8: Valid From
    #[serde(rename = "DATAB", default, with = "crate::abap::dats")]
    pub datab: Option<chrono::NaiveDate>,
    /// `KNUMH` CHAR 10: Condition Record Number
    #[serde(rename = "KNUMH", default)]
    pub knumh: String,
}

impl A004 {
    pub const TABNAME: &'static str = "A004";
    pub const KEY: &'static [&'static str] = &["MANDT", "KAPPL", "KSCHL", "VKORG", "VTWEG", "MATNR", "DATBI"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("KAPPL", "kappl"), ("KSCHL", "kschl"), ("VKORG", "vkorg"), ("VTWEG", "vtweg"), ("MATNR", "matnr"), ("DATBI", "datbi"), ("DATAB", "datab"), ("KNUMH", "knumh")];
}

KONP → sap::Konp

Conditions (Item)

Key: MANDT + KNUMH + KOPOS

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
KNUMH (key)knumhStringCHAR 10KNUMHCondition Record Number
KOPOS (key)koposStringNUMC 2KOPOSSequential Number of the Condition
KSCHLkschlStringCHAR 4KSCHACondition Type
KBETRprice sale_pricekbetrrust_decimal::DecimalCURR 11,2KBETR_KONDRate (amount)
KONWAprice sale_pricekonwaStringCUKY 5KONWARate Unit (currency)
KPEINprice sale_pricekpeinrust_decimal::DecimalDEC 5KPEINCondition Pricing Unit
KMEINkmeinStringUNIT 3KMEINCondition Unit
LOEVM_KOpriceloevm_koboolCHAR 1LOEVM_KODeletion Indicator for Condition Item

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::Konp
/// `KONP`: Conditions (Item)
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Konp {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `KNUMH` CHAR 10 (key): Condition Record Number
    #[serde(rename = "KNUMH")]
    pub knumh: String,
    /// `KOPOS` NUMC 2 (key): Sequential Number of the Condition
    #[serde(rename = "KOPOS")]
    pub kopos: String,
    /// `KSCHL` CHAR 4: Condition Type
    #[serde(rename = "KSCHL", default)]
    pub kschl: String,
    /// `KBETR` CURR 11,2: Rate (amount)
    #[serde(rename = "KBETR", default)]
    pub kbetr: rust_decimal::Decimal,
    /// `KONWA` CUKY 5: Rate Unit (currency)
    #[serde(rename = "KONWA", default)]
    pub konwa: String,
    /// `KPEIN` DEC 5: Condition Pricing Unit
    #[serde(rename = "KPEIN", default)]
    pub kpein: rust_decimal::Decimal,
    /// `KMEIN` UNIT 3: Condition Unit
    #[serde(rename = "KMEIN", default)]
    pub kmein: String,
    /// `LOEVM_KO` CHAR 1: Deletion Indicator for Condition Item
    #[serde(rename = "LOEVM_KO", default, with = "crate::abap::xflag")]
    pub loevm_ko: bool,
}

impl Konp {
    pub const TABNAME: &'static str = "KONP";
    pub const KEY: &'static [&'static str] = &["MANDT", "KNUMH", "KOPOS"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("KNUMH", "knumh"), ("KOPOS", "kopos"), ("KSCHL", "kschl"), ("KBETR", "kbetr"), ("KONWA", "konwa"), ("KPEIN", "kpein"), ("KMEIN", "kmein"), ("LOEVM_KO", "loevm_ko")];
}

T001W → sap::T001w

Plants/Branches

Key: MANDT + WERKS

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
WERKS (key)werksStringCHAR 4WERKS_DPlant
NAME1name1StringCHAR 30NAME1Name
LAND1ships_from_countryland1StringCHAR 3LAND1Country Key
REGIOregioStringCHAR 3REGIORegion

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::T001w
/// `T001W`: Plants/Branches
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct T001w {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `WERKS` CHAR 4 (key): Plant
    #[serde(rename = "WERKS")]
    pub werks: String,
    /// `NAME1` CHAR 30: Name
    #[serde(rename = "NAME1", default)]
    pub name1: String,
    /// `LAND1` CHAR 3: Country Key
    #[serde(rename = "LAND1", default)]
    pub land1: String,
    /// `REGIO` CHAR 3: Region
    #[serde(rename = "REGIO", default)]
    pub regio: String,
}

impl T001w {
    pub const TABNAME: &'static str = "T001W";
    pub const KEY: &'static [&'static str] = &["MANDT", "WERKS"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("WERKS", "werks"), ("NAME1", "name1"), ("LAND1", "land1"), ("REGIO", "regio")];
}

TCURX → sap::Tcurx

Decimal Places in Currencies

Key: CURRKEY

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
CURRKEY (key)currkeyStringCUKY 5CURRKEYCurrency Key
CURRDECprice sale_pricecurrdecu8INT1 3CURRDECNumber of Decimal Places

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::Tcurx
/// `TCURX`: Decimal Places in Currencies
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Tcurx {
    /// `CURRKEY` CUKY 5 (key): Currency Key
    #[serde(rename = "CURRKEY")]
    pub currkey: String,
    /// `CURRDEC` INT1 3: Number of Decimal Places
    #[serde(rename = "CURRDEC", default)]
    pub currdec: u8,
}

impl Tcurx {
    pub const TABNAME: &'static str = "TCURX";
    pub const KEY: &'static [&'static str] = &["CURRKEY"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("CURRKEY", "currkey"), ("CURRDEC", "currdec")];
}

T179T → sap::T179t

Materials: Product Hierarchies: Texts

Key: MANDT + SPRAS + PRODH

ABAP fieldGoogle MerchantRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
SPRAS (key)sprasStringLANG 1SPRASLanguage Key
PRODH (key)product_typeprodhStringCHAR 18PRODH_DProduct Hierarchy
VTEXTproduct_typevtextStringCHAR 40BEZEI40Description

pink attributes are machine data: converted by a fixed rule, never rewritten. See Google Merchant Center.

Generated Rust

// abap_to_rust::sap::T179t
/// `T179T`: Materials: Product Hierarchies: Texts
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct T179t {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `SPRAS` LANG 1 (key): Language Key
    #[serde(rename = "SPRAS")]
    pub spras: String,
    /// `PRODH` CHAR 18 (key): Product Hierarchy
    #[serde(rename = "PRODH")]
    pub prodh: String,
    /// `VTEXT` CHAR 40: Description
    #[serde(rename = "VTEXT", default)]
    pub vtext: String,
}

impl T179t {
    pub const TABNAME: &'static str = "T179T";
    pub const KEY: &'static [&'static str] = &["MANDT", "SPRAS", "PRODH"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("SPRAS", "spras"), ("PRODH", "prodh"), ("VTEXT", "vtext")];
}

Customer namespace /ACME/

Module abap_to_rust::acme.

ABAP tableRustFieldsDescription
/ACME/CONSENTacme::Consent7Consent ledger (customer namespace /ACME/)

/ACME/CONSENT → acme::Consent

Consent ledger (customer namespace /ACME/)

Key: MANDT + KUNNR + PURPOSE + RECORDED_AT

ABAP fieldRust fieldRust typeDDICData elementDescription
MANDT (key)mandtStringCLNT 3MANDTClient
KUNNR (key)kunnrStringCHAR 10KUNNRCustomer Number
PURPOSE (key)purposeStringCHAR 20/ACME/PURPOSEPurpose (analytics / ads / sale_share)
RECORDED_AT (key)recorded_atOption<chrono::NaiveDateTime>DEC 15TIMESTAMPRecorded at (UTC, YYYYMMDDhhmmss)
GRANTEDgrantedboolCHAR 1XFELDGranted
SOURCEsourceStringCHAR 10/ACME/SOURCESource (banner / dsr / gpc)
SEQNOseqnoi32INT4 10INT4Sequence within the second

Generated Rust

// abap_to_rust::acme::Consent
/// `/ACME/CONSENT`: Consent ledger (customer namespace /ACME/)
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Consent {
    /// `MANDT` CLNT 3 (key): Client
    #[serde(rename = "MANDT")]
    pub mandt: String,
    /// `KUNNR` CHAR 10 (key): Customer Number
    #[serde(rename = "KUNNR")]
    pub kunnr: String,
    /// `PURPOSE` CHAR 20 (key): Purpose (analytics / ads / sale_share)
    #[serde(rename = "PURPOSE")]
    pub purpose: String,
    /// `RECORDED_AT` DEC 15 (key): Recorded at (UTC, YYYYMMDDhhmmss)
    #[serde(rename = "RECORDED_AT", with = "crate::abap::timestamp")]
    pub recorded_at: Option<chrono::NaiveDateTime>,
    /// `GRANTED` CHAR 1: Granted
    #[serde(rename = "GRANTED", default, with = "crate::abap::xflag")]
    pub granted: bool,
    /// `SOURCE` CHAR 10: Source (banner / dsr / gpc)
    #[serde(rename = "SOURCE", default)]
    pub source: String,
    /// `SEQNO` INT4 10: Sequence within the second
    #[serde(rename = "SEQNO", default)]
    pub seqno: i32,
}

impl Consent {
    pub const TABNAME: &'static str = "/ACME/CONSENT";
    pub const KEY: &'static [&'static str] = &["MANDT", "KUNNR", "PURPOSE", "RECORDED_AT"];
    /// (ABAP name, Rust name), in DDIC position order.
    pub const FIELDS: &'static [(&'static str, &'static str)] = &[("MANDT", "mandt"), ("KUNNR", "kunnr"), ("PURPOSE", "purpose"), ("RECORDED_AT", "recorded_at"), ("GRANTED", "granted"), ("SOURCE", "source"), ("SEQNO", "seqno")];
}

Sample record

As exported, with ABAP names and internal formats (fixtures/records/acme_consent.json, read by tests/convert.rs):

[{"MANDT":"100","KUNNR":"0000012345","PURPOSE":"ads","RECORDED_AT":20261104100200,"GRANTED":"X","SOURCE":"banner","SEQNO":0},
 {"MANDT":"100","KUNNR":"0000012345","PURPOSE":"ads","RECORDED_AT":20261104100500,"GRANTED":"","SOURCE":"dsr","SEQNO":0}]

Field index

Every ABAP field in this book, A to Z. A field that maps to different Rust types in different tables is marked differs.

ABAP fieldRust fieldRust typeTablesGoogle Merchant
/ACME/GPCacme_gpcboolKNA1
ADDRNUMBERaddrnumberStringADR6, ADRC
ADRNRadrnrStringKNA1
ARKTXarktxStringVBAP
AUARTauartStringVBAK
AUFSDaufsdStringKNVV
BREITbreitrust_decimal::DecimalMARMshipping_width
BRGEWbrgewrust_decimal::DecimalMARA, MARMshipping_weight
BWKEYbwkeyStringMBEW
BWTARbwtarStringMBEW
CHANGENRchangenrStringCDHDR, CDPOS
CHANGE_INDchange_indStringCDHDR
CHNGINDchngindStringCDPOS
CITY1city1StringADRC
CLIENTclientStringADR6, ADRC
CONSNUMBERconsnumberStringADR6
COUNTRYcountryStringADRC
CURRDECcurrdecu8TCURXprice sale_price
CURRKEYcurrkeyStringTCURX
DATABdatabOption<chrono::NaiveDate>A004price sale_price sale_price_effective_date
DATBIdatbiOption<chrono::NaiveDate>A004price sale_price sale_price_effective_date
DATE_FROMdate_fromOption<chrono::NaiveDate>ADR6, ADRC
DEFLT_COMMdeflt_commStringADRC
EAN11ean11StringMARA, MARMgtin identifier_exists
ERDATerdatOption<chrono::NaiveDate>KNA1, VBAK
ERSDAersdaOption<chrono::NaiveDate>MARA
ERZETerzetOption<chrono::NaiveTime>VBAK
FLGDEFAULTflgdefaultboolADR6
FLG_NOUSEflg_nouseboolADR6
FNAMEfnameStringCDPOS
GEWEIgeweiStringMARA, MARMproduct_weight shipping_weight
GRANTEDgrantedbool/ACME/CONSENT
HOEHEhoeherust_decimal::DecimalMARMshipping_height
INHALinhalrust_decimal::DecimalMARAunit_pricing_measure
INHMEinhmeStringMARAunit_pricing_measure
INSMEinsmerust_decimal::DecimalMARDavailability
KAPPLkapplStringA004
KBETRkbetrrust_decimal::DecimalKONPprice sale_price
KDGRPkdgrpStringKNVV
KMEINkmeinStringKONP
KNUMHknumhStringA004, KONP
KONWAkonwaStringKONPprice sale_price
KOPOSkoposStringKONP
KPEINkpeinrust_decimal::DecimalKONPprice sale_price
KSCHLkschlStringA004, KONPprice sale_price
KUNNRkunnrStringKNA1, VBAK, /ACME/CONSENT, KNVV
KWMENGkwmengrust_decimal::DecimalVBAP
LABSTlabstrust_decimal::DecimalMARDavailability
LAENGlaengrust_decimal::DecimalMARMshipping_length
LAND1land1StringKNA1, T001Wships_from_country
LANGUlanguStringADRC
LGORTlgortStringMARD
LOEVMloevmboolKNA1, KNVV
LOEVM_KOloevm_koboolKONPprice
LVORMlvormboolMARA
MAKTXmaktxStringMAKTtitle
MANDANTmandantStringCDHDR, CDPOS
MANDTmandtStringKNA1, VBAK, /ACME/CONSENT, KNVV, VBAP, MARA, MAKT, MARM, MARD, MBEW, A004, KONP, T001W, T179T
MATKLmatklStringMARAgoogle_product_category
MATNRmatnrStringVBAP, MARA, MAKT, MARM, MARD, MBEW, A004id
MEABMmeabmStringMARMshipping_height shipping_length shipping_width
MEINHmeinhStringMARM
MEINSmeinsStringMARA
MFRNRmfrnrStringMARAbrand
MFRPNmfrpnStringMARAidentifier_exists mpn
MTARTmtartStringMARA
NAME1name1StringKNA1, ADRC, T001W
NATIONnationStringADRC
NETWRnetwrrust_decimal::DecimalVBAK, VBAP
NTGEWntgewrust_decimal::DecimalMARAproduct_weight
NUMTPnumtpStringMARA, MARMgtin
OBJECTCLASobjectclasStringCDHDR, CDPOS
OBJECTIDobjectidStringCDHDR, CDPOS
ORT01ort01StringKNA1
PEINHpeinhrust_decimal::DecimalMBEWcost_of_goods_sold
PERSNUMBERpersnumberStringADR6
POSNRposnrStringVBAP
POST_CODE1post_code1StringADRC
PRDHAprdhaStringMARAproduct_type
PRODHprodhStringT179Tproduct_type
PSTLZpstlzStringKNA1
PURPOSEpurposeString/ACME/CONSENT
RECORDED_ATrecorded_atOption<chrono::NaiveDateTime>/ACME/CONSENT
REGIOregioStringKNA1, T001W
REGIONregionStringADRC
SATNRsatnrStringMARAitem_group_id
SEQNOseqnoi32/ACME/CONSENT
SMTP_ADDRsmtp_addrStringADR6
SOURCEsourceString/ACME/CONSENT
SPARTspartStringKNVV
SPEMEspemerust_decimal::DecimalMARDavailability
SPRASsprasStringKNA1, MAKT, T179Ttitle
STPRSstprsrust_decimal::DecimalMBEWcost_of_goods_sold
STREETstreetStringADRC
TABKEYtabkeyStringCDPOS
TABNAMEtabnameStringCDPOS
TCODEtcodeStringCDHDR
TEL_NUMBERtel_numberStringADRC
UDATEudateOption<chrono::NaiveDate>CDHDR
UMRENumrenrust_decimal::DecimalMARM
UMREZumrezrust_decimal::DecimalMARM
USERNAMEusernameStringCDHDR
UTIMEutimeOption<chrono::NaiveTime>CDHDR
VALUE_NEWvalue_newStringCDPOS
VALUE_OLDvalue_oldStringCDPOS
VBELNvbelnStringVBAK, VBAP
VERPRverprrust_decimal::DecimalMBEWcost_of_goods_sold
VKORGvkorgStringKNVV, A004
VPRSVvprsvStringMBEWcost_of_goods_sold
VRKMEvrkmeStringVBAP
VTEXTvtextStringT179Tproduct_type
VTWEGvtwegStringKNVV, A004
WAERKwaerkStringVBAK, VBAP
WAERSwaersStringKNVV
WERKSwerksStringVBAP, MARD, T001W
WRKSTwrkstStringMARAmaterial
ZZ_MKT_OPTINzz_mkt_optinboolKNA1

No field changes type between tables in this book.