AdvancedSAP S/4HANA (on-premise and Cloud)Integration / OData and SOAP APIs

SAP S/4HANA API Documentation: Where It Is and How to Use It

Question
sap s4 hana api documentation

Also searched as

  • sap s4hana public cloud api
  • api sap s4hana public cloud
  • sap s4 hana integration
  • sap business accelerator hub odata api

Short answer

S/4HANA API documentation lives on the SAP Business Accelerator Hub (api.sap.com), under the S/4HANA Cloud or S/4HANA on-premise package. Most APIs are OData (v2, and v4 for newer ones) plus SOAP for some integrations. In public cloud you authorize an external caller with communication arrangements; on-premise you activate the service in the Gateway and use basic, OAuth or certificate authentication.

Applies to: SAP S/4HANA Cloud Public Edition, Private Edition and S/4HANA on-premise (service names are stable across releases, available fields vary by release).

How to start using an S/4HANA API

  1. 1Open the SAP Business Accelerator Hub (api.sap.com) and search the S/4HANA package. Open the API, read the resource overview and the data model, and download the EDMX or OpenAPI definition.
  2. 2On public cloud: in Fiori, use Communication Systems, Communication Users and Communication Arrangements apps. Create an arrangement from the communication scenario that contains the API, with the user and authentication type.
  3. 3On-premise: activate the OData service with /IWFND/MAINT_SERVICE (Add Service), check the ICF node in SICF, and give the technical user the authorization for the service and the underlying business objects.
  4. 4Fetch the service document and metadata ($metadata) to confirm the entity sets and fields available in your release.
  5. 5For read calls use $filter, $select, $top and $skip. For write calls (POST, PATCH), first make a GET with the header x-csrf-token: fetch, then use the returned token and the session cookies.
  6. 6Test with Postman or the hub's try-out feature on a sandbox or test client, never first on production.
  7. 7Add paging, retry on 429 and 503, and logging of the request and response IDs for support.

Main manufacturing and logistics APIs

Common OData services that manufacturers use: API_PRODUCT_SRV (material master), API_PURCHASEORDER_PROCESS_SRV (purchase orders), API_PURCHASEREQ_PROCESS_SRV (requisitions), API_MATERIAL_DOCUMENT_SRV (goods movements), API_MATERIAL_STOCK_SRV (stock), API_PRODUCTION_ORDER_2_SRV (production orders), API_SALES_ORDER_SRV, API_BUSINESS_PARTNER, and API_BILL_OF_MATERIAL_SRV. Exact names and versions differ by release and edition, so confirm each on the hub.

Not every business object has a public API in every edition. In public cloud only released APIs are allowed; in on-premise and private cloud you may also use classic BAPIs, IDocs and RFC, plus custom CDS views exposed as OData. Prefer released APIs for upgrade safety.

GET /sap/opu/odata/sap/API_MATERIAL_STOCK_SRV/A_MatlStkInAcctMod
    ?$filter=Plant eq '1000' and Material eq 'MAT-1'&$top=50
Header: Accept: application/json

Authentication and security

Public cloud supports basic authentication for a communication user in some scenarios, OAuth 2.0 (client credentials or SAML bearer) and certificates, depending on the arrangement. Use OAuth or certificates for production integrations and keep secrets in a vault.

On-premise, the Gateway can use basic auth, SAML or X.509. Use a technical user with a minimal role, restrict it to the service, and protect the Gateway with a reverse proxy or API management. Log calls and review authorizations, because an API user reads business data directly and bypasses the Fiori UI controls.

Choosing OData, SOAP, IDoc or events

Use OData for reading and simple transactional writes from apps and AI tools. Use SOAP where a scenario is defined as an enterprise service, often for partner integrations. Use IDocs or events (SAP Event Mesh, business events) for asynchronous, high volume flows such as order status changes.

For bulk reads, OData paging gets slow. Use CDS based extraction, replication tools or a read replica rather than pulling millions of rows through a service.

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

  • !Writing against an unreleased API in public cloud; it can break on the next release.
  • !Skipping the CSRF token fetch for POST and PATCH and getting 403.
  • !Giving the integration user broad SAP_ALL style authorizations instead of a scoped role.
  • !Pulling large tables through OData instead of extraction; calls time out and slow the system.
  • !Relying on field names from an older release without reading $metadata on your system.

How an ERP-grounded AI assistant handles this

APIs are the clean way to give an AI assistant governed, role-aware access to S/4HANA. A Netray style setup connects an on-prem model to released OData services or a read replica, runs read-only by default, shows each query, and keeps the integration user scoped. Write-back, where used, goes through human approval.

Frequently asked questions

Where is the SAP S/4HANA API documentation?

On the SAP Business Accelerator Hub at api.sap.com. Search the S/4HANA Cloud or on-premise package, open the API and read the resources, data model and try-out. Your own system's $metadata is the final authority.

Does S/4HANA support REST?

S/4HANA exposes OData services, which are REST style over HTTP using JSON or XML. It also supports SOAP for some enterprise services, plus RFC, BAPI and IDoc on-premise.

How do I authenticate to S/4HANA public cloud APIs?

Create a communication system, user and arrangement for the communication scenario that contains the API. Authentication can be basic, OAuth 2.0 or certificate depending on the scenario.

Can I use BAPIs in S/4HANA Cloud?

In public cloud only released APIs and extension points are allowed, so direct BAPI and RFC use is not available the way it is on-premise. In on-premise and private cloud, BAPIs still work, but released APIs are safer for upgrades.

Related

How-to

How to Use BAPI_TRANSACTION_COMMIT Correctly

SAP's BAPI programming model separates business logic from the database commit on purpose, so a caller must explicitly call BAPI_TRANSACTION_COMMIT after a successful BAPI - usually with WAIT = 'X' - or the created object never actually persists. Skipping this step, or forgetting WAIT, is the most common reason a BAPI 'runs fine' but nothing gets saved.

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.

How-to

SAP SE16N vs SQVI: Table Browser vs Ad Hoc Query

SE16N is a single-table browser: fast filtering, formatted display, and export from one table at a time, with an optional edit function for authorized users. SQVI (Quick Viewer) builds ad hoc queries that join multiple tables without writing ABAP, and can be saved as a reusable report. Use SE16N for a quick look at one table; use SQVI when you need data joined across two or more tables.

CIO briefing

SAP ECC 2027: what mid-size manufacturers should actually do

SAP's mainstream maintenance for ECC 6.0 ends in 2027, with extended maintenance available at additional cost typically through around 2030 depending on the specific agreement. Mid-size manufacturers have three real options: migrate to S/4HANA (on-prem or cloud) before 2027, pay for extended maintenance to buy 2-3 more years, or move off SAP entirely. With limited internal SAP resourcing, most mid-size manufacturers should already be past discovery and into a scoped S/4HANA conversion plan by now, or actively budgeting for extended maintenance as a deliberate bridge, not a default.

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 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.

Stuck on SAP S/4HANA (on-premise and Cloud)?

Talk to engineers who work inside SAP S/4HANA (on-premise and Cloud) 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