Orchestrate

Report an issue

Something wrong, out of date or unclear? Tell us. Corrections are prioritized over new topics. You don't need to sign in.

0 / 2000

Don't include personal or confidential company details. Reports are reviewed with AI assistance.

SOAP and OData services in depth: provisioning, delivery guarantees and monitoring

Set up and run SAP's SOAP and OData services well, from the SOAP runtime and Gateway publishing to change sets, ETags, communication arrangements and monitors.

Updated Nov 30, 2026
Foundational layer · 9 min read

The 60-second version

Most of SAP's published APIs are web services: a program sends a request over HTTPS and SAP answers. They come in two families.

  • OData services answer questions about business objects ("show me order 1000004") and change them ("set its delivery block"). They are what SAP Fiori apps, most S/4HANA APIs and most AI agents use. They come in two versions, V2 and V4.
  • SOAP services exchange XML messages. They are older, but SAP still delivers them for many postings, such as journal entries, and they can do something OData can't: asynchronous messages that SAP stores and processes exactly once, and if asked, in order (SAP Help Portal).

Both families have to be switched on before anyone can call them. In S/4HANA Cloud Public Edition you do that with a communication arrangement: which partner system, with which user, may call which bundle of services. In on-premise systems and Private Edition, administrators publish OData services in SAP Gateway and configure SOAP services in the SOA Manager.

The decision for a leader: treat every published service as an interface with an owner, a delivery promise and a monitor. Most incidents with these services are not bugs in SAP. They are a resent message posted twice, two systems overwriting each other's change, or an error log nobody reads.

This topic continues with the course's fictional company, Calder Pumpworks, whose S/4HANA system for CP10 runs in SAP's private cloud.

Why it matters to the business

Web services carry Calder's most visible traffic: distributor orders from the EDI flow, the CRM's availability checks while a salesperson quotes, postings from finance tools. When they go wrong, customers notice first.

What is at stake, using Calder (course values):

  • Duplicates. A treasury tool posts bank charges by asynchronous SOAP. When an acknowledgment is lost, it resends with a new message ID, and SAP posts the charge twice. The accounts look wrong until someone reconciles them.
  • Lost changes. The CRM writes requested delivery dates back to sales orders. If it overwrites the whole order header without checking whether someone changed it in between, it can quietly remove a customer hold that customer service just set. The pumps ship.
  • Half orders. Three distributor orders arrive in one EDI message. If the integration sends them as separate requests, an error on one item leaves an order with half its lines.
  • Silent failures. SAP keeps asynchronous SOAP messages in a monitor for a set time (SAP Learning). If nobody owns that monitor, an error sits there until a supplier calls about a missing payment.

The cost of prevention is small: a few settings per interface, chosen at design time. The cost of a cleanup is a reconciliation, a customer conversation and an audit finding.

How SAP does it

As of 30 November 2026:

  • SAP Business Accelerator Hub lists SAP's published APIs. An SAP Learning lesson counts more than 2,700 of them, in REST, OData V2, OData V4 and SOAP (SAP Learning). The hub is where you check which version and protocol an API has.
  • SAP Gateway runs OData services inside the ABAP platform. For S/4HANA, SAP recommends the embedded deployment, where Gateway runs in the S/4HANA system itself, instead of a separate hub system (SAP Learning).
  • OData V4 is SAP's recommendation "wherever possible" for new transactional services built with the ABAP RESTful application programming model (RAP) (SAP Learning). Many delivered APIs are still V2, and both will be around for years.
  • The SOAP runtime of the ABAP platform sends and receives SOAP messages, keeps asynchronous ones for 40 days by default, and has its own monitors (SAP Learning).
  • Communication management in S/4HANA Cloud Public Edition bundles services into SAP-defined communication scenarios and switches them on per partner with a communication arrangement (SAP Learning). SAP's support knowledge base has an article whose title reports these apps missing in on-premise and private cloud systems (SAP Knowledge Base 3104502): check with SAP what your release offers before planning on them.

Choosing and running a service: a decision guide

Question If yes If no
Does a released SAP API exist for the job? Use it, in the protocol it comes in A custom service is allowed only with an owner and a replacement date
Does the caller need an answer now (a user is waiting)? Synchronous OData or SOAP, with a timeout Asynchronous SOAP or events
Can the same message arrive twice? Asynchronous SOAP with the same message ID on resend, or an OData write designed to be repeated safely Still assume it can
Must several changes succeed or fail together? One OData change set per business object Separate requests are fine
Can two systems change the same object? Send the version you read (an ETag) and handle "changed meanwhile" Document why not
Does the order of messages matter? Asynchronous SOAP "exactly once in order" "Exactly once" is enough
Who reads the error monitor? A named business owner, with an alert The interface isn't ready for production

Questions to ask

  1. Which of our interfaces use SOAP and which use OData, and which of them are SAP's released APIs versus our own?
  2. For every interface that writes data: what happens if the same message arrives twice?
  3. Where can two systems or people change the same order, and does the integration check the version it read?
  4. When a batch of orders arrives together, what happens to the good ones if one is wrong?
  5. Who reads the SOAP message monitor and the Gateway error log, and how fast?
  6. Is our Gateway embedded in S/4HANA as SAP recommends, or a separate hub, and why?
  7. Do production systems log full message contents, which may include personal data, or only what support needs?
  8. For our Public Edition or BTP partners: which communication arrangements exist, who approved each, and which users and certificates do they use?

Common misconceptions

  • "OData replaced SOAP, so SOAP is legacy." SAP still delivers SOAP APIs where asynchronous, exactly-once processing matters, such as journal entry postings (SAP Community).
  • "Asynchronous means reliable, whatever the sender does." SAP's exactly-once promise works per message ID. A sender that gives a resend a new ID has sent a new message.
  • "A batch request is all or nothing." Only the change sets inside it are. And some SAP APIs accept only one business object per change set: SAP's support article for the sales order API says one sales order per change set (SAP Knowledge Base 3163859).
  • "Publishing a service in the developer's tool makes it live." SAP's lesson says local publishing in the development tools is meant for testing only (SAP Learning).
  • "More logging is safer." Full payload logging in production stores business and personal data in a log. SAP lets support raise one user's log level for two hours instead (SAP Help Portal).

Key terms

All course terms, A to Z, in the glossary

  • OData: a web API standard for reading and changing business objects over HTTPS, in versions V2 and V4.
  • SOAP: a web service standard that exchanges XML messages, synchronously or asynchronously.
  • SAP Gateway: the part of the ABAP platform that runs OData services.
  • Embedded deployment: Gateway running inside the S/4HANA system, as SAP recommends for S/4HANA.
  • Service group: the unit in which OData V4 services are published.
  • Change set: a group of changes inside a batch request that succeed or fail together.
  • ETag: a version stamp the server returns with an object; sending it back with a change lets the server refuse the change if the object changed meanwhile.
  • Exactly once in order (EOIO): an asynchronous SOAP quality of service that processes each message once, in the order sent.
  • Logical port: the configuration in the calling system that says where a SOAP service lives.
  • Communication arrangement: in S/4HANA Cloud, the setting that lets one partner system, with one user, call one bundle of services.

Check yourself

Pick one answer for each question. The explanation appears after you choose.

1What is the main reason SAP still delivers SOAP APIs next to OData?

Answer: C. SAP's help page lists exactly once and exactly once in order as qualities of asynchronous SOAP messages. OData calls are synchronous: the caller waits and must handle repeats itself.

2The treasury tool resends a bank charge with a new message ID after a lost acknowledgment. What happens?

Answer: C. The exactly-once promise works per message ID. A resend with a new ID is, for SAP, a new message, so the charge is posted again.

3Distributor orders arrive three at a time. What design keeps one bad item from leaving a half-saved order?

