ml-connector
SAP ECCWooCommerce

SAP ECC and WooCommerce integration

SAP ECC runs your finance and master data. WooCommerce powers your online store. Connecting them keeps product information, pricing, and customer records synchronized between systems, and flows order and refund data from WooCommerce back into SAP as sales documents tied to the correct GL accounts. ml-connector handles the protocol differences (RFC/BAPI on SAP, REST on WooCommerce), manages the on-premises agent connection, and ensures every order and refund is recorded without duplication.

How SAP ECC works

SAP ECC exposes materials, customers, vendors, purchase orders, sales documents, and GL accounts through RFC/BAPI function modules, OData v2 REST via SAP Gateway at http://<host>:<port>/sap/opu/odata/, SOAP/WSDL, or IDoc XML. Authentication uses HTTP Basic Auth (username and password) for OData and IDoc endpoints, or RFC Basic Auth for BAPI calls via SAP .NET Connector or Java Connector running on an on-premises agent. SAP ECC has no native webhook registry, so data is read by polling RFC_READ_TABLE on demand or a scheduled interval. IDoc push is available if the customer configures WE21/WE20/SM59, but it requires SAP Basis team setup and does not include HMAC webhook signatures.

How WooCommerce works

WooCommerce exposes orders, customers, products, refunds, taxes, coupons, and payment gateway information through REST API at https://<customer-domain>/wp-json/wc/v3/, protected by API Key authentication (Consumer Key and Consumer Secret pair) using HTTP Basic Auth or OAuth 1.0a one-legged flow. It supports a webhook push model with topics including order.created, order.updated, order.deleted, customer.created, customer.updated, customer.deleted, product.created, product.updated, product.deleted, and coupon events. Webhook signatures use HMAC-SHA256 with the webhook secret, and webhooks disable automatically after 5 consecutive non-2xx responses.

What moves between them

Products and customers flow from SAP into WooCommerce on a schedule tied to SAP BAPI reads of materials and customers. Orders and refunds flow from WooCommerce into SAP on webhook events (or polling fallback): each order creates a sales document in SAP via BAPI_ACC_DOCUMENT_POST, and each refund records a credit memo. Prices and customer tax IDs are updated in both directions based on changes in either system. Inventory levels can flow from SAP material master to WooCommerce product stock if configured per customer, but this is not automatic.

How ml-connector handles it

ml-connector runs an on-premises agent (or accepts an existing SAP .NET Connector instance) and connects to SAP via RFC Basic Auth, reading materials via BAPI_MATERIAL_GETLIST, customers via BAPI_CUSTOMER_GETLIST, and GL account mappings via BAPI_GL_ACC_GETLIST. On the WooCommerce side, it stores the API Key (Consumer Key and Secret) encrypted and authenticates via HTTP Basic Auth on every REST call. Product and customer syncs run on a user-configured schedule via polling, since SAP ECC does not support native outbound webhooks. Order and refund events trigger via WooCommerce webhooks: ml-connector validates the HMAC-SHA256 signature, then calls BAPI_ACC_DOCUMENT_POST in SAP to create a sales document, mapping WooCommerce customer IDs to SAP customer master records and WooCommerce product line items to SAP materials. If a BAPI call fails, ml-connector retries with exponential backoff. BAPI_ACC_DOCUMENT_POST requires an explicit BAPI_TRANSACTION_COMMIT call to finalize the document, and ml-connector includes the WooCommerce order ID in the SAP document reference field to prevent duplicate posting on retry. If WooCommerce webhooks disable due to failures, ml-connector can fall back to polling WooCommerce orders via the REST API, but polling is slower than webhook delivery and is recommended only as a recovery path.

A real-world example

A mid-sized online retailer runs SAP ECC on-premises for accounting and inventory, and WooCommerce for its B2C store. Before the integration, the operations team exported product lists and pricing from SAP twice weekly and uploaded them to WooCommerce by hand, and at end of month, the finance team downloaded orders from WooCommerce and manually entered them as sales documents in SAP, cross-checking customer names and product codes by eye. Incorrect product prices and duplicate order entries were common. With SAP ECC and WooCommerce connected, products and prices update automatically when the SAP materials team changes them, and each WooCommerce order immediately posts to SAP as a sales document with the correct customer and product codes, eliminating manual entry and the associated errors.

What you can do

  • Sync SAP materials to WooCommerce as products, with prices and descriptions updated on a schedule.
  • Sync SAP customers to WooCommerce as customer records, with tax IDs and shipping addresses in both directions.
  • Record each WooCommerce order as a sales document in SAP via BAPI_ACC_DOCUMENT_POST, mapped to the correct GL accounts and cost centers.
  • Capture WooCommerce refunds and post them as credit memos in SAP, linked to the original order by reference.
  • Validate WooCommerce webhook signatures using HMAC-SHA256 and handle RFC polling fallback if webhooks are disabled.

Questions

How does ml-connector connect to SAP ECC if it is on-premises and not a cloud service?
ml-connector requires an on-premises agent (SAP .NET Connector or Java Connector) installed on the customer's network with RFC connectivity to the SAP system. The agent maintains a persistent connection and relays RFC/BAPI calls from ml-connector's cloud infrastructure to SAP. Alternatively, if the customer has already configured OData via SAP Gateway, ml-connector can read via REST over HTTPS to the SAP Gateway endpoint, which requires HTTP Basic Auth and does not need an agent.
Can ml-connector sync inventory levels from SAP to WooCommerce?
Yes, ml-connector can read material stock quantities from SAP via BAPI_MATERIAL_GET_DETAIL and update WooCommerce product stock via the REST API. However, the reverse direction (WooCommerce stock depleting in SAP) is not automatic, because SAP ECC requires inventory transactions (goods movements) to be posted via dedicated BAPIs like BAPI_GOODSMVT_CREATE, not simple stock updates. This can be configured per customer if the business process supports it.
What happens if a WooCommerce order fails to post in SAP?
If BAPI_ACC_DOCUMENT_POST returns an error, ml-connector retries with exponential backoff, tracking the attempt count in its audit log. If the error is transient (network timeout, SAP system lock), the retry succeeds. If the error is permanent (invalid customer number, invalid GL account), ml-connector alerts the customer and stores the failed record in the audit trail for manual review and correction. The WooCommerce order is not modified.

Related integrations

Connect SAP ECC and WooCommerce

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

Get started