How-toSAP S/4HANAAPIs / Integration

SAP S/4HANA API Guide: Business Hub, OData, Public Cloud and Business Partner

Question
sap s4 hana api

Also searched as

  • sap s4 hana api integration
  • sap s/4hana public cloud api
  • sap bp api
  • sap pi api
  • api sap dm

Short answer

S/4HANA APIs are discovered in the SAP Business Accelerator Hub and mostly delivered as A2X OData services such as API_BUSINESS_PARTNER. On-premise you activate them in the Gateway; in the public cloud you create a communication user, system and arrangement for a communication scenario. PI/PO or Integration Suite sit in between for orchestration, and SAP Digital Manufacturing has its own APIs on BTP.

Applies to: SAP S/4HANA on-premise, private cloud edition and public cloud edition. Names and available services depend on release.

How to start with S/4HANA APIs

  1. 1Open the SAP Business Accelerator Hub (api.sap.com), choose S/4HANA, and search the business object. Check the API type: OData V2 or V4, SOAP, or event.
  2. 2On-premise or private cloud: activate the service in /IWFND/MAINT_SERVICE, then test with /IWFND/GW_CLIENT.
  3. 3Public cloud: open the Communication Management apps. Create a communication user, a communication system that represents the caller, and a communication arrangement for the scenario that contains the API.
  4. 4Note the endpoint, user and authentication method from the arrangement and call the service from your client or middleware.
  5. 5For business partners, use the Business Partner API with the A_BusinessPartner entity set, and its related address and role entities. Read before write, and fetch a CSRF token for writes.
  6. 6If the integration uses SAP Process Integration or Process Orchestration, build the interface in the Enterprise Services Repository and point the channel at the OData or SOAP endpoint. Check SAP's current maintenance statement for PI/PO.
  7. 7For SAP Digital Manufacturing, obtain a service key on BTP and use OAuth client credentials against the Digital Manufacturing APIs.
  8. 8Add monitoring and error handling: log the request id, retry on 5xx, never retry non-idempotent writes blindly.

Where APIs come from

The Business Accelerator Hub is the catalogue. For S/4HANA it lists released APIs with the entity model, the authentication options and a sandbox. The A2X (application to external) OData services are the main integration style for custom apps, with typical names such as API_BUSINESS_PARTNER, API_SALES_ORDER_SRV and API_PURCHASEORDER_PROCESS_SRV.

Only use released APIs. Calling an unreleased service or a table directly may work today and break at the next upgrade, and in public cloud it is simply not allowed.

Public cloud: communication arrangements

In the public cloud edition you cannot activate services at will. Each API belongs to a communication scenario (for example, a scenario for business partner integration), and you expose it by creating the communication arrangement that references the scenario, a communication system and a communication user. This is the control point for who may call what.

Authentication is then basic, OAuth 2.0 or certificate-based, depending on the arrangement. Use OAuth or certificates for anything beyond a demo.

Communication Users            -> technical user and password/cert
Communication Systems          -> the caller
Communication Arrangements     -> scenario + system + user
GET /sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner?$top=5&$format=json

Where PI/PO and DM fit

SAP PI/PO is the on-premise middleware that maps and routes messages between SAP and other systems; for new work SAP positions Integration Suite on BTP instead. Many plants still run PI/PO for existing interfaces, so check your maintenance dates before building new ones on it.

SAP Digital Manufacturing is a separate BTP product with its own APIs, used to exchange production orders, confirmations and shop-floor data with S/4HANA. It is called with OAuth tokens from a service key, not through the S/4 Gateway.

Choosing between APIs, IDocs and events

Use OData for synchronous reads and small writes, IDocs or SOAP for established partner exchanges, and business events for decoupled notifications. Do not extract large histories by paging OData for hours; use extraction tools designed for bulk.

Try it here, free

SAP API Business Hub Request Generator

Open full tool

Build a ready-to-run cURL or HTTP request for an SAP API Business Hub sandbox or your own S/4HANA Cloud tenant, with the right headers and query options.

Common pitfalls

  • !Using unreleased APIs or tables, which break on upgrade and are blocked in public cloud.
  • !Building a new interface on PI/PO without checking its maintenance horizon.
  • !Sharing one communication user across many integrations.
  • !Missing the CSRF token flow on write calls.
  • !Bulk extraction through OData paging instead of a proper extraction tool.

How an ERP-grounded AI assistant handles this

