logo

Are you need IT Support Engineer? Free Consultant

Stock Transport Orders via API in SAP S/4HANA Clou…

  • By Sanjay
  • 19/05/2026
  • 18 Views


Introduction

If you've spent time in SAP S/4HANA Cloud Public Edition managing intercompany or intracompany stock movements, you've likely run into the same wall: there was no supported API to create or manage Stock Transport Orders (STOs) programmatically. You had to use the Manage Purchase Orders Fiori app — no automation, no integration, no external system connectivity via API.

That limitation is now gone. Starting with the 2602 release, SAP delivered API_STOCKTRANSPORTORDER — a full OData V4 API for Stock Transport Order integration, built on the ABAP RESTful Application Programming Model (RAP). This blog tells the full story: why this gap existed, how customers pushed for it, and what you can do with the API today.


Background: The Long Road to This API

The Original Limitation

Prior to 2602, there was no API surface for Stock Transport Orders in SAP S/4HANA Cloud Public Edition. This was documented in SAP KBA 3110493, which explicitly stated that creating Purchase Orders with document type UB (intracompany STO) via API was not supported. The note applied equally to intercompany STO types (NB, NBIC) — the capability simply did not exist.

This was a meaningful gap. Many businesses operate with complex multi-plant or multi-company inventory networks and rely on STOs as the backbone of internal replenishment. Without an API, these flows could not be automated or integrated with external planning systems, warehouse management solutions, or custom applications.

Customer Voice: CIP Ideas and WCR

The community made its voice heard through SAP's Customer Influence Program (CIP):

  • CIP Idea 339702 — Request for an API to create intracompany STOs
  • CIP Idea 339703 — Request for an API to create intercompany STOs
  • CIP Idea 339704 — Request for an API to manage STO items and schedules

These ideas were formally consolidated into WCR0016548 — a Wish/Change Request for STO API support in the public cloud. 

Delivery: Two-Part Implementation

SAP delivered the API in two phases:

Phase Jira Item Scope Release

Part 1 S4HCRQMAPROC-26496 Core STO CRUD (create, update, delete items), schedule lines, account assignment 2602 CL (Sept 2025)
Part 2 S4HCRQMAPROC-26497 Pricing elements, subcontracting components, partners, notes 2602 CL (Nov 2025)

Both items targeted the 2602 release cycle and are now generally available.


What the API Covers — and What It Doesn't

Supported Document Types

The API supports all three STO document types used in SAP S/4HANA Cloud Public Edition:

Document Type Description Scope Item

UB Intracompany Stock Transfer BME (with delivery), BMH (without delivery)
NB Standard Intercompany BME
NBIC Advanced Intercompany Processing 5HP

API Entities (10 total)

The API exposes a rich set of entities covering the full STO document structure:

  1. StockTransportOrder — Header
  2. StockTransportOrderItem — Line items
  3. StockTransportOrderShipping — Shipping details per item
  4. STOScheduleLine — Delivery schedule lines
  5. STOAccountAssignment — Account assignment (cost center, WBS, etc.)
  6. STOItemPricingElement — Pricing conditions per item
  7. StockTransportOrderPartner — Partner functions (vendors, plants)
  8. StockTransportOrderNote — Header-level text/notes
  9. StockTransportOrderItemNote — Item-level text/notes
  10. STOSubcontractingComponent — Subcontracting BOM components

API Actions (4 total)

Beyond standard CRUD, the API exposes four business actions:

Action Scope

SetAllItemsToDelete Mark all items for deletion on a header
BlockAllItems Set delivery block on all items
SetItemToDeleted Mark a specific item for deletion
BlockItem Set delivery block on a specific item

Current Limitations (Roadmap Items)

The API is powerful, but two areas are deferred to future releases:

  1. Address management — Reading the default partner address is supported, but full address CRUD is planned for CE2702+.
  2. Batch field — The Batch field on STO items is not manageable via the API. Use the Manage Purchase Orders Fiori app for batch-controlled materials.