Answer: C. A change set is applied whole or not at all, so a bad item refuses its own order cleanly. SAP's support article for the sales order API allows only one sales order per change set, so putting all three in one fails.

4The CRM writes requested dates back to orders, and customer service sets holds on the same orders. What should you ask the integration team?

Answer: C. Without the version (the ETag) the CRM's later write can overwrite the hold that customer service just set. With it, SAP refuses the stale change and the CRM reads again.

5Which Gateway setup does SAP recommend for an S/4HANA system?

Answer: B. SAP's lesson names the embedded deployment as the recommended setup for S/4HANA. A shared hub is not recommended when several S/4HANA systems on different releases are involved.

6A vendor suggests logging full message contents in production "to be safe". What is the better answer?

Answer: D. Full logs store business and personal data for every user. SAP lets support raise one user's level for two hours, which gives the detail for a fix without keeping everyone's data.

7What does a communication arrangement decide in S/4HANA Cloud Public Edition?

Answer: A. SAP's lesson defines the arrangement as which communication system and which communication user can call which APIs, based on a communication scenario. It doesn't change the service itself.
Deep layer · 40 min read

Mental model

A web service in an SAP landscape is three things that are configured separately and fail separately:

  1. The contract: the service's definition and protocol (an OData service and its version, a SOAP service and its WSDL). SAP delivers it, or you build it.
  2. The switch: what makes it callable in one system for one caller. In on-premise and Private Edition that is Gateway publishing (/IWFND/MAINT_SERVICE, /IWFND/V4_ADMIN) and SOA Manager configuration; in Public Edition it is a communication arrangement.
  3. The delivery promise: what happens to a request that is repeated, reordered or half-applied. For synchronous calls the caller owns it (change sets, ETags, safe retries). For asynchronous SOAP the SAP runtime keeps it, as long as the sender plays its part (stable message IDs, the right quality of service).

Then the same two governance questions as for RFC: who may call what (users, certificates, arrangements) and who watches it (SOAP monitors, the Gateway error log).

How it works

SOAP in the ABAP platform

Synchronous versus asynchronous. SAP's help page sets the difference out plainly (SAP Help Portal):

Synchronous Asynchronous
Pattern Request and response; the caller waits One-way; the caller carries on
Transport guarantee No Yes
Transactional No Yes
Quality of service None Exactly once (EO) or exactly once in order (EOIO)

For asynchronous messages SAP implements Web Services Reliable Messaging (WS-RM). Calls from one logical unit of work are numbered in a sequence, which is how in-order processing works (same page). SAP also has its own non-WS-RM reliable messaging, which its monitor calls Plain SOAP (SAP Learning). Either way, the runtime recognizes a message by its ID. An SAP expert's answer to a refused journal entry posting shows the consequence: an asynchronous call with no message ID and no WS-RM assertion is rejected, and the fix is to send WS-Addressing with a generated message ID (SAP Community).

Setting up the runtime. An SAP Learning lesson walks through it (SAP Learning):

  • Run transaction SRT_ADMIN in client 000 and in each productive client. It creates a service destination, sets up bgRFC (which carries asynchronous messages) and the ICF services under /sap/bc/srt/.
  • Schedule the standard job SAP_SOAP_RUNTIME_MANAGEMENT.
  • If bgRFC hasn't been used before, define its supervisor destination in SBGRFCCONF.
  • Check the result with report SRT_ADMIN_CHECK.
  • Message persistency is set in SRT_UTIL; from NetWeaver 7.4 the default keeps messages 40 days.

Providers and consumers. On the providing side you create a service endpoint and binding for a service definition in transaction SOAMANAGER, then hand out the WSDL URL. An SAP blog shows this for the journal entry APIs that S/4HANA on-premise delivers from release 2020 (SAP Community). On the consuming side, a consumer proxy calls a remote service through a logical port, which holds the endpoint URL and runtime options. SAP's documentation warns that a proxy's default logical port points to the development or test URL it was generated with, and has to be changed to the real endpoint (SAP Help Portal). That page describes the AS Java administration tool; in ABAP you maintain logical ports in SOAMANAGER.

Monitoring. SAP's lesson lists the tools (SAP Learning):

Tool What it shows Notes
SRT_MONI Asynchronous messages and their processing status Only asynchronous messages are persisted, so only they appear; needs S_SRT_MONI or S_XMB_MONI
SRT_MONIS Sequences Soft termination closes a sequence and finishes open messages; hard termination cancels them
SRT_ELOG Errors of synchronous and asynchronous calls The place to look for synchronous failures on the provider
SRT_UTIL Traces, including payload traces A payload trace records for 2 hours and keeps data 2 days by default
Reports SRT_UTIL_RESTART, SRT_UTIL_CANCEL Restart or cancel many messages Cancelled is a final status

S/4HANA Cloud adds business-facing monitoring for some APIs. SAP's guide for the journal entry APIs sends the results of asynchronous postings to the Message Dashboard app and the SAP Application Interface Framework (AIF) monitor (SAP Community).

sequenceDiagram
  participant T as Treasury tool
  participant R as SOAP runtime S4P
  participant J as Journal entry API
  T->>R: message TRY-0002, ID ...-a
  R->>R: store, bgRFC unit
  R->>J: post 12.00
  R--xT: acknowledgment lost
  T->>R: resend, same ID ...-a
  R-->>T: known ID, not posted again

OData in SAP Gateway

Contract. In RAP, a service definition says which CDS entities a service exposes and is protocol-agnostic; a service binding ties it to a protocol. Binding types are OData V2 or V4, each for a UI or as a Web API, plus InA and SQL (SAP Learning). Older services were built in the Gateway Service Builder; you meet both in any S/4HANA system.

Switch: V2. Publishing a V2 binding locally in the development tools registers the service, but SAP's lesson says that is for testing only; to transport it you register it in /IWFND/MAINT_SERVICE (SAP Learning).

Switch: V4. A V4 binding registers a service group in the backend (/IWBEP/V4_ADMIN), and an administrator publishes the group in /IWFND/V4_ADMIN (same lesson). SAP's help page adds the rules that matter for operations (SAP Help Portal):

  • Publishing is "a pure configuration task" that creates no repository objects.
  • Only services in published groups can be called.
  • Each group needs at least one system alias, which routes it to a backend. Services added to a published group later are reachable without more configuration.
  • The same routing configuration manages V2 system aliases. For a co-deployed (embedded) backend the RFC destination stays blank, and the Local GW option calls the provider through a local bypass.

Deployment. SAP describes two hub deployments and the embedded one, and recommends embedded for S/4HANA. A hub is not recommended for several S/4HANA systems on different releases, and an embedded system reached from the internet needs extra security measures (SAP Learning). Calder runs embedded Gateway in S4P, and reaches it from BTP through the Cloud Connector's virtual host s4p-api:443 (BTP connectivity).

Delivery promise. OData calls are synchronous; the caller owns every guarantee:

  • Change sets. A $batch request can hold change sets. The OData 4.0 specification, as quoted in the Apache Olingo tutorial, says a service applies all requests in a change set "or else apply none of them", and read requests can't be inside one (Apache Olingo). The application may narrow this: SAP's support article for API_SALES_ORDER_SRV says the sales order program can't process more than one order at a time, so create or change one sales order per change set (SAP Knowledge Base 3163859).
  • ETags. A read returns a version stamp; a change sends it back in If-Match. If the object changed meanwhile, the service refuses with 412 Precondition Failed. An agent calling a RAP service shows how RAP implements this. If-Match: * switches the check off.
  • CSRF tokens. Changes need a token fetched first, as your first SAP API explains.

Monitoring. The Gateway error log is /IWFND/ERROR_LOG on the hub and /IWBEP/ERROR_LOG in the backend; in an embedded system both sit in one system. Entries are kept 14 days by default. The log level is Secure (messages without variables) or Full. Support can raise one user to Full for 2 hours with /IWFND/TRACES or /IWBEP/TRACES, and only Full entries can be replayed (SAP Help Portal).

