ml-connector
SAP S/4HANAMicrosoft Dynamics 365 Sales

SAP S/4HANA and Microsoft Dynamics 365 Sales integration

SAP S/4HANA holds your master data for suppliers, customers, and business partners. Microsoft Dynamics 365 Sales drives your pipeline and revenue forecasting. Connecting the two keeps your CRM prospect and customer lists current with SAP, so your sales team always works with the right names, addresses, and payment terms. New suppliers added in SAP flow automatically into Dynamics 365 Sales as accounts, and customer changes in SAP update contact records without re-keying.

How SAP S/4HANA works

SAP S/4HANA exposes business partners, suppliers, customers, purchase orders, GL accounts, cost centers, and purchase requisitions through OData V2 and OData V4 REST APIs. The cloud product authenticates with OAuth 2.0 Client Credentials against a tenant-specific Communications Arrangement, which establishes scoped access per API service. Tokens are short-lived, typically 12 hours, and must be cached and refreshed before expiry. SAP Cloud Public Edition publishes no native webhooks, so records are read by polling with timestamp filters or delta tokens.

How Microsoft Dynamics 365 Sales works

Microsoft Dynamics 365 Sales exposes accounts, contacts, leads, opportunities, quotes, and sales orders through the OData v4.0 Dataverse Web API. Authentication uses OAuth 2.0 via Microsoft Entra ID with Client Credentials flow for server-to-server integration. Tokens expire in approximately 60 minutes. Dynamics 365 Sales supports webhooks through the Dataverse Event Framework with a 256 KB payload limit per delivery and a 60-second timeout with one automatic retry for transient errors, but does not include GL accounts, vendors, or ledger entries.

What moves between them

Business partners, suppliers, and customers flow from SAP into Dynamics 365 Sales as accounts and contacts. SAP read-only GL accounts and cost centers are mapped to Dynamics 365 Sales properties so sales teams understand profitability dimensions. Changes to supplier records, addresses, and payment terms in SAP are polled and synced to Dynamics 365 Sales accounts on a daily or weekly cadence. Dynamics 365 Sales generates no data back to SAP in this flow.

How ml-connector handles it

ml-connector stores both credential sets encrypted and manages SAP's short-lived OAuth tokens by caching and refreshing before expiry. On the Dynamics 365 Sales side it registers webhooks through the Dataverse Event Framework to receive Create, Update, and Delete notifications for accounts and contacts, and it also polls SAP business partner data with OData filters on LastChangeDateTime to catch updates between webhook deliveries. SAP Communication Arrangements are customer-created prerequisites, so ml-connector accepts the configured service names and token endpoints per customer and does not attempt to construct them. Because SAP Cloud Public has no outbound webhooks, polling is the primary sync vector for SAP changes. Dynamics 365 Sales webhook payloads are capped at 256 KB, so ml-connector batches large account imports and retries failed deliveries within the 60-second timeout window. Every record carries a full audit trail and can be replayed if a downstream call fails.

A real-world example

A mid-sized manufacturing company runs SAP S/4HANA for procurement and finance across three regional offices, and uses Dynamics 365 Sales to manage customer relationships and a pipeline of new projects. Before the integration, sales teams manually maintained a duplicate list of customers and suppliers in Dynamics 365 Sales, and when SAP added a new vendor or updated a customer address, the CRM fell out of sync within weeks. With SAP S/4HANA and Dynamics 365 Sales connected, each supplier added in SAP automatically appears as a prospective account in Dynamics 365 Sales, and customer addresses and payment terms flow automatically so the sales team and finance team work from the same master data.

What you can do

  • Sync SAP business partners and suppliers into Dynamics 365 Sales accounts and contacts, keeping CRM prospect lists current with SAP master data.
  • Manage SAP OAuth tokens with scoped Communication Arrangements and handle short-lived token refresh before expiry.
  • Register and receive webhooks through the Dataverse Event Framework for Create, Update, and Delete notifications on accounts and contacts.
  • Poll SAP business partner changes using OData timestamp filters and delta tokens, and sync updates on a schedule you control.
  • Track every record with a full audit trail and replay failed records if a downstream Dataverse call times out or returns a transient error.

Questions

How does ml-connector handle SAP's Communication Arrangement and scoped OAuth tokens?
SAP administrators create the Communication Arrangement in SAP, establishing which APIs are available and what scopes apply. ml-connector stores the token endpoint URL and Client ID/Secret from that arrangement, caches the resulting OAuth tokens, and refreshes them before the typical 12-hour expiry. This avoids token expiry surprises in the middle of a sync.
Does Dynamics 365 Sales receive all business partner data from SAP, or only certain records?
ml-connector syncs SAP business partners where the Business Partner Role includes Supplier or Customer. This filters out internal organizational units and system accounts that do not belong in a sales CRM. Each SAP partner becomes either an account or contact in Dynamics 365 Sales depending on whether it is a supplier, customer, or both.
What happens if a Dynamics 365 Sales webhook fails to deliver or times out?
Dataverse webhooks have a 60-second timeout and one automatic retry for 502/503/504 errors. ml-connector logs the failure to the audit trail and can be triggered to replay the record in the next scheduled sync. If the issue is a 256 KB payload size exceeded, ml-connector batches the import into smaller chunks.

Related integrations

Connect SAP S/4HANA and Microsoft Dynamics 365 Sales

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

Get started