There is no action to delete an entire STO header via API — only individual items can be marked for deletion.


What Changed: Mapping Old Limitations to New Capabilities

Previous Limitation (per SAP KBA 3110493 / CIP) Status in 2602+

No API to create intracompany STO (type UB) Fully supported via POST to StockTransportOrder
No API to create intercompany STO (types NB, NBIC) Fully supported including NBIC advanced flow
No API to update STO items (quantity, date, pricing) PATCH supported on items and schedule lines
No API to manage account assignment Full CRUD on STOAccountAssignment
No API to manage pricing conditions Full CRUD on STOItemPricingElement
No API to add notes/text Supported on both header and item via notes entities
No API to manage subcontracting components Supported via STOSubcontractingComponent
No API to block items or mark for deletion Four dedicated business actions now available
No API partner/address management Read available now; full CRUD in CE2702+
Batch field management not available Still requires Manage Purchase Orders Fiori app

Setting Up the Integration

The API is secured through the Communication Scenario SAP_COM_0A80 (“Stock Transport Order Integration”).

Step-by-Step Setup (Public Cloud — Fiori Apps Only)

Step 1: Create a Communication System

  • Open the Communication Systems Fiori app
  • Create a new inbound communication system representing the external application or integration platform

Step 2: Create a Communication Arrangement

  • Open the Communication Arrangements Fiori app
  • Create a new arrangement and select scenario SAP_COM_0A80
  • Assign the communication system created in Step 1

Step 3: Configure the Communication User

  • Open the Maintain Communication Users Fiori app
  • Create or assign a communication user with a secure password
  • This user's credentials are used for Basic Authentication when calling the API

Step 4: Note the API Endpoint

The OData V4 service endpoint follows this pattern:

 

https://-api.s4hana.cloud.sap/sap/opu/odata4/sap/api_stocktransportorder/srvd_a2x/sap/stocktransportorder/0001/

 

Live API Demo

Let's walk through a complete example: creating a new NBIC intercompany Stock Transport Order via the API.

Step 1: Fetch a CSRF Token

OData V4 write operations require a CSRF token. Fetch one with a HEAD request:

 

curl -u "COMM_USER:password" \
  -I \
  -H "X-CSRF-Token: Fetch" \
  "https://-api.s4hana.cloud.sap/sap/opu/odata4/sap/api_stocktransportorder/srvd_a2x/sap/stocktransportorder/0001/?sap-client=100"

Extract the x-csrf-token value from the response headers and pass it in subsequent write requests.

Step 2: Read an Existing STO for Reference

Before creating a new document, it's useful to read an existing STO to confirm the required fields for your plant and company code configuration.

 

curl -u "COMM_USER:password" \
  "https://-api.s4hana.cloud.sap/sap/opu/odata4/sap/api_stocktransportorder/srvd_a2x/sap/stocktransportorder/0001/StockTransportOrder?sap-client=100&\$top=5&\$format=json"

 

To read items for a specific STO (note: use $filter, not $expand😞

 

curl -u "COMM_USER:password" \
  "https://-api.s4hana.cloud.sap/sap/opu/odata4/sap/api_stocktransportorder/srvd_a2x/sap/stocktransportorder/0001/StockTransportOrderItem?sap-client=100&\$filter=StockTransportOrder eq '4500000724'"

 

Step 3: Create a New NBIC Intercompany STO

Using the reference data gathered above, POST a new STO with one item in a single request. The header and items are submitted together using the _StockTransportOrderItem deep-insert navigation property:

 

curl -u "COMM_USER:password" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "X-CSRF-Token: " \
  "https://-api.s4hana.cloud.sap/sap/opu/odata4/sap/api_stocktransportorder/srvd_a2x/sap/stocktransportorder/0001/StockTransportOrder?sap-client=100" \
  -d '{
    "StockTransportOrderType": "NBIC",
    "CompanyCode": "1320",
    "PurchasingOrganization": "1320",
    "PurchasingGroup": "10B",
    "SupplyingPlant": "1311",
    "_StockTransportOrderItem": [
      {
        "StockTransportOrderItem": "00010",
        "Plant": "1320",
        "Product": "TD_LQ_16",
        "StorageLocation": "132A",
        "OrderQuantity": 1.000,
        "OrderQuantityUnit": "ST",
        "OrderQuantityUnitISOCode": "PCE"
      }
    ]
  }'