flowchart LR
  C[Caller: CRM, flow, agent] -->|HTTPS| GW[Gateway in S4P<br/>embedded]
  GW -->|system alias LOCAL| SB[Service binding<br/>V2 or V4]
  SB --> BO[Business object<br/>sales order]
  GW -. errors .-> EL[Hub error log]
  SB -. backend errors .-> BL[Backend error log]

Communication arrangements in cloud editions

In S/4HANA Cloud Public Edition, the switch is communication management (SAP Learning, SAP Learning):

Object What it is Architect's concern
Communication scenario SAP's bundle of inbound and outbound services and their supported authentication methods, for example SAP_COM_0002 for journal entry posting (SAP Community) You switch on the whole bundle; check what else is in it
Communication system The partner: for inbound, the system that calls you; for outbound, the system you call One per real partner and stage, never shared
Communication user A technical user for inbound calls, with a password or a certificate Prefer certificates; one user per partner
Outbound authentication Held in the communication system, including OAuth 1.0, OAuth 2.0 and OAuth 2.0 mTLS Secrets and certificate expiry belong in the register
Communication arrangement Which system and which user may call which scenario; saving it activates it The approval record for an interface

The model maps onto the SOA Manager and Gateway work of on-premise: arrangement ≈ published service plus endpoint plus user. Customer-defined scenarios exist in the SAP BTP ABAP environment, as the RFC topic showed for outbound calls.

Build it yourself: review Calder's SOAP and OData services

You will run a small lab with two parts. Review checks a register of how Calder uses SOAP and OData services against ten course rules and gives each a verdict. Simulate shows, with stand-in services, why three of the rules exist: change sets, ETags, and message IDs with in-order delivery.

flowchart LR
  I[--init] --> D[register_draft.json]
  I --> V[register_reviewed.json]
  D --> R[review: rules WS01-WS10]
  V --> R
  R --> OUT[verdict per service use:<br/>FIX, KEEP, REPLACE, RETIRE]
  S[simulate batch, etag, soap] --> W[why the rules exist]

Before you start: complete Set up your computer for this course and Set up for Unit 26. This walkthrough needs none of the setup's trials.

What you need

  • Python and your orchestrate-course folder with its .venv, from the setup topic.
  • No account, no network and no extra libraries. The script uses built-in modules only and has no randomness, so your output matches the samples exactly.
  • About 40 minutes. Everything is free.

Step 1: Open the course folder and turn on the virtual environment

  1. Open VS Code, choose File > Open Folder, and open orchestrate-course.

  2. Open a terminal: Terminal > New Terminal.

  3. If the prompt doesn't start with (.venv), turn it on:

    • Windows (PowerShell):

      .venv\Scripts\Activate.ps1
    • macOS / Linux:

      source .venv/bin/activate
  4. Create the unit folder if it doesn't exist yet:

    • Windows (PowerShell):

      New-Item -ItemType Directory -Force unit26
    • macOS / Linux:

      mkdir -p unit26

Step 2: Create the script

  1. In VS Code, create a new file unit26/service_lab.py.
  2. Paste the code below and save.
"""Review SOAP and OData service use and see why the rules exist.

Course lab for Unit 26, "SOAP and OData services in depth". Built-in
modules only, no randomness, no network, no SAP system.

  python unit26/service_lab.py --init             write the sample registers
  python unit26/service_lab.py review             review unit26/services/register_draft.json
  python unit26/service_lab.py review --file unit26/services/register_reviewed.json
  python unit26/service_lab.py simulate batch     $batch with and without change sets
  python unit26/service_lab.py simulate etag      two writers, with and without If-Match
  python unit26/service_lab.py simulate soap      asynchronous SOAP: message IDs and order
  python unit26/service_lab.py --self-test        check the built-in samples

The stand-in "services" below only imitate rules that SAP and the OData
standard document (change sets are all or none, If-Match and 412, the
exactly-once and in-order qualities of asynchronous SOAP). They are not
SAP software. Rule IDs, service names starting with Z, users and values
are course labels for the fictional Calder Pumpworks.
"""

import argparse
import copy
import json
import sys
from pathlib import Path

FOLDER = Path("unit26/services")
AS_OF = "2026-11-30"
ROLLOUT = "2027-07-05"  # CP20 goes live in CP10's S/4HANA (course date)

SYSTEMS = {
    "S4P": {"kind": "S/4HANA Cloud Private Edition 2023 (CP10)", "stage": "prod",
            "gateway": "embedded", "error_log_level": "full"},
    "ECP": {"kind": "ECC 6.0 EhP 8 (CP20)", "stage": "prod",
            "gateway": "none", "error_log_level": "-"},
}

DRAFT = [
    {"id": "S01", "interface": "I10", "name": "Distributor orders create sales orders",
     "consumer": "Cloud Integration flow CPUS_I10_DistributorOrder_Inbound", "target": "S4P",
     "service": "API_SALES_ORDER_SRV", "protocol": "odata-v2", "origin": "released",
     "access": "create", "batch": True, "orders_per_changeset": 25,
     "published_by": "/IWFND/MAINT_SERVICE", "user": "TU_I10_ORDERS", "user_type": "technical",
     "owner": "00100292"},
    {"id": "S02", "interface": "-", "name": "CRM changes requested delivery dates",
     "consumer": "CRM", "target": "S4P", "service": "API_SALES_ORDER_SRV",
     "protocol": "odata-v2", "origin": "released", "access": "update", "if_match": "*",
     "published_by": "/IWFND/MAINT_SERVICE", "user": "TU_CRM_ODATA", "user_type": "technical",
     "owner": "00100296"},
    {"id": "S03", "interface": "I12", "name": "CRM checks availability while quoting",
     "consumer": "CRM", "target": "S4P", "service": "ZCRM_ATP_SRV", "protocol": "odata-v2",
     "origin": "custom", "access": "read", "published_by": "/IWFND/MAINT_SERVICE",
     "user": "TU_CRM_ODATA", "user_type": "technical", "owner": None, "plan": None},
    {"id": "S04", "interface": "E06", "name": "Test bench writes readings per serial",
     "consumer": "Test bench PC (TEST1)", "target": "S4P", "service": "ZAPI_TESTBENCH_O4",
     "protocol": "odata-v4", "origin": "custom-rap", "access": "create",
     "published_by": "adt-local", "user": "00100196", "user_type": "personal",
     "owner": "00100314"},
    {"id": "S05", "interface": "-", "name": "Treasury tool posts bank charges",
     "consumer": "Treasury tool", "target": "S4P",
     "service": "JournalEntryBulkCreationRequest_In", "protocol": "soap-async",
     "origin": "released", "access": "create", "message_id": "new-on-resend", "qos": "EO",
     "order_matters": False, "error_owner": None, "user": "TU_TRY_SOAP",
     "user_type": "technical", "owner": "00100310"},
    {"id": "S06", "interface": "-", "name": "Augsburg sends impeller lot statuses to Rockford",
     "consumer": "ECP consumer proxy", "target": "S4P", "service": "Z_IC_LOTSTATUS_IN",
     "protocol": "soap-async", "origin": "custom", "access": "update",
     "message_id": "kept-on-resend", "qos": "EO", "order_matters": True,
     "logical_port": "https://s4q-api:443/sap/bc/srt/calder/ic_lotstatus",
     "error_owner": "00100292", "user": "TU_IC_SOAP", "user_type": "technical",
     "owner": "00100292", "plan": None},
]


