ml-connector
SAP S/4HANAPaylocity

SAP S/4HANA and Paylocity integration

SAP S/4HANA runs your enterprise resource planning and general ledger. Paylocity runs your payroll and human capital management. When employee data and payroll results flow from Paylocity into SAP S/4HANA, your headcount stays current, your labor cost allocations land on the right cost centers, and your general ledger reflects the true cost of labor after each payroll cycle. ml-connector handles the different authentication models and APIs on each side and moves the data on a schedule tied to your payroll calendar.

How SAP S/4HANA works

SAP S/4HANA is deployed in three modes: Cloud Public Edition (SaaS), Cloud Private Edition (single-tenant), or On-Premise. It exposes procurement, finance, and HR master data through OData V2 and V4 REST APIs over HTTPS, with base URLs routed through the tenant-specific domain. Authentication uses OAuth 2.0 client credentials configured via Communication Arrangements in the SAP system; an SAP administrator must set up the Communication System, User, and Arrangement before API access is enabled. Tokens are typically short-lived (around 12 hours) and must be refreshed before expiry. SAP has no native webhooks, so integrations must poll using LastChangeDateTime filters or delta tokens. Key entities include suppliers, customers, purchase orders, invoices, GL accounts, cost centers, and journal entries.

How Paylocity works

Paylocity is a cloud-based HCM and payroll platform for mid-market US businesses. It exposes employee records, pay statements, deductions, earnings, work locations, and positions through REST JSON APIs secured with OAuth 2.0 bearer tokens obtained via a client credentials flow. Paylocity also supports webhooks that trigger on New Hire, Employee Change, Termination, Payroll Processed, and Time Off Approval events; webhooks are delivered as HTTPS POST JSON with automatic retries for up to 24 hours on failure. Event payloads carry identifiers only, so the full record data must be fetched via subsequent API calls. Access requires existing Paylocity customer status or a signed Marketplace Partner Agreement, and client secrets must be rotated annually.

What moves between them

The main flow runs from Paylocity into SAP S/4HANA. Employee records including name, hire date, termination date, and work location flow from Paylocity into SAP S/4HANA as business partners and cost assignments. After each payroll cycle, ml-connector reads payroll earnings and deductions from Paylocity, maps them to SAP cost centers and GL accounts, and writes journal entry lines into SAP S/4HANA to post labor cost distributions. Employee changes such as terminations and rehires flow the same direction so SAP headcount reflects current staffing. The sync runs on a schedule tied to your payroll calendar, typically triggered by the Payroll Processed webhook from Paylocity or via polling if webhooks are not enabled. Cost center alignment happens first, so every journal entry line references a valid SAP cost center and GL account.

How ml-connector handles it

ml-connector stores both OAuth credential sets encrypted and refreshes the bearer tokens for each system before they expire. On the SAP side, it accepts the tenant-specific OData base URL per customer instance, which is copied from the Communication Arrangement settings; it does not construct the URL manually because token endpoints and API paths vary by tenant. SAP Cloud Public deployments do not require the sap-client parameter, whereas On-Premise instances do. Since SAP exposes no webhooks, ml-connector polls for GL account and cost center changes on a payroll-driven schedule and uses LastChangeDateTime filters to fetch only records changed since the last successful sync. When a GL account or cost center is not found in SAP, the posting is queued for retry after confirmation that the dimension has been created. Paylocity webhook events (Payroll Processed, Employee Change, New Hire, Termination) are received via a registered HTTPS endpoint and trigger immediate reconciliation; if a webhook delivery fails, Paylocity retries for up to 24 hours. ml-connector backs off and retries on rate limits or transient network failures, and it tracks audit metadata (source ID, timestamp, authenticated user) on every record so failed postings can be inspected and replayed.

A real-world example

A multi-location services company with 500 employees runs SAP S/4HANA for procurement and financial accounting across five regional operations, and uses Paylocity Workforce Now for payroll, HR, and benefits administration. Before the integration, payroll specialists exported earnings and deductions from Paylocity each pay period, manually allocated labor costs to the correct operations and job cost codes in SAP, and then posted journal entries for GL review. This manual process took one full business day after payroll close and was error-prone when allocations changed. With SAP S/4HANA and Paylocity connected, each payroll run automatically posts labor cost journal entries into SAP, allocated to the correct regional cost centers, and new hires and terminations update employee records in SAP in real time. The accounting team now verifies GL balances within hours of payroll close instead of days, and allocation errors have dropped by over 90 percent.

What you can do

  • Sync Paylocity employee records, hire dates, and terminations into SAP S/4HANA as business partners and cost assignments.
  • Post payroll earnings and deductions from Paylocity into SAP S/4HANA general ledger journal entries, allocated to the correct cost centers.
  • Receive and process Paylocity webhook events for New Hire, Termination, Employee Change, and Payroll Processed triggers.
  • Authenticate both systems with OAuth 2.0 and manage token refresh for both SAP and Paylocity, respecting each token's expiry.
  • Poll SAP on a payroll-cycle schedule with LastChangeDateTime filters, maintain a full audit trail, and replay failed postings on demand.

Questions

Does ml-connector receive Paylocity webhook events or does it poll for changes?
ml-connector supports both modes. It can receive Paylocity webhooks for New Hire, Termination, Employee Change, and Payroll Processed events if webhooks are enabled in your Paylocity account. It also polls SAP S/4HANA on a configurable schedule tied to your payroll calendar since SAP has no native webhooks. If a webhook delivery fails, Paylocity retries for up to 24 hours, and ml-connector reconciles with polling as a fallback.
How does the integration handle SAP S/4HANA's tenant-specific OAuth configuration?
Each SAP S/4HANA customer has a different tenant domain and token endpoint. ml-connector accepts the base OData URL and Communication Arrangement details per customer instance; an SAP administrator provides these during setup from the Communication Arrangement configuration. ml-connector does not construct URLs or token endpoints manually because they vary by deployment mode (Cloud Public, Cloud Private, On-Premise). Tokens are cached and refreshed before expiry to avoid authentication failures mid-sync.
What happens if a cost center or GL account referenced in a payroll entry does not exist in SAP S/4HANA?
ml-connector queues the journal entry for retry and logs the missing dimension in the audit trail. The posting does not fail the entire sync; instead it waits for confirmation that the cost center or GL account has been created in SAP by your finance team. When the dimension is added, ml-connector automatically retries the posting on the next scheduled cycle or on demand via the audit replay feature.

Related integrations

Connect SAP S/4HANA and Paylocity

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

Get started