ml-connector
SAP S/4HANAMarketo

SAP S/4HANA and Marketo integration

SAP S/4HANA holds your enterprise finance, procurement, and supply chain. Marketo runs your B2B marketing and sales. Connecting them keeps your CRM fed with accurate master data from your ERP. New suppliers and customers added in SAP flow into Marketo as company and lead records, so your sales and marketing teams work with the same customer list your finance team maintains. Status changes in SAP sync back, keeping one source of truth.

How SAP S/4HANA works

SAP S/4HANA exposes suppliers, customers, purchase orders, GL accounts, cost centers, and journal entries through OData V2 and OData V4 REST APIs served at a tenant-specific base URL. Authentication uses OAuth 2.0 Client Credentials with scopes tied to a Communication Arrangement; tokens are short-lived (typically 12 hours) and require refresh before expiry. Key master data is exposed in read-only APIs such as A_BusinessPartner, A_Supplier, A_SupplierCompany, and A_Customer. SAP S/4HANA has no native webhook system, so master data changes are discovered by polling with timestamps or delta tokens.

How Marketo works

Marketo exposes leads, companies, opportunities, sales persons, and custom objects through REST JSON APIs at a Munchkin-specific endpoint. Authentication uses OAuth 2.0 Client Credentials with a maximum 3600 second token expiry. Marketo supports polling only; it has no inbound event API and cannot push changes to external systems. The Leads and Companies APIs accept batch operations up to 300 records per request and support filtering by updatedAt timestamp for incremental sync. Activities are read via a separate Bulk Activity Extract API with a 31 day window. Opportunities and Sales Persons are read-only if Salesforce or Dynamics is enabled.

What moves between them

Business partner data flows from SAP S/4HANA into Marketo. Suppliers and supplier company records are upserted as Marketo companies with SAP partner IDs mapped as a custom field for deduplication. Customer and customer company records are upserted as Marketo leads paired to their company. GL account dimensions and cost center mappings from SAP enrich company records with account codes so sales teams understand which GL dimension each customer rolls into. Changes in SAP (new supplier added, customer name updated) are detected by polling and flow into Marketo on a schedule you define. The sync is one-way: SAP is the system of record for master data.

How ml-connector handles it

ml-connector stores both credential sets encrypted and refreshes OAuth tokens on each request, handling SAP's short-lived tokens by caching and refreshing before expiry. On the SAP side, it builds OData filter queries using LastChangeDateTime or delta tokens to find changed business partners since the last sync run. For each new or changed partner, it constructs the corresponding Marketo company or lead record, mapping SAP business partner roles to Marketo record types and SAP cost center codes to custom fields. Marketo's batch API accepts up to 300 leads and companies per request, so ml-connector batches the transformed records and posts them in chunks. GL account and cost center mappings are maintained in SAP and read-only, so enrichment flows in one direction. When a token expires or a rate limit is hit, ml-connector backs off and retries. Every record carries a full audit trail and can be replayed if a downstream upsert fails.

A real-world example

A mid-market B2B software company runs SAP S/4HANA for procurement and GL management across three regional offices. The sales team uses Marketo for lead nurturing and pipeline management. Before the integration, the sales team manually imported the SAP customer list into Marketo every quarter, often missing new accounts added in procurement and updating old customer names by hand. With SAP S/4HANA and Marketo connected, new customers and suppliers added in SAP appear in Marketo within hours of their first PO or invoice. When a customer name or address changes in SAP, the Marketo record updates automatically, so the sales team's campaign list is always fresh. Month-end reconciliations between sales and procurement now start with alignment instead of a list of mismatches.

What you can do

  • Upsert SAP suppliers and customers into Marketo as companies and leads, deduplicating on SAP partner ID.
  • Detect new and changed business partners in SAP using OData polling with LastChangeDateTime filters.
  • Map SAP GL accounts and cost centers to Marketo company records so sales teams understand finance dimensions.
  • Refresh OAuth tokens for both SAP and Marketo and retry on rate limits and transient failures.
  • Maintain a complete audit trail of every business partner sync and replay failed upserts without duplicate records.

Questions

Which direction does data move between SAP S/4HANA and Marketo?
Data flows from SAP S/4HANA into Marketo. Suppliers and customers from SAP are upserted as Marketo companies and leads, and GL account dimensions are mapped to custom fields. Marketo is the destination; SAP is the system of record for master data. Changes in SAP are pulled via polling and reflected in Marketo, but Marketo does not push changes back to SAP.
How does ml-connector handle SAP's short-lived OAuth tokens?
ml-connector caches the OAuth token returned by SAP's token endpoint and refreshes it before expiry (typically before 12 hours). On each request to SAP's OData APIs, it checks the token age and refreshes proactively if needed, so token expiry never interrupts a sync.
How are SAP business partners matched to Marketo records to avoid duplicates?
ml-connector maps each SAP business partner ID to a custom field in the Marketo company or lead record. When syncing, it uses Marketo's batch upsert API with the SAP partner ID as the external key, so duplicate matches are based on that ID rather than name, ensuring that a customer name change in SAP updates the existing Marketo record rather than creating a second one.

Related integrations

Connect SAP S/4HANA and Marketo

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

Get started