Important OData V4 detail: OrderQuantity is a Decimal — pass it as a number, not a string. Include OrderQuantityUnitISOCode alongside OrderQuantityUnit; the framework requires the ISO unit code.

The API returns the created document immediately with the assigned STO number:

 

{
  "StockTransportOrder": "4500000728",
  "StockTransportOrderType": "NBIC",
  "CompanyCode": "1320",
  "PurchasingOrganization": "1320",
  "PurchasingGroup": "10B",
  "SupplyingPlant": "1311",
  "DocumentCurrency": "CNY",
  "CreationDate": "2026-05-19",
  "_StockTransportOrderItem": [
    {
      "StockTransportOrder": "4500000728",
      "StockTransportOrderItem": "10",
      "Product": "TD_LQ_16",
      "Plant": "1320",
      "StorageLocation": "132A",
      "OrderQuantity": 1,
      "OrderQuantityUnit": "ST",
      "NetPriceAmount": 60.00,
      "DocumentCurrency": "CNY"
    }
  ]
}

New STO 4500000728 was created in under a second with a single API call.

 

Step 4: Verify in the Manage Purchase Orders Fiori App

The API-created STO is immediately visible in the standard Fiori UI. Open Manage Purchase Orders and search for the new STO number to confirm all fields were correctly applied.

Screenshot_Sto_4500000728.Png


Key Technical Notes for Integrators

  1. OData V4, not V2 — This API is built on OData V4. The response format is clean JSON with no XML overhead. ETags are returned for optimistic concurrency control on PATCH operations.

  2. Deep insert for header + items — Use the _StockTransportOrderItem navigation property in the POST body to create header and items in a single request.

  3. ISO unit codes are required — For quantity fields, always include the ISO unit code companion field (e.g., OrderQuantityUnitISOCode alongside OrderQuantityUnit). Omitting it returns a “ISO unit must be provided” error.

  4. $filter for items, not $expand — The $expand syntax for navigation properties does not work with this API. Fetch items separately using $filter=StockTransportOrder eq ''.

  5. ETags for updates — PATCH operations require an If-Match header with the current ETag. Retrieve the ETag from the GET response header before issuing a PATCH.

  6. CSRF tokens — Like all S/4HANA Cloud OData services, POST/PATCH/DELETE require a valid X-CSRF-Token fetched via a prior HEAD or GET with X-CSRF-Token: Fetch.


Summary

API_STOCKTRANSPORTORDER closes a years-long gap in SAP S/4HANA Cloud Public Edition's integration capabilities. What previously required manual Fiori UI interaction — or workarounds through legacy channels — can now be fully automated:

  • Create and manage UB, NB, and NBIC STOs programmatically
  • Integrate with external planning systems, WMS, and custom applications
  • Automate high-volume intercompany replenishment scenarios

The API is live as of the 2602 release, secured via Communication Scenario SAP_COM_0A80, and built on the modern OData V4 / RAP stack for reliability and forward compatibility.

If you're running SAP S/4HANA Cloud Public Edition and have intercompany or intracompany stock transfer flows that currently require manual processing, this is the API you've been waiting for.


References

The features covered in this article are based on SAP S/4HANA Cloud, Public Edition 2602, please refer to the latest information for changes in subsequent versions.

Hope you LIKE it if it addresses your issue. After that, please feel free to comment after following my account and I will reply ASAP.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *