ml-connector
SAP S/4HANATrueCommerce

SAP S/4HANA and TrueCommerce integration

SAP S/4HANA holds your procurement master data, suppliers, purchase orders, and invoices. TrueCommerce moves EDI documents between you and your supply chain partners. Connecting them keeps your outbound purchase orders and supplier data flowing to trading partners without manual file conversion or re-keying. Purchase orders created in SAP become X12 850 documents in TrueCommerce, and supplier invoices from SAP flow out as X12 810 invoices, reaching your partners on schedule.

How SAP S/4HANA works

SAP S/4HANA exposes suppliers, purchase orders, purchase order items, supplier invoices, invoice line items, cost centers, and GL accounts through OData V2 and OData V4 REST APIs. Each SAP customer has a tenant-specific API base URL, and authentication uses OAuth 2.0 with credentials and scopes configured in the Communication Arrangement per tenant. SAP does not provide native webhooks for procurement data, so purchase orders and invoices are read by polling against the LastChangeDateTime filter or delta tokens. Tokens are short-lived and must be refreshed before they expire.

How TrueCommerce works

TrueCommerce is a managed EDI and supply chain network that receives purchase orders, invoices, and shipping data from your ERP and distributes them to trading partners via X12 EDI, EDIFACT, SFTP, or managed API. The primary integration path is SFTP with TrueCommerce-provisioned credentials connecting to integrationftp.truecommerce.com. File naming conventions and paths are configured per customer account during onboarding. TrueCommerce does not offer a public self-serve OAuth or API token generation; all credentials are provisioned during account setup. EDI functional acknowledgments (X12 997 documents) handle deduplication and confirm document receipt.

What moves between them

The main flow is SAP to TrueCommerce. Purchase orders created or updated in SAP S/4HANA are polled daily, transformed into X12 850 Purchase Order EDI documents, and delivered to your TrueCommerce SFTP account. Supplier invoices are similarly polled and sent as X12 810 Invoice documents. TrueCommerce functional acknowledgments (997 documents) and order status updates flow back to a configured SAP folder or a notification channel, confirming receipt at your trading partners. The mapping preserves supplier DUNS numbers, item SKUs, quantities, and pricing from SAP into the correct EDI segments.

How ml-connector handles it

ml-connector caches the SAP OAuth token and refreshes it before expiry to prevent outages during polling. It queries SAP OData APIs for changed purchase orders and supplier invoices using the LastChangeDateTime filter, transforming each order into X12 850 format and each invoice into X12 810 format per ANSI X12 standards. EDI control numbers are sequenced uniquely per trading partner to satisfy TrueCommerce deduplication rules. The SFTP transport handles file naming per your TrueCommerce account configuration, and ml-connector retries failed deliveries with exponential backoff. Received 997 functional acknowledgments are polled from TrueCommerce and logged in an audit table, and if webhook support is available for your TrueCommerce account, ml-connector can receive push notifications for exceptions. On-premise SAP instances require the sap-client query parameter on OData calls; cloud instances do not.

A real-world example

A mid-market distributor maintains SAP S/4HANA for procurement and inventory, and uses TrueCommerce as a managed VAN to exchange EDI documents with fifteen major retail partners. Before integration, the procurement team exported purchase orders from SAP as CSV each day, manually converted them to X12 850 format, uploaded them to TrueCommerce via FTP, and tracked confirmations across multiple systems. With SAP S/4HANA and TrueCommerce connected, each new or changed purchase order flows automatically into TrueCommerce in EDI format within the hour, and functional acknowledgments from partners are logged for audit. Supplier invoices received by partners now sync back automatically, reducing manual order confirmation work by forty percent and eliminating the daily file conversion step.

What you can do

  • Poll SAP S/4HANA for purchase orders and supplier invoices, transform them into X12 EDI format, and deliver to TrueCommerce via SFTP on a daily schedule.
  • Map SAP suppliers, line items, quantities, and pricing into the correct EDI 850 and 810 document segments, preserving DUNS numbers and SKU references.
  • Handle SAP OAuth token refresh automatically and cache credentials securely, preventing token expiry during polling windows.
  • Receive TrueCommerce functional acknowledgments and exception alerts, logging them for audit and retrying failed deliveries with exponential backoff.
  • Support both Cloud Public and On-Premise SAP S/4HANA instances, with automatic sap-client parameter handling for on-premise tenants.

Questions

Which direction does data move between SAP S/4HANA and TrueCommerce?
The main flow is SAP to TrueCommerce. Purchase orders and supplier invoices from SAP are polled daily and sent to TrueCommerce as X12 EDI documents. Functional acknowledgments and order status updates from TrueCommerce flow back for audit and logging. The mapping is one-way for outbound orders and invoices; inbound confirmations are read-only in the audit table.
Does ml-connector handle EDI formatting and control numbers?
Yes. ml-connector transforms SAP purchase orders into X12 850 documents and invoices into X12 810 documents per ANSI standards. It sequences unique control numbers per trading partner to satisfy TrueCommerce deduplication rules via ISA control number tracking. File naming and directory paths follow your TrueCommerce account configuration, set up during onboarding.
What happens if the SAP OAuth token expires during polling?
ml-connector caches the SAP OAuth token and refreshes it before expiry to prevent outages. If a polling cycle detects an expired token, it refreshes immediately using the OAuth 2.0 client credentials from your Communication Arrangement and retries the request without breaking the workflow.

Related integrations

Connect SAP S/4HANA and TrueCommerce

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

Get started