An AI layer on S/4HANA uses these same released APIs, with the caller's role, so answers respect SAP authorisations. For on-prem S/4HANA, Netray places the private model beside the system, calls read-only services or CDS views, and shows each call. It adds a conversational layer without replacing your integration middleware.

Frequently asked questions

Where do I find SAP S/4HANA APIs?

In the SAP Business Accelerator Hub at api.sap.com, filtered to S/4HANA. It lists released OData and SOAP APIs with entity models, authentication details and a sandbox for testing before you touch your own system.

How do I enable an API in S/4HANA public cloud?

Create a communication user, a communication system and a communication arrangement for the scenario that contains the API, using the Communication Management apps. The arrangement gives you the endpoint and authentication details to use.

What is the SAP Business Partner API?

API_BUSINESS_PARTNER is the OData service for business partners, customers and suppliers in S/4HANA, with the A_BusinessPartner entity and related address, role and bank entities. It is used to read and sync master data.

Is SAP PI/PO still used for APIs?

Many landscapes still run it for existing interfaces, but SAP directs new integration to Integration Suite on BTP. Check SAP's current maintenance dates for your release before building new interfaces on PI/PO.

Related

How-to

SAP PP, PM and MM API: Production Orders, Maintenance Orders and Material Master

S/4HANA exposes production orders, maintenance orders and material master through OData services published in the SAP Business Accelerator Hub, for example API_PRODUCTION_ORDER_2_SRV, API_MAINTENANCEORDER and API_PRODUCT_SRV. On ECC or older releases, use BAPIs and RFC such as BAPI_PRODORD_CREATE, BAPI_ALM_ORDER_MAINTAIN and BAPI_MATERIAL_SAVEDATA. Direct M-table access is not an API and is best avoided.

How-to

Calling SAP APIs from Python: OData with requests, Authentication and PyRFC

The simplest way to call SAP from Python is OData over HTTPS with the requests library: send a GET to the service with $select, $filter and $top, authenticate with basic or OAuth, and follow the next-page link. For writes fetch a CSRF token first. Use PyRFC only for functions that have no OData service, and accept the extra SAP NW RFC SDK dependency.

CIO briefing

ERP Integration Architecture: API vs iPaaS vs ETL

Choose by what the data does, not by tool preference. Use the ERP's own API (or its native bus) for transactional writes that must be validated by ERP business logic, ETL or change data capture for bulk analytical reads, and an iPaaS when you have many endpoints, need monitoring and retries, and lack the staff to run your own middleware. Most real estates need two of the three.

Error fix

SAP M7 021: Deficit of SL Stock Quantity

M7 021 fires during a goods issue, delivery, or confirmation when SAP checks the unrestricted-use (SL) stock for the exact plant, storage location and batch combination and finds less than what you are trying to post out. Fix the entry (batch, storage location, quantity) first; only enable negative stock or downgrade the message to a warning if the business genuinely needs to post ahead of a receipt.

Error fix

SAP IDoc Status 51: Application Document Not Posted

Status 51 tells you the IDoc reached the application layer and failed to post, but the status text itself is not the error - the real cause sits in the status record's long text or the linked application log. Fix the underlying data or configuration, then reprocess the IDoc through BD87 rather than editing the status.

Error fix

SAP Short Dump TIME_OUT: Maximum Runtime Exceeded

A TIME_OUT runtime error means a dialog (or RFC) work process ran longer than the maximum allowed runtime, controlled by profile parameter rdisp/max_wprun_time (600 seconds by default). The fix is almost always to move the long-running work to background processing or tune the underlying program, not to raise the timeout.

AI for ERP

AI for SAP S/4HANA, Running On-Prem or in Your Private Cloud

Run AI on SAP S/4HANA without sending ERP data to a public API. On-prem and private-cloud architecture, CDS views, OData, and honest deployment trade-offs.

AI for ERP

SAP BTP and a Private LLM: Where the Generative AI Hub Fits and Where It Doesn't

Where SAP BTP's Generative AI Hub fits and where a self-hosted LLM belongs instead. CAP, Integration Suite, and an architecture decision framework.

AI for ERP

SAP Joule or a Private LLM Beside SAP: An Honest Comparison

An honest comparison of SAP Joule and Business AI against a private, self-hosted LLM beside SAP: what each covers, where they overlap, and where CIOs run both.

Stuck on SAP S/4HANA?

Talk to engineers who work inside SAP S/4HANA every week, and who build private AI that answers these questions from your own ERP data.

Keep exploring

Free tools

ERP fixes and how-tos

Runs with your ERP

AI on your ERP

Integrations