def reviewed_register():
    reg = copy.deepcopy(DRAFT)
    by = {s["id"]: s for s in reg}
    by["S01"].update(orders_per_changeset=1)
    by["S02"].update(if_match="etag-from-read")
    by["S03"].update(owner="00100292",
                     plan={"action": "REPLACE", "by": "2027-06-30",
                           "with": "a released availability API chosen on the Business Accelerator Hub"})
    by["S04"].update(published_by="/IWFND/V4_ADMIN", user="TU_TESTBENCH",
                     user_type="technical")
    by["S05"].update(message_id="kept-on-resend", error_owner="00100310")
    by["S06"].update(qos="EOIO",
                     logical_port="https://s4p-api:443/sap/bc/srt/calder/ic_lotstatus",
                     plan={"action": "RETIRE", "by": ROLLOUT,
                           "with": "intercompany flow inside one S/4HANA system after the rollout"})
    systems = copy.deepcopy(SYSTEMS)
    systems["S4P"]["error_log_level"] = "secure"
    return {"company": "Calder Pumpworks (fictional)", "as_of": AS_OF,
            "systems": systems, "services": reg}


def draft_register():
    return {"company": "Calder Pumpworks (fictional)", "as_of": AS_OF,
            "systems": copy.deepcopy(SYSTEMS), "services": copy.deepcopy(DRAFT)}


# ---------------------------------------------------------------- review

def check(svc, systems):
    """Return a list of (level, rule, text) for one service use."""
    out = []
    target = systems.get(svc["target"], {})
    # WS01 owner
    if svc.get("owner"):
        out.append(("OK", "WS01", f"owner {svc['owner']}"))
    else:
        out.append(("FAIL", "WS01", "no owner"))
    # WS02 who calls
    if svc.get("user_type") == "personal":
        out.append(("FAIL", "WS02", f"runs as personal user {svc['user']}"))
    else:
        out.append(("OK", "WS02", f"technical user {svc['user']}"))
    # WS03 custom services need a plan
    if svc["origin"] == "custom":
        plan = svc.get("plan")
        if plan:
            out.append(("OK", "WS03", f"custom service, plan {plan['action']} by {plan['by']}"))
        else:
            out.append(("FAIL", "WS03", "custom service with no replacement or retirement plan"))
    elif svc["origin"] == "custom-rap":
        out.append(("OK", "WS03", "own RAP service, built on released objects"))
    else:
        out.append(("OK", "WS03", "released SAP API"))
    # WS04 production error log level (system setting, shown per OData service)
    if svc["protocol"].startswith("odata"):
        level = target.get("error_log_level")
        if level == "full":
            out.append(("WARN", "WS04", f"{svc['target']} logs full payloads for every user"))
        else:
            out.append(("OK", "WS04", f"{svc['target']} error log level {level}"))
    # WS05 change sets
    if svc.get("batch"):
        n = svc.get("orders_per_changeset", 1)
        if n > 1 and svc["service"] == "API_SALES_ORDER_SRV":
            out.append(("FAIL", "WS05", f"{n} sales orders in one change set; one per change set"))
        else:
            out.append(("OK", "WS05", "one sales order per change set"))
    # WS06 optimistic locking
    if svc["access"] == "update" and svc["protocol"].startswith("odata"):
        if svc.get("if_match") in (None, "*"):
            out.append(("FAIL", "WS06", f"updates with If-Match: {svc.get('if_match') or 'none'}"))
        else:
            out.append(("OK", "WS06", "sends the ETag it read in If-Match"))
    # WS07 publishing
    if svc["protocol"] == "odata-v2":
        ok = svc["published_by"] == "/IWFND/MAINT_SERVICE"
        out.append(("OK" if ok else "FAIL", "WS07",
                    f"V2 service registered with {svc['published_by']}"))
    elif svc["protocol"] == "odata-v4":
        if svc["published_by"] == "/IWFND/V4_ADMIN":
            out.append(("OK", "WS07", "V4 service group published in /IWFND/V4_ADMIN"))
        else:
            out.append(("FAIL", "WS07", "published locally in ADT (testing only)"))
    # WS08 logical port stage
    port = svc.get("logical_port")
    if port:
        stage_ok = f"//{svc['target'].lower()}-" in port
        out.append(("OK" if stage_ok else "FAIL", "WS08",
                    f"logical port {'matches' if stage_ok else 'does not match'} {svc['target']}: {port}"))
    # WS09 asynchronous SOAP delivery
    if svc["protocol"] == "soap-async":
        if svc.get("message_id") != "kept-on-resend":
            out.append(("FAIL", "WS09", "new message ID on resend: a resend is a new message"))
        elif svc.get("order_matters") and svc.get("qos") != "EOIO":
            out.append(("FAIL", "WS09", "order matters but quality of service is EO"))
        else:
            out.append(("OK", "WS09", f"message ID kept on resend, {svc['qos']}"))
        # WS10 error owner
        if svc.get("error_owner"):
            out.append(("OK", "WS10", f"errors in SRT_MONI owned by {svc['error_owner']}"))
        else:
            out.append(("FAIL", "WS10", "nobody owns errors in SRT_MONI"))
    return out


def verdict(findings, svc):
    if any(level == "FAIL" for level, _, _ in findings):
        return "FIX"
    plan = svc.get("plan")
    if plan and plan["action"] in ("REPLACE", "RETIRE"):
        return plan["action"]
    return "KEEP"


def review(reg):
    lines = [f"{reg['company']}: SOAP and OData register as of {reg['as_of']}"]
    for sid, s in reg["systems"].items():
        lines.append(f"  system {sid}: {s['kind']}, Gateway {s['gateway']}, "
                     f"error log level {s['error_log_level']}")
    counts = {"OK": 0, "WARN": 0, "FAIL": 0}
    verdicts = {}
    for svc in reg["services"]:
        findings = check(svc, reg["systems"])
        lines.append("")
        lines.append(f"{svc['id']} {svc['name']}")
        lines.append(f"    {svc['consumer']} -> {svc['target']}, {svc['service']}, {svc['protocol']}")
        for level, rule, text in findings:
            counts[level] += 1
            lines.append(f"  {level:<4} {rule} {text}")
        v = verdict(findings, svc)
        verdicts[svc["id"]] = v
        lines.append(f"    verdict {v}")
    lines.append("")
    lines.append(f"{counts['OK']} OK, {counts['WARN']} WARN, {counts['FAIL']} FAIL "
                 f"across {len(reg['services'])} services")
    return lines, counts, verdicts


# ---------------------------------------------------------------- stand-ins

class SalesOrderStandIn:
    """Imitates a sales order service: one order per change set, all or none."""

    def __init__(self):
        self.orders = {}
        self.next_no = 1000801

    def _check_item(self, item):
        if item["qty"] <= 0:
            return f"item {item['item']}: quantity must be positive"
        return None

    def create_header(self, po):
        no = str(self.next_no)
        self.next_no += 1
        self.orders[no] = {"po": po, "items": []}
        return no

    def add_item(self, no, item):
        err = self._check_item(item)
        if err:
            return err
        self.orders[no]["items"].append(item)
        return None

    def changeset(self, orders):
        """Apply a change set: every request or none of them."""
        if len(orders) > 1:
            return [], "change set refused: one sales order per change set"
        snapshot = (copy.deepcopy(self.orders), self.next_no)
        created = []
        for order in orders:
            no = self.create_header(order["po"])
            created.append(no)
            for item in order["items"]:
                err = self.add_item(no, item)
                if err:
                    self.orders, self.next_no = snapshot
                    return [], f"change set rolled back: {err}"
        return created, None


INTERCHANGE = [
    {"po": "HFS-PO-8240", "items": [{"item": 10, "product": "CP-SK200", "qty": 40}]},
    {"po": "HFS-PO-8241", "items": [{"item": 10, "product": "CP-ES200", "qty": 2},
                                     {"item": 20, "product": "CP-SK200", "qty": 0}]},
    {"po": "HFS-PO-8242", "items": [{"item": 10, "product": "CP-ES200", "qty": 4}]},
]


def describe(svc_obj):
    rows = []
    for no, o in svc_obj.orders.items():
        items = ", ".join(f"{i['qty']} {i['product']}" for i in o["items"]) or "no items"
        rows.append(f"    {no} {o['po']}: {items}")
    return rows or ["    (no sales orders)"]


def simulate_batch():
    out = ["Hallam's interchange HFS000452 brings 3 orders into flow I10.",
           "HFS-PO-8241 item 20 has quantity 0, which the order refuses.", ""]
    # layout 1: separate requests, no change set
    s = SalesOrderStandIn()
    for order in INTERCHANGE:
        no = s.create_header(order["po"])
        for item in order["items"]:
            s.add_item(no, item)
    half = [no for no, o in s.orders.items() if len(o["items"]) < 2 and o["po"] == "HFS-PO-8241"]
    out.append("1. Separate requests, no change set:")
    out += describe(s)
    out.append(f"    half-saved orders: {len(half)}")
    # layout 2: all orders in one change set
    s = SalesOrderStandIn()
    created, err = s.changeset(INTERCHANGE)
    out.append("2. All 3 orders in one change set:")
    out.append(f"    {err}")
    out += describe(s)
    # layout 3: one change set per order
    s = SalesOrderStandIn()
    out.append("3. One change set per order:")
    errors = []
    for order in INTERCHANGE:
        created, err = s.changeset([order])
        if err:
            errors.append(f"{order['po']}: {err}")
    out += describe(s)
    for e in errors:
        out.append(f"    {e}")
    out.append(f"    half-saved orders: 0, saved {len(s.orders)}, refused whole {len(errors)}")
    return out, len(s.orders), len(errors)


class EtagOrder:
    """Imitates optimistic locking on one sales order header."""

    def __init__(self):
        self.data = {"order": "1000004", "requested_date": "2026-11-06", "delivery_block": ""}
        self.version = 1

    def etag(self):
        return f'W/"v{self.version}"'

    def read(self):
        return dict(self.data), self.etag()

    def patch(self, fields, if_match):
        if if_match not in ("*", None) and if_match != self.etag():
            return 412
        self.data.update(fields)
        self.version += 1
        return 204


def simulate_etag(use_etag):
    o = EtagOrder()
    log = ["Order 1000004 (fictional): the CRM and customer service both change its header."]
    crm_copy, crm_tag = o.read()
    log.append(f"09:00 CRM reads the order, ETag {crm_tag}")
    o.patch({"delivery_block": "HC"}, o.etag())
    log.append(f"09:02 customer service sets delivery block HC (customer hold), ETag now {o.etag()}")
    crm_copy["requested_date"] = "2026-11-13"
    sent = {"requested_date": crm_copy["requested_date"],
            "delivery_block": crm_copy["delivery_block"]}
    header = crm_tag if use_etag else "*"
    status = o.patch(sent, header)
    log.append(f"09:05 CRM sends its copy with If-Match: {header} -> HTTP {status}")
    if status == 412:
        fresh, tag = o.read()
        fresh["requested_date"] = "2026-11-13"
        status = o.patch({"requested_date": fresh["requested_date"],
                          "delivery_block": fresh["delivery_block"]}, tag)
        log.append(f"09:05 CRM reads again ({tag}) and resends -> HTTP {status}")
    log.append(f"result: requested date {o.data['requested_date']}, "
               f"delivery block '{o.data['delivery_block'] or 'none'}'")
    return log, o.data


class SoapInbox:
    """Imitates an asynchronous SOAP provider with exactly-once by message ID."""

    def __init__(self, in_order):
        self.seen = set()
        self.posted = []
        self.in_order = in_order
        self.status = None
        self.waiting = {}
        self.next_seq = 1

    def receive(self, msg):
        if msg["id"] in self.seen:
            return "duplicate ignored"
        self.seen.add(msg["id"])
        if "amount" in msg:
            self.posted.append(msg)
            return "posted"
        if not self.in_order:
            self.status = msg["status"]
            return "applied"
        self.waiting[msg["seq"]] = msg
        while self.next_seq in self.waiting:
            self.status = self.waiting.pop(self.next_seq)["status"]
            self.next_seq += 1
        return "applied in order" if msg["seq"] < self.next_seq else "held for sequence"


CHARGES = [("TRY-0001", "35.00"), ("TRY-0002", "12.00"), ("TRY-0003", "48.50")]


def simulate_soap():
    out = ["Part 1: the treasury tool posts 3 bank charges to G/L 740000 (course values).",
           "The acknowledgment for the second message is lost; the tool resends it.", ""]
    totals = {}
    for mode in ("new-on-resend", "kept-on-resend"):
        inbox = SoapInbox(in_order=False)
        for ref, amount in CHARGES:
            msg_id = f"{ref}-a"
            inbox.receive({"id": msg_id, "ref": ref, "amount": amount})
            if ref == "TRY-0002":
                resend_id = f"{ref}-b" if mode == "new-on-resend" else msg_id
                result = inbox.receive({"id": resend_id, "ref": ref, "amount": amount})
                out.append(f"  {mode}: resend of {ref} as {resend_id} -> {result}")
        total = sum(float(m["amount"]) for m in inbox.posted)
        totals[mode] = total
        out.append(f"  {mode}: {len(inbox.posted)} journal entries, {total:.2f} posted")
    out += ["", "Part 2: Augsburg sends 3 statuses for the impeller lot on PO 4500000008;",
            "the network delivers them as 1, 3, 2.", ""]
    finals = {}
    arrival = [(1, "RELEASED"), (3, "SHIPPED"), (2, "MACHINED")]
    for qos in ("EO", "EOIO"):
        inbox = SoapInbox(in_order=(qos == "EOIO"))
        for seq, status in arrival:
            inbox.receive({"id": f"LOT-4500000008-{seq}", "seq": seq, "status": status})
        finals[qos] = inbox.status
        out.append(f"  {qos}: final status {inbox.status}")
    return out, totals, finals


# ---------------------------------------------------------------- commands

def write_samples():
    FOLDER.mkdir(parents=True, exist_ok=True)
    for name, reg in (("register_draft.json", draft_register()),
                      ("register_reviewed.json", reviewed_register())):
        path = FOLDER / name
        path.write_text(json.dumps(reg, indent=2) + "\n", encoding="utf-8")
        print(f"wrote {path.as_posix()}")


def load(path):
    p = Path(path)
    if not p.exists():
        print(f"{p.as_posix()} not found: run  python unit26/service_lab.py --init  first")
        sys.exit(1)
    return json.loads(p.read_text(encoding="utf-8"))


def self_test():
    checks = []
    _, c, v = review(draft_register())
    checks.append(("draft has failures", c["FAIL"] > 0))
    checks.append(("every draft service needs a fix", set(v.values()) == {"FIX"}))
    _, c2, v2 = review(reviewed_register())
    checks.append(("reviewed has no failures", c2["FAIL"] == 0))
    checks.append(("reviewed has no warnings", c2["WARN"] == 0))
    checks.append(("S03 is replaced", v2["S03"] == "REPLACE"))
    checks.append(("S06 is retired", v2["S06"] == "RETIRE"))
    checks.append(("S01 is kept", v2["S01"] == "KEEP"))
    _, saved, refused = simulate_batch()
    checks.append(("batch saves 2 whole orders", saved == 2))
    checks.append(("batch refuses 1 order whole", refused == 1))
    _, lost = simulate_etag(use_etag=False)
    checks.append(("without ETag the block is lost", lost["delivery_block"] == ""))
    _, kept = simulate_etag(use_etag=True)
    checks.append(("with ETag both changes stay",
                   kept["delivery_block"] == "HC" and kept["requested_date"] == "2026-11-13"))
    _, totals, finals = simulate_soap()
    checks.append(("new message ID posts twice", abs(totals["new-on-resend"] - 107.50) < 0.001))
    checks.append(("kept message ID posts once", abs(totals["kept-on-resend"] - 95.50) < 0.001))
    checks.append(("EOIO ends SHIPPED", finals["EOIO"] == "SHIPPED" and finals["EO"] == "MACHINED"))
    for name, ok in checks:
        print(f"{'ok  ' if ok else 'FAIL'} {name}")
    passed = sum(ok for _, ok in checks)
    print(f"{passed} of {len(checks)} self-test checks passed")
    return 0 if passed == len(checks) else 1


def main():
    parser = argparse.ArgumentParser(description="SOAP and OData service lab (course stand-in)")
    parser.add_argument("--init", action="store_true", help="write the sample registers")
    parser.add_argument("--self-test", action="store_true", help="check the built-in samples")
    parser.add_argument("command", nargs="?", choices=["review", "simulate"])
    parser.add_argument("what", nargs="?", choices=["batch", "etag", "soap"])
    parser.add_argument("--file", default=str(FOLDER / "register_draft.json"))
    args = parser.parse_args()

    if args.init:
        write_samples()
        return 0
    if args.self_test:
        return self_test()
    if args.command == "review":
        lines, counts, _ = review(load(args.file))
        print("\n".join(lines))
        return 2 if counts["FAIL"] else 0
    if args.command == "simulate":
        if args.what == "batch":
            print("\n".join(simulate_batch()[0]))
        elif args.what == "etag":
            for flag, title in ((False, "Without ETag (If-Match: *)"), (True, "With ETag")):
                print(f"{title}:")
                print("\n".join("  " + line for line in simulate_etag(flag)[0]))
                print()
        elif args.what == "soap":
            print("\n".join(simulate_soap()[0]))
        else:
            parser.error("simulate needs one of: batch, etag, soap")
        return 0
    parser.print_help()
    return 0


if __name__ == "__main__":
    sys.exit(main())

Step 3: Write the sample files and check them

  1. Run:

    python unit26/service_lab.py --init

    You see:

    wrote unit26/services/register_draft.json
    wrote unit26/services/register_reviewed.json

    --init writes fresh copies each time, so run it again only when you want the samples back.

  2. Run the self-test:

    python unit26/service_lab.py --self-test

    The last line reads 14 of 14 self-test checks passed.

  3. Open unit26/services/register_draft.json. It holds two systems (S4P, Calder's S/4HANA for CP10 with embedded Gateway, and ECP, the ECC system of CP20) and six service uses. Each says who calls which service, in which protocol, as which user, and the facts the rules need.

Step 4: Review the partner's draft register

  1. Run:

    python unit26/service_lab.py review
  2. The output starts like this:

    Calder Pumpworks (fictional): SOAP and OData register as of 2026-11-30
      system S4P: S/4HANA Cloud Private Edition 2023 (CP10), Gateway embedded, error log level full
      system ECP: ECC 6.0 EhP 8 (CP20), Gateway none, error log level -
    
    S01 Distributor orders create sales orders
        Cloud Integration flow CPUS_I10_DistributorOrder_Inbound -> S4P, API_SALES_ORDER_SRV, odata-v2
      OK   WS01 owner 00100292
      OK   WS02 technical user TU_I10_ORDERS
      OK   WS03 released SAP API
      WARN WS04 S4P logs full payloads for every user
      FAIL WS05 25 sales orders in one change set; one per change set
      OK   WS07 V2 service registered with /IWFND/MAINT_SERVICE
        verdict FIX
    
  3. The last line reads:

    18 OK, 4 WARN, 11 FAIL across 6 services

    Every service use gets the verdict FIX, and the exit code is 2.

The rules:

Rule Checks Source
WS01 Every service use has an owner Course rule
WS02 Calls run as a technical user, not a person Course rule; communication users are technical users in SAP's model
WS03 Released SAP API, your own RAP service, or a custom service with a replacement or retirement plan Course rule, after SAP's preference for released APIs
WS04 Production Gateway logs at Secure, raising single users when needed (a warning) SAP's error log levels
WS05 One sales order per change set SAP Knowledge Base 3163859
WS06 Updates send the ETag they read in If-Match, not * OData concurrency control
WS07 V2 registered in /IWFND/MAINT_SERVICE, V4 groups published in /IWFND/V4_ADMIN, not local publishing SAP's publishing guidance
WS08 A SOAP consumer's logical port points to the target system's stage SAP's logical port warning; the host check is a course rule
WS09 Asynchronous SOAP keeps the message ID on resend, and uses EOIO when order matters SAP's qualities of service
WS10 Someone owns asynchronous errors in SRT_MONI Course rule

Read the findings that matter most:

  • S01 fails WS05: the EDI flow sends 25 distributor orders in one change set, which the sales order API refuses.
  • S02 fails WS06: the CRM updates orders with If-Match: *, so it never notices a newer change.
  • S05 and S06 fail WS09: the treasury tool gives resends a new message ID, and Augsburg's status messages use EO although their order matters. S06 also still points at the quality system s4q-api.

Step 5: See why WS05 exists

  1. Run:

    python unit26/service_lab.py simulate batch
  2. You see:

    Hallam's interchange HFS000452 brings 3 orders into flow I10.
    HFS-PO-8241 item 20 has quantity 0, which the order refuses.
    
    1. Separate requests, no change set:
        1000801 HFS-PO-8240: 40 CP-SK200
        1000802 HFS-PO-8241: 2 CP-ES200
        1000803 HFS-PO-8242: 4 CP-ES200
        half-saved orders: 1
    2. All 3 orders in one change set:
        change set refused: one sales order per change set
        (no sales orders)
    3. One change set per order:
        1000801 HFS-PO-8240: 40 CP-SK200
        1000802 HFS-PO-8242: 4 CP-ES200
        HFS-PO-8241: change set rolled back: item 20: quantity must be positive
        half-saved orders: 0, saved 2, refused whole 1
  3. Read it: without change sets, HFS-PO-8241 was saved with one of its two items, and nobody was told the order is incomplete. With all orders in one change set, the stand-in refuses everything, as SAP's article says the real API does. With one change set per order, the two good orders are saved and the bad one is refused whole, ready to be fixed and resent.

Step 6: See why WS06 exists

  1. Run:

    python unit26/service_lab.py simulate etag
  2. You see:

    Without ETag (If-Match: *):
      Order 1000004 (fictional): the CRM and customer service both change its header.
      09:00 CRM reads the order, ETag W/"v1"
      09:02 customer service sets delivery block HC (customer hold), ETag now W/"v2"
      09:05 CRM sends its copy with If-Match: * -> HTTP 204
      result: requested date 2026-11-13, delivery block 'none'
    
    With ETag:
      Order 1000004 (fictional): the CRM and customer service both change its header.
      09:00 CRM reads the order, ETag W/"v1"
      09:02 customer service sets delivery block HC (customer hold), ETag now W/"v2"
      09:05 CRM sends its copy with If-Match: W/"v1" -> HTTP 412
      09:05 CRM reads again (W/"v2") and resends -> HTTP 204
      result: requested date 2026-11-13, delivery block 'HC'
  3. Read it: with If-Match: * the CRM's copy, read before the hold was set, overwrote the hold. With the ETag, the stand-in answered 412, the CRM read the current version and changed only what it meant to change.

Step 7: See why WS09 exists

  1. Run:

    python unit26/service_lab.py simulate soap
  2. You see:

    Part 1: the treasury tool posts 3 bank charges to G/L 740000 (course values).
    The acknowledgment for the second message is lost; the tool resends it.
    
      new-on-resend: resend of TRY-0002 as TRY-0002-b -> posted
      new-on-resend: 4 journal entries, 107.50 posted
      kept-on-resend: resend of TRY-0002 as TRY-0002-a -> duplicate ignored
      kept-on-resend: 3 journal entries, 95.50 posted
    
    Part 2: Augsburg sends 3 statuses for the impeller lot on PO 4500000008;
    the network delivers them as 1, 3, 2.
    
      EO: final status MACHINED
      EOIO: final status SHIPPED
  3. Read it: the runtime ignores a message ID it has seen, so a resend with the same ID is harmless and one with a new ID posts again (107.50 instead of 95.50). With EO, statuses are applied as they arrive and the lot ends at MACHINED, an older status. With EOIO, the stand-in holds status 3 until status 2 arrives, as a sequence does.

Step 8: Review the corrected register

  1. Run:

    python unit26/service_lab.py review --file unit26/services/register_reviewed.json
  2. The last line reads:

    33 OK, 0 WARN, 0 FAIL across 6 services

    The exit code is 0. S01, S02, S04 and S05 read verdict KEEP, S03 reads REPLACE (the CRM's availability service by 30 June 2027) and S06 reads RETIRE (Augsburg's interface ends at the July 2027 rollout).

  3. Compare the two files in VS Code (right-click one, Select for Compare, then Compare with Selected on the other) to see every change the review asked for.

Step 9 (sketch): Read a real system's services

  1. In /IWFND/MAINT_SERVICE, list the active V2 services with their system aliases; in /IWFND/V4_ADMIN, list the published V4 service groups.
  2. In SOAMANAGER, list service endpoints and logical ports, with their URLs and users.
  3. In SRT_MONI and /IWFND/ERROR_LOG, note which services leave errors; those are the first to review.
  4. In S/4HANA Cloud Public Edition, open the Communication Arrangements app instead and list each arrangement with its system and user.
  5. Add one register entry per use and run the review.

Step 10: Save your work

git add unit26/service_lab.py unit26/services
git commit -m "Unit 26: SOAP and OData register review for Calder"

How the code works

Part What it does
DRAFT, reviewed_register() The partner's register and the corrected one, as Python data written to JSON by --init
check() Applies WS01 to WS10 to one service use; rules apply only where they fit the protocol
verdict() FIX if anything fails, otherwise the plan's action (REPLACE, RETIRE) or KEEP
SalesOrderStandIn Saves orders, refuses an item with quantity 0, and applies a change set whole or not at all, one order per set
EtagOrder One order header with a version number; a change with an old ETag gets 412
SoapInbox Remembers message IDs, ignores repeats, and in EOIO mode holds messages until the sequence is complete
self_test() Fourteen checks on the built-in samples, so you can tell a broken copy from an edited file

If something goes wrong

What you see What it means What to do
python is not recognized, or command not found Python isn't installed, or the terminal can't find it Repeat the Python step of Set up your computer and open a new terminal; on macOS/Linux use python3 until .venv is active
No module named ... A different script was pasted, or an import was added The script needs built-in modules only; paste it again from Step 2
register_draft.json not found Step 3 hasn't run, or you are in another folder Run python unit26/service_lab.py --init from orchestrate-course
json.decoder.JSONDecodeError A comma or bracket is missing after an edit VS Code marks the line; fix it and run again
KeyError: 'origin' or another field A new entry is missing a field Copy an existing entry and change its values
Your counts differ from the samples The files were edited Run --self-test, then --init to restore the samples
A company proxy blocks downloads Not used here The lab needs no network

The SAP way

What SAP provides, as of 30 November 2026:

  • Published APIs on the SAP Business Accelerator Hub, in OData V2, OData V4, REST and SOAP (SAP Learning). Your first SAP API shows how to read one.
  • SAP Gateway in every S/4HANA system, with /IWFND/MAINT_SERVICE for V2, /IWFND/V4_ADMIN for V4 service groups, and the error logs and traces above (SAP Help Portal, SAP Help Portal).
  • RAP service bindings for your own services, with OData V4 recommended where possible (SAP Learning). ABAP Cloud and RAP for AI builds one.
  • The SOAP runtime with SOAMANAGER, SRT_ADMIN, SRT_MONI, SRT_MONIS, SRT_ELOG and SRT_UTIL (SAP Learning).
  • Communication management in S/4HANA Cloud Public Edition and the SAP BTP ABAP environment (SAP Learning).
  • In front of the services, SAP Integration Suite: API Management for products, keys and quotas, and Cloud Integration for flows that call them.
  • Licensing note. Gateway, the SOAP runtime and communication management are part of the ABAP platform and S/4HANA. What callers may do with the APIs is governed by your contract and SAP's API policy (SAP API policy page). Integration Suite is a BTP service with its own terms.

Build vs. SAP

Need SAP Your own Use which
A service for a standard object Released OData or SOAP API A custom Gateway service SAP's; custom only where no API exists, with a plan
A service for your own object RAP service binding, OData V4 Gateway Service Builder project RAP for new work
Exactly-once delivery of postings Asynchronous SOAP with EO or EOIO Duplicate checks in your OData service SAP's runtime where the API is SOAP; for OData, design writes to be safe to repeat
All-or-nothing changes OData change sets Compensation logic in the caller Change sets, within the limits each API states
Concurrency ETags and If-Match Locks held by the caller ETags; never hold locks across a user's think time
Switching services on per partner Communication arrangements (cloud), Gateway and SOA Manager (on-premise) Firewall rules only SAP's switches; the network is a second layer
A register of service uses Gateway catalog, SOA Manager, arrangements A register with owner, promise and plan Yours, filled from SAP's data

Architecture view

Where it sits. OData and SOAP services run in the S/4HANA system's ABAP platform. Callers reach them directly, through the Cloud Connector from BTP, or through Integration Suite.

flowchart LR
  CRM[CRM] -- OData V2 --> APIM[API Management]
  APIM --> S4P[S4P CP10<br/>embedded Gateway<br/>SOAP runtime]
  CI[Cloud Integration<br/>flow I10] -- OData $batch --> S4P
  BENCH[Test bench PC] -- OData V4 --> S4P
  TRY[Treasury tool] -- async SOAP EO --> S4P
  ECP[ECP CP20<br/>consumer proxy] -- async SOAP EOIO --> S4P

Non-functional requirements.

Requirement Typical target What breaks if missed
Delivery guarantee Exactly once for postings; safe repeats for OData writes Duplicate journal entries or orders
Atomicity One business object per change set, whole or nothing Orders with missing lines
Concurrency Every update carries the ETag it read Holds, blocks and dates silently overwritten
Latency Synchronous calls inside the caller's timeout (the CRM's 2 s) Users wait; callers retry and duplicate
Backlog visibility Asynchronous errors seen in SRT_MONI within minutes, with an owner Messages wait until a partner complains
Data in logs Secure by default; Full for one user, for hours Personal data kept in logs beyond need

Integration and identity. Each caller gets its own technical user or communication user, ideally with a certificate. Through the Cloud Connector, BTP apps can pass the business user's identity instead (BTP connectivity); a technical user loses it, so the service checks only the technical user's roles. Keep those as narrow as the interface. API Management adds keys and quotas per consumer in front of the same services.

The decision to record (short ADR form from the design-doc topic):

  • Context. Flow I10 sends a distributor's whole EDI interchange to API_SALES_ORDER_SRV in one change set. SAP's support article says the API accepts one sales order per change set, and interchanges hold up to 25 orders (course value).
  • Options. A: one $batch per interchange, with one change set per order. B: one HTTP request per order, without $batch. C: switch to a SOAP sales order service, if one fits, for asynchronous delivery.
  • Decision. A: one round trip per interchange, each order whole or refused, and the flow's error routes already handle one refused order.
  • Consequences. The flow reads each change set's response and routes refused orders to customer service. A retried interchange must not create the saved orders again; the flow's business key (sold-to plus customer PO) checks that. C stays open for a later review.

What a design review will ask.

  1. Which services write data, and what stops a duplicate when a reply is lost?
  2. Where can two writers change the same object, and does each send an ETag?
  3. Is each OData service published the transportable way, and on which system alias?
  4. Who owns SRT_MONI and the Gateway error log for each interface, and what is the alert?
  5. Which custom services have a replacement date, and which disappear with ECC?

Production concerns

  • Security and authorizations. One technical user per caller, with roles limited to the services it calls. Certificates over passwords; track their expiry. An embedded Gateway reached from the internet needs extra protection, as SAP's lesson warns; put API Management or another gateway in front.
  • Evaluation. Test every interface for a lost reply, a resend, a concurrent change and one bad item in a batch. The lab's three simulations are the test cases to write for the real system.
  • Cost. Most fixes are configuration or small code changes in the caller. Replacing custom services with released APIs takes analysis on both sides; budget it per service.
  • Operations. Synchronous errors appear only in SRT_ELOG, the Gateway logs and the caller's own log, so the caller must log with a correlation ID. Asynchronous errors wait in SRT_MONI until someone restarts or cancels them; the run book says who may cancel.
  • Clean core. Released APIs and your own RAP services built on released objects are the target. Custom Gateway services that read SAP tables are the ones to replace first. Integration platform and clean core rates Calder's interfaces.
  • Data protection. Payload traces and Full logs hold business and personal data. Keep the defaults short and the access narrow.

Where AI fits

AI changes three things here, as of November 2026:

  • Agents call these services. Most agent tools for SAP are OData services, often behind an MCP server: generating MCP servers from OData APIs and the MCP gateway topic show how. Everything in this topic applies to them: an agent that retries a write needs a safe repeat, and one that updates an order needs the ETag. SAP's API policy restricts AI systems that plan sequences of API calls to SAP-endorsed architectures (API policy page).
  • Reading contracts. A model can summarize a large $metadata document or WSDL and draft a register entry. Treat that as a draft; the rules and tests decide.
  • Triage. Error logs and SRT_MONI entries are text a model can group and explain for a support analyst. Keep the decision to restart or cancel a message with a person.

Pitfalls

  • New message IDs on resend. A resend must be the same message.
  • EO where order matters. Status updates that overwrite each other need EOIO.
  • Many business objects in one change set. Check what the API allows; the sales order API allows one.
  • If-Match: *. It turns off the protection ETags exist for.
  • Local publishing in production. Publish through Gateway administration so it travels with transports.
  • Default logical ports. They point to wherever the proxy was generated. Check every port per stage.
  • Full logging left on. Raise one user for hours, not everyone for months.
  • Unowned monitors. An error queue without an owner is a slow outage.
  • Hubs for several S/4HANA systems. SAP doesn't recommend one across releases.

Exercise

The service manager's field service app updates warranty end dates on customer pumps through a custom OData service. Add it to the register and fix it.

  1. Open unit26/services/register_reviewed.json and add a seventh entry at the end of the services list (put a comma after the closing brace of S06):

    {"id": "S07", "interface": "-", "name": "Field service app updates warranty end dates",
     "consumer": "Field service app", "target": "S4P", "service": "ZPM_WARRANTY_SRV",
     "protocol": "odata-v2", "origin": "custom", "access": "update", "if_match": "*",
     "published_by": "/IWFND/MAINT_SERVICE", "user": "TU_FSM_ODATA", "user_type": "technical",
     "owner": "00100315", "plan": null}
  2. Run python unit26/service_lab.py review --file unit26/services/register_reviewed.json. S07 shows FAIL WS03 and FAIL WS06, and the last line reads 37 OK, 0 WARN, 2 FAIL across 7 services.

  3. Change S07: set "if_match": "etag-from-read" and replace "plan": null with:

    "plan": {"action": "REPLACE", "by": "2027-06-30", "with": "a RAP service on released objects"}
  4. Run the review again. S07 reads verdict REPLACE and the last line reads 39 OK, 0 WARN, 0 FAIL across 7 services.

  5. Write a short decision record in unit26/services/decision_s07.md with the four ADR headings: why the ETag matters for warranty dates, and why the service is replaced rather than kept.

Done when: the review prints 39 OK, 0 WARN, 0 FAIL across 7 services and decision_s07.md records the decision. The register feeds the interface monitoring and error handling topic.

Going further

For readers who want the standards behind the guarantees and the edge cases.

  • Change sets in the standard. The OData 4.0 rules quoted in the Apache Olingo tutorial add that requests in a change set are unordered, which is why reads are not allowed inside one, and that each response carries a Content-ID so the client can match it to its request. A caller that ignores the per-request results inside a batch response misses refusals.
  • Sequences as a dependency. EOIO holds every later message of a sequence behind a failed one. SAP's sequence monitor offers soft and hard termination (SAP Learning); a run book should say when each is allowed and who checks the business data afterwards. Keep sequences per business object, as with bgRFC queues in the RFC topic.
  • The underlying transport. Asynchronous SOAP rides on bgRFC, which SRT_ADMIN sets up (SAP Learning). A stuck bgRFC supervisor or a missing standard job looks, from the outside, like a SOAP problem.
  • Message ID mechanics. The SAP expert's answer on the refused journal entry posting (SAP Community) shows that the runtime expects either WS-Addressing with a message ID or a WS-RM assertion. Test clients that don't set either can't reach the asynchronous API at all.

Check yourself

Pick one answer for each question. The explanation appears after you choose.

1Which statement matches SAP's description of asynchronous SOAP?

Answer: D. SAP's help page lists asynchronous messages as one-way, with a transport guarantee, transactional, and with the qualities exactly once and exactly once in order. Synchronous calls have none of these, and ordering relies on sequences.

2The treasury tool's resend of TRY-0002 got a new message ID. In the lab, what is posted?

Answer: C. The stand-in, like SAP's runtime, recognizes repeats by message ID. A new ID is a new message, so 12.00 is posted twice and the total rises from 95.50 to 107.50.

3Why does WS05 require one sales order per change set for API_SALES_ORDER_SRV?

Answer: C. SAP's knowledge base article for this API says two orders in one change set fail, as the sales order program can't process more than one at once. The OData standard itself allows several changes per set, applied all or none.

4The CRM sends If-Match with the ETag it read at 09:00, but customer service changed the order at 09:02. What happens in the lab?

Answer: D. An outdated ETag gets 412 Precondition Failed with no change. The CRM reads the current version, applies its date to it and resends, so the hold stays.

5A developer published a new OData V4 Web API locally in the development tools, and the test bench uses it. What does WS07 ask for?

Answer: A. SAP's lesson says local publishing is for testing only; V4 bindings register a service group that an administrator publishes in /IWFND/V4_ADMIN. Each group needs at least one system alias, and only published groups can be called.

6In production, a support analyst needs full request data for one failing user's calls. What fits SAP's error log design?

Answer: B. SAP's error log has Secure and Full levels, and /IWFND/TRACES or /IWBEP/TRACES raise one user to Full for 2 hours. Only Full entries can be replayed, so this gives the analyst what they need without logging everyone.

7Augsburg's consumer proxy still points to https://s4q-api. Why is this a common slip?

Answer: B. SAP's documentation says the default logical port points to the development or test URL the proxy was generated with and must be changed. WS08 checks each port against the target stage.

8Which Gateway deployment does SAP recommend for Calder's S4P, and what does it need when exposed?

Answer: B. SAP's lesson recommends the embedded deployment for S/4HANA and warns that an embedded system reached from the internet needs additional security. Calder puts API Management in front of it.
NextFile and batch interfaces done properly: transfer, completeness, duplicates, restart and reconciliationDesign file interfaces that never load half a file or a file twice, restart cleanly, reconcile nightly, and come with a specification an owner can sign.

Sources

Sign in to track your progress

We'll email you a one-time sign-in link. No password needed.

or

Tell us a little about you

Optional, every field. It helps us pitch answers to your questions at the right level and decide which topics to write next. It is never shown publicly, and you can change or clear it anytime from the account menu.

SAP areas you work in