ml-connector
SAP Business OneCleo

SAP Business One and Cleo integration

SAP Business One powers procurement and order-to-cash operations. Cleo orchestrates trading partner EDI and logistics. Connecting the two ensures that invoices from SAP reach suppliers in Cleo's network as compliant EDI 810 transactions, and incoming purchase orders from buyers arrive as EDI 850 documents that SAP can consume. ml-connector handles the on-premise SAP infrastructure, the stateless OAuth2 connection to Cleo, the document transformation, and the full audit trail.

How SAP Business One works

SAP Business One exposes purchase orders, invoices, items, business partners, journal entries, and chart of accounts through OData v4 REST at a customer-specific Service Layer URL (https://<customer-server>:<port>/b1s/v2/). Authentication uses a B1SESSION token obtained via POST /Login, valid for 30 minutes of inactivity before expiring with error code -5002. Each customer instance is on-premise or partner-hosted, so there is no shared global endpoint. Webhooks are available in SAP Business One v10.0 FP 2602+ if the server-side Webhook Messenger Service is activated, but polling via scheduled GET requests with UpdateDate filters is the recommended default.

How Cleo works

Cleo Integration Cloud is a REST-based B2B/EDI platform accessible at https://YOURTENANT.cleointegration.com/api for cloud deployments or custom host/port for on-premise Harmony instances. Authentication uses OAuth 2.0 password grant: exchange username and password for a short-lived Bearer token. Cleo exposes folders, files, connections, actions, and audit events through its API. Outbound webhooks and EDI transaction flows are configured through CIC Studio by tenant admins rather than self-service; Cleo itself is integration middleware, not an ERP, so invoices and POs flow through as EDI files or API payloads mapped to Cleo's folder and action structure.

What moves between them

The main flow is SAP to Cleo. ml-connector polls SAP Business One for outbound invoices and purchase orders on a schedule, transforms them into EDI 810 (invoice) and 850 (purchase order) formats, and posts them into Cleo as file uploads or API actions for distribution to trading partners. Incoming EDI 850 purchase orders from Cleo are polled from Cleo's inbound folder, transformed back to SAP's OData schema, and posted as new purchase orders in SAP. Invoice confirmations and ASNs flow the same direction, from SAP outbound to Cleo.

How ml-connector handles it

ml-connector maintains a stateless OAuth2 session to Cleo, refreshing the Bearer token as needed. On the SAP side, it manages the B1SESSION token and refreshes it proactively before the 30-minute inactivity timeout expires, so documents are never interrupted mid-stream. Every poll uses OData $filter with UpdateDate to fetch only new or changed records since the last run, avoiding redundant API calls. Before posting an invoice to Cleo, ml-connector validates that the customer exists in SAP and the line items reference valid items. EDI segment mapping follows Cleo's configured action structure in CIC Studio: SAP invoice lines map to EDI 810 IT01 segments with item number, quantity, and unit price; purchase order headers include buyer and ship-to contact info from SAP business partners. Retries back off exponentially on Cleo 429 (rate limit) responses and on SAP session timeouts, with the full record ID tracked so failed posts can be replayed without duplication. Every transaction carries a timestamp and job ID for audit.

A real-world example

A mid-sized distributor runs SAP Business One for order management and financial posting, and exchanges EDI with 15 major suppliers through Cleo. Before the integration, the supply chain team exported invoices from SAP each day, manually reformatted them as EDI 810 files in Cleo, and reversed the process for incoming purchase orders from suppliers. With SAP Business One and Cleo connected, each new invoice in SAP automatically flows to Cleo as a compliant EDI 810 and routes to the supplier's mailbox within minutes. Incoming EDI 850 purchase orders from suppliers land in Cleo and are automatically posted as new SAP purchase orders, eliminating manual re-entry and the weeks-long lag between supplier request and SAP order creation.

What you can do

  • Poll SAP Business One for outbound invoices and purchase orders, transform them into EDI 810 and 850 formats, and post them into Cleo for supplier distribution.
  • Receive incoming EDI 850 purchase orders from Cleo, transform them to SAP OData schema, and post them as new purchase orders in SAP Business One.
  • Manage SAP B1SESSION tokens proactively to avoid session timeout mid-stream, and refresh Cleo OAuth2 Bearer tokens as needed.
  • Validate customer business partners, item numbers, and profit centers in SAP before posting any outbound invoice or purchase order.
  • Track every record with job IDs and audit timestamps, and replay failed posts without duplication on token refresh or network retry.

Questions

How does ml-connector handle SAP Business One's 30-minute session timeout?
ml-connector tracks the B1SESSION token expiry and refreshes it proactively before the 30-minute inactivity window expires, ensuring that document polls and posts never timeout mid-stream. If a session does expire during a call, the token error code -5002 triggers an immediate re-login and automatic retry.
What EDI segments and transactions are supported between SAP and Cleo?
ml-connector transforms SAP invoices into EDI 810 (invoice) and purchase orders into EDI 850 (PO request) formats. Line items map to IT01 segments with item number, quantity, unit price, and description from SAP's Items table. Header segments include bill-to, ship-to, and buyer contact info from SAP BusinessPartners.
Does ml-connector support Cleo on-premise (Harmony) deployments?
Yes. Cleo's REST API is the same for both cloud CIC and on-premise Harmony/VLTrader instances; ml-connector accepts a custom host and port for on-premise deployments and uses the same OAuth2 password grant authentication flow in both cases.

Related integrations

Connect SAP Business One and Cleo

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

Get started