ml-connector
SAP S/4HANATradeshift

SAP S/4HANA and Tradeshift integration

SAP S/4HANA runs enterprise finance and procurement. Tradeshift connects your organization to a B2B network of suppliers and buyers, exchanging invoices and purchase documents. Connecting the two lets you publish purchase orders from SAP directly into the Tradeshift network and pull supplier invoices and documents back into SAP, mapped to the correct GL accounts and cost centers. No manual document entry, no email chains, no reconciliation lag.

How SAP S/4HANA works

SAP S/4HANA exposes purchase orders, purchase requisitions, suppliers, customers, GL accounts, cost centers, and journal entries through OData V2 and OData V4 REST APIs over HTTPS. Authentication is OAuth 2.0 Client Credentials, with scopes defined per Communication System and Arrangement, and tokens are typically short-lived (12 hours) and must be refreshed before expiry. The system has no native webhooks, so data is read by polling with LastChangeDateTime filters or delta tokens. GL accounts and cost centers are read-only in SAP; purchase orders and requisitions can be read and created. On-Premise deployments require a SAP client query parameter, while Cloud Public and Cloud Private Edition do not.

How Tradeshift works

Tradeshift is a cloud-based B2B network and spend management platform accessed via REST HTTPS APIs. Documents are exchanged in UBL 2.0/2.2 XML format, identified by documentProfileId. Authentication is OAuth 1.0a (two-legged consumer signature for server-to-server integration) with consumer key, consumer secret, token, and token secret, and every API call requires the X-Tradeshift-TenantId header. The platform has no native webhooks for outbound notifications; data is read by polling the documents/v2/ endpoint with changedAfter filters. An optional continuous event stream (protobuf messages) is available for registered plugins but is not required. Tradeshift has no GL account or cost center API, so those dimensions are embedded in the UBL line item documents.

What moves between them

Purchase orders flow from SAP into Tradeshift's network, where they appear as documents visible to suppliers. Tradeshift invoices, credit notes, receipts, and remittance advice flow back into SAP, where ml-connector maps UBL item dimensions to SAP GL accounts and cost centers based on the original purchase order line reference. Both directions are polled on a schedule you define. Supplier information (names, tax IDs, contact details) is synced from SAP to Tradeshift to keep network profiles current, and network connection metadata comes back from Tradeshift so you know which suppliers are active on the platform.

How ml-connector handles it

ml-connector stores both OAuth credential sets encrypted. On the SAP side, it caches the OAuth 2.0 bearer token and refreshes it before the 12-hour expiry window to avoid failed calls mid-flow. On the Tradeshift side, it generates OAuth 1.0a signatures for every API call using the stored consumer key, secret, token, and token secret, and includes the required X-Tradeshift-TenantId header on all requests. When polling SAP, it filters purchase orders by LastChangeDateTime and creates new records in Tradeshift via the documents/v2/ endpoint as UBL PurchaseOrder documents. When pulling from Tradeshift, it queries the documents/v2/ endpoint with changedAfter filters, parses the returned UBL Invoice, CreditNote, and Receipt documents, and maps each line's reference dimension to the SAP purchase order that triggered it, then allocates costs to the matching GL account and cost center. Tradeshift rate limits are respected with backoff and retry, and each document carries a full audit trail showing which system it came from, when it was synced, and whether the downstream GL posting succeeded.

A real-world example

A mid-market manufacturing company operates SAP S/4HANA at their main site with branch factories in three countries. They work with over 150 direct suppliers and have joined the Tradeshift network to streamline invoice receipt and reduce payment processing time. Before the integration, purchase orders were manually typed into Tradeshift by the procurement team, and supplier invoices arrived as PDF attachments in email, requiring AP staff to re-enter line details into SAP for matching and GL posting. With SAP S/4HANA and Tradeshift connected, each purchase order is automatically published to the network when it is issued in SAP, suppliers see it immediately and ship faster, and invoices that arrive through Tradeshift are automatically mapped to the matching PO and posted to the cost center GL account, cutting manual re-entry work in half and reducing invoice-to-payment time from 10 days to 3.

What you can do

  • Publish SAP purchase orders into the Tradeshift network as UBL documents visible to your supplier base.
  • Pull Tradeshift invoices, credit notes, receipts, and remittance advice back into SAP, mapped to the original purchase order.
  • Sync SAP supplier master data (names, tax IDs, bank details) to Tradeshift to keep network profiles current.
  • Handle OAuth 2.0 token refresh on the SAP side and OAuth 1.0a signature generation on the Tradeshift side.
  • Poll both systems on a schedule you control, with retries, backoff on rate limits, and a full audit trail on every document.

Questions

Which direction does data move between SAP S/4HANA and Tradeshift?
Purchase orders move from SAP to Tradeshift for visibility to suppliers. Supplier invoices, credit notes, receipts, and remittance advice move from Tradeshift back into SAP. Supplier master data (names, IDs, contact details) is synced both directions so network profiles stay current and SAP has visibility to which suppliers are active on the platform.
How does ml-connector handle the different OAuth schemes on each side?
SAP S/4HANA uses OAuth 2.0 Client Credentials with scopes per Communication Arrangement, and ml-connector caches the bearer token and refreshes it before the 12-hour expiry window closes. Tradeshift uses OAuth 1.0a two-legged consumer signature, and ml-connector generates the required signature and nonce for every API call, including the mandatory X-Tradeshift-TenantId header.
How are SAP GL accounts and cost centers mapped from Tradeshift's UBL documents?
Tradeshift documents do not have a native GL account or cost center API, so those dimensions are embedded in the UBL line item fields and must be parsed from the reference to the original SAP purchase order. ml-connector looks up the PO line that matches the invoice line reference, extracts the GL account and cost center from that PO line, and posts the invoice amount to the same GL account and cost center in SAP.

Related integrations

Connect SAP S/4HANA and Tradeshift

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started