# Using the SAP Business Accelerator Hub: finding, reading and judging SAP's published APIs

> Find SAP's published APIs, events and CDS views on the Business Accelerator Hub, read their state and spec, and judge whether one fits before you build.

- Course: Orchestrate, Unit 26 · Integration in depth
- Page: https://erpfde.com/topics/sap-business-accelerator-hub/
- Updated: 2026-11-30
- Reading time: Foundational 8 min, Deep 35 min

Independent learning resource. Not affiliated with, sponsored by or endorsed by SAP SE. SAP and other SAP products mentioned are trademarks of SAP SE in Germany and other countries.

## Foundational layer

### The 60-second version

Every integration, extension and agent that touches SAP starts with one choice: **which door into the system does it use?** SAP publishes its doors in one public catalogue, the **SAP Business Accelerator Hub** (formerly the SAP API Business Hub). It lists APIs, business events, CDS views, prebuilt integration content and more, for S/4HANA and most other SAP products.

The hub is free to browse, and you can try many APIs on SAP's sandbox with no company system at all. But a listing is not a recommendation. Before anyone builds, an architect checks three things on the page:

1. **Is it published?** SAP's API policy counts an API as published when it is on the hub or in the product's documentation. Anything else, such as a custom function reading SAP tables, can change without notice.
2. **Will it live as long as our interface?** Each API has a state. A deprecated API still works but has a named successor and an end date coming.
3. **Does it fit?** The specification shows the exact fields and operations. A field you need may sit on another entity, or be read-only.

Getting these right takes an hour per interface. Getting them wrong shows up a year later as a rebuild.

### Why it matters to the business

Integration costs are decided early. Take the fictional Calder Pumpworks, the course's running company. In November 2026 a partner's shortlist for seven new interfaces looked finished. A review against the hub found:

- A purchase order API that SAP had **deprecated** on the edition the partner looked at, with a successor already named.
- An extraction view for sales data that was **deprecated** on Calder's own release, with a successor.
- A plant system reading **raw SAP tables** through a custom function, which no SAP release promises to keep stable.
- An agent planned to call an API directly, outside the routes SAP's API policy endorses for agents.

None of these fails on day one. Each is a rebuild later: at an upgrade, at an audit, or when the old API is switched off. A deprecated API on S/4HANA Cloud gets at least 12 months between deprecation and switch-off, according to SAP's support article on one such API ([SAP KBA 3360429](https://userapps.support.sap.com/sap/support/knowledge/en/3360429)). That is enough time to move, but only if somebody notices.

The value is plain: **fewer rebuilds, cleaner upgrades and a defensible answer when SAP or an auditor asks how you reach SAP.** The hub check costs hours. A rebuilt interface costs weeks.

### How SAP does it

As of 30 November 2026, what SAP offers:

- **The hub itself** at [api.sap.com](https://api.sap.com/), also reachable as hub.sap.com. It lists APIs (REST, OData V2 and V4, SOAP), events, business objects, CDS views, BAdIs (enhancement points), integration and workflow content, business processes and SAP Build content ([SAP tutorial](https://developers.sap.com/tutorials/hcp-abh-getting-started.html); [SAP CodeJam](https://developers.sap.com/tutorials/codejam-events-process-1-bah.html)).
- **Try Out on a sandbox.** Sign in, and you can call many APIs against SAP's own demo data. You can also point Try Out at your own system with *Configure Environments* ([SAP Learning](https://learning.sap.com/learning-journeys/developing-soap-web-services-on-sap-erp/exploring-apis-in-the-sap-universe_c765ebfe-26e4-44ae-9c85-cda235bf9da2)).
- **A deprecation policy for listed content.** SAP requires content on the hub to follow one, covering versioning and compatibility ([SAP Learning](https://learning.sap.com/courses/implementing-sap-s-4hana-cloud-private-edition/setting-up-integrations-with-available-resources_b57a5f37-f8be-4432-b7de-00296d724721)). SAP's API policy says each API's deprecation schedule is documented on the hub or in the product documentation ([SAP API Policy](https://help.sap.com/doc/sap-api-policy/latest/en-US/API_Policy_latest.pdf)).
- **Release information below the API level.** For ABAP objects such as CDS views and tables, SAP publishes which are released, deprecated or not to be released, with successors, in the Cloudification Repository on GitHub ([SAP on GitHub](https://github.com/SAP/abap-atc-cr-cv-s4hc)).

Two things the hub is not. It is not **your** API catalogue: publishing your own APIs to partners is the job of Developer Hub in API Management ([API Management in depth](https://erpfde.com/topics/api-management-in-depth/)). And it is not proof that an API is available in **your** system: some content is per product and edition, and a service may still need to be switched on by an administrator ([Calling your first SAP API](https://erpfde.com/topics/calling-your-first-sap-api/)).

### Five questions before you approve an API

Use this table in any design review where an interface, extension or agent names an SAP API.

| Question | Where to look | Red flag |
| --- | --- | --- |
| Is it published? | The hub, or the product documentation | A custom function, a table, a screen, an "internal" service |
| What is its state? | The API's hub page; for CDS views, the Cloudification Repository | Deprecated, decommissioned or beta for a production build |
| Is it the right product and edition? | The product the page belongs to | Found on a Public Edition page while you run Private Edition, or the reverse |
| Does it carry the data we need? | The specification (API Reference, schema or download) | A needed field missing, on another entity, or read-only |
| How will it be opened and who owns it? | The setup notes on the page; your own register | Nobody named, nothing tried in a test system |

If an agent is the consumer, add a sixth: **which SAP-endorsed route does it use?** [SAP's API policy and third-party agents](https://erpfde.com/topics/sap-api-policy-and-third-party-agents/) explains why.

> **Note** **For functional consultants.** The hub is also where you check that a standard integration exists before you write a requirement for a custom one. In fit-to-standard workshops, record the API or integration package name and its state next to each integration requirement, and add a test case that reads every field the business needs through it. A field that the API does not carry is a gap to raise then, not in user acceptance testing.

### Questions to ask

1. Which SAP API, event or view does each new interface use, and where is its hub page?
2. Is any of them deprecated, beta, or found on another product's page? What is the successor and the date?
3. Who checked the specification against the fields the business needs, and when?
4. Does any interface read SAP tables or a custom function instead of a published API? What replaces it, and by when?
5. Which of our AI agents call SAP APIs, and through which endorsed route?
6. How often do we re-check the states of the APIs we depend on, and who gets told when one changes?

### Common misconceptions

- **"If it's on the hub, it's safe to build on."** Listed content can be deprecated. Check the state on the page, not just that the page exists.
- **"The sandbox proves it works for us."** The sandbox shows SAP's data on SAP's system. Your system may need the service activated, roles assigned and your own fields checked.
- **"Deprecated means it stops working."** A deprecated API still runs; it means don't start new use and plan the move. Decommissioned is when it stops.
- **"Reading the tables directly is faster and just as good."** It works until a release changes the tables. SAP lists most tables as not to be released and names the view to use instead.
- **"Our partner checked the APIs."** Ask which product page and on what date. Hub states change, and editions differ.

### Key terms

- **SAP Business Accelerator Hub:** SAP's public catalogue of APIs, events, CDS views, integration content and more, at api.sap.com.
- **Published API:** in SAP's API policy, an API on the hub or identified in the product's documentation.
- **API state:** where an API is in its life: active, deprecated or decommissioned (some content is also marked beta).
- **Deprecated:** still works, but don't start new use; a successor exists and an end date will follow.
- **Successor:** the API or object SAP names to replace a deprecated one.
- **Sandbox:** SAP's shared demo system behind the hub's Try Out, called with an API key.
- **Specification:** the machine-readable description of an API's entities, fields and operations, downloadable from the hub.
- **Cloudification Repository:** SAP's public list of released and not-released ABAP objects with their successors, on GitHub.
- **Integration package:** prebuilt Cloud Integration content listed on the hub.

### Check yourself

1. A partner says "the API is on the Business Accelerator Hub, so it's fine". What should the architect check next?
   - A. Whether the partner has built with that API on another project before
   - B. Its state, the product it's listed for, and whether its fields fit
   - C. Whether the API's page shows a recent number of downloads
   - D. Whether the sandbox returns data when the partner calls it

   Answer: B. Being listed makes an API published, but a listed API can be deprecated or belong to another edition, and may not carry the needed fields. The sandbox shows SAP's demo data, not fit for your system.

2. What does "deprecated" mean for an API you already use in production?
   - A. It has stopped working and calls now return errors
   - B. It is a beta API that is not supported for production use
   - C. It still works, but a successor exists; plan the move
   - D. It will keep working without limit as long as you don't upgrade

   Answer: C. Deprecated content still runs; decommissioned is when it stops. For the S/4HANA Cloud API in SAP's support article, at least 12 months pass between the two, which is time to move, not time to ignore it.

3. Calder's plant system reads production orders through a custom function that queries SAP tables. Why does the review flag it?
   - A. Custom functions are blocked by default in every S/4HANA release
   - B. The function is slower than an OData API for every kind of read
   - C. It is not published, so a release can change it without notice
   - D. Plant systems are not allowed to read production orders at all

   Answer: C. SAP's policy separates published APIs from everything else, and SAP lists the underlying tables as not to be released, with a released view as the successor. The interface works today but carries upgrade risk.

4. Which question belongs in the review when the consumer is an AI agent rather than an application?
   - A. Whether the agent's model is listed on the hub as a supported model
   - B. Which SAP-endorsed route the agent uses to reach the API
   - C. Whether the agent can call the sandbox without an API key
   - D. Whether the agent is allowed to read published APIs at all

   Answer: B. SAP's API policy limits agents that choose their own API calls to SAP-endorsed routes. The API may be fine; the route the agent uses decides whether the use is allowed.

5. What is the hub not designed to be?
   - A. A place to see an API's fields before anyone writes code
   - B. A place to find prebuilt integration content for SAP products
   - C. A place to try an API against SAP's demo data
   - D. The portal where your own partners subscribe to your APIs

   Answer: D. Publishing your own APIs to partners is the job of Developer Hub in API Management. The Business Accelerator Hub lists SAP's and partners' content.

6. A functional consultant finds that an integration requirement needs a field the standard API doesn't carry. When is the best time to raise it?
   - A. In the fit-to-standard workshop, beside the requirement
   - B. In user acceptance testing, once the interface has been built
   - C. After go-live, as the first change request on the interface
   - D. Only if the business reports the missing field in production

   Answer: A. A missing field is a gap that changes the design: another entity, another API or an extension. Found in the workshop it costs a note; found in testing it costs a rebuild.

## Deep layer

### Mental model

Treat the hub as **a register of contracts, not a shop window.** Every entry is a promise from SAP with three parts: what it is (the specification), how long it will be kept (the state and the deprecation policy), and where it applies (the product and edition). Your interface inherits all three.

So a candidate passes three gates, in order:

1. **Published.** It is on the hub or in product documentation. If not, stop: find the published equivalent.
2. **Alive for the life of your interface.** Active today, not deprecated on the release you will run in two years, and from the right product's page.
3. **Fits.** The fields and operations you need are on the entity you plan to use, writable where you write.

Then you record the answer, with a date and an owner, because the contract can change under you.

### How it works

#### What the hub holds

| Content | What it is | What you read on its page |
| --- | --- | --- |
| APIs | REST, OData V2 and V4, SOAP; grouped in API packages per product | Overview, API Reference (operations, schemas), Try Out, specification download |
| Events | Business events such as a sales order change, in CloudEvents format | Event reference, schema, payload and headers |
| CDS views | Released data models, including extraction-enabled ones | Fields and annotations |
| Business objects, BAdIs | The objects and enhancement points an extension can use | Description, related APIs |
| Integration content | Prebuilt Cloud Integration packages and flows | Documentation, configuration guide |
| Business processes, SAP Build content | Process content and templates | Overview, artifacts |

Sources: [SAP tutorial](https://developers.sap.com/tutorials/hcp-abh-getting-started.html), [SAP CodeJam](https://developers.sap.com/tutorials/codejam-events-process-1-bah.html).

You find content through **Categories** (APIs, Events and so on), through a product's page, or with search. Inside a category you can filter by API type, for example OData V2 versus V4 ([SAP Learning](https://learning.sap.com/learning-journeys/developing-soap-web-services-on-sap-erp/exploring-apis-in-the-sap-universe_c765ebfe-26e4-44ae-9c85-cda235bf9da2)).

#### Reading an API page

An API page has a few tabs. **Overview** gives the description, version and documentation links, and lets you download the reference file. **API Reference** lists the operations and their schemas. **Try Out** lets you call an operation after you sign in, with **Run** to send it, and **Code Snippet** to copy the same call as `curl` ([SAP tutorial](https://developers.sap.com/tutorials/hcp-abh-getting-started.html); [SAP tutorial](https://developers.sap.com/tutorials/hcp-abh-test-locally.html)).

The most useful thing on the page is the **specification file**. For an OData API you can download the EDMX (the service's `$metadata`) from **API Specification**; CAP's import tool reads that file directly ([CAP documentation](https://cap.cloud.sap/docs/guides/messaging/s4)). An OData V2 EDMX from S/4HANA carries SAP's own flags on each field: `sap:updatable="false"` marks a field you can read but not change. In the Sales Order API's metadata, `TotalCreditCheckStatus` and `OverallTotalDeliveryStatus` carry that flag. [Calling your first SAP API](https://erpfde.com/topics/calling-your-first-sap-api/) cites a copy of that metadata and explains how to read the rest of it.

#### States and successors

For S/4HANA Cloud APIs, SAP's support article on the purchase order API names three states: **Active**, **Deprecated** and **Decommissioned**. SAP keeps a deprecated API for at least 12 months before it is decommissioned, and the successor has to exist on the day the old version is deprecated ([SAP KBA 3360429](https://userapps.support.sap.com/sap/support/knowledge/en/3360429)). The same article is the worked example: the OData V2 `API_PURCHASEORDER_PROCESS_SRV` was deprecated with release 2308 of S/4HANA Cloud, and the article names the OData V4 `API_PURCHASEORDER` as the newer version.

Three things make this harder than it sounds:

- **States are per product.** The article is about S/4HANA Cloud releases. A Private Edition or on-premise system has its own release cycle, so read the page for your product, not the first search hit.
- **Integration content has states too.** From S/4HANA 2025, the software component under SAP's point-to-point cost center flows to Employee Central is deprecated. The flows stay on the hub for backward compatibility, as a temporary fallback, and SAP recommends Master Data Integration instead ([SAP KBA 3727053](https://userapps.support.sap.com/sap/support/knowledge/en/3727053)). A system on 2023 can use them today and still needs a plan before its 2025 upgrade.
- **Some content is beta.** Treat beta as "for trying", never for production, unless SAP confirms otherwise for your tenant in writing.

#### Below the API: released objects

APIs are built on ABAP objects: CDS views, behavior definitions, classes. For those, SAP publishes the **Cloudification Repository**: JSON files listing each object's state and, for objects not to be used, the successor ([SAP on GitHub](https://github.com/SAP/abap-atc-cr-cv-s4hc)). The ABAP Test Cockpit reads the same files to check custom code. There is a file for the latest cloud release and one per Private Edition feature pack.

In the file for Private Edition 2023 feature pack 3 (`objectReleaseInfo_PCE2023_3.json`, read 2026-11-30), for example:

| Object | State | Successor |
| --- | --- | --- |
| Table `VBAK` (sales document header) | notToBeReleased | CDS view `I_SALESDOCUMENT` |
| Table `AFKO` (production order header) | notToBeReleased | CDS view `I_MANUFACTURINGORDER` |
| CDS view `C_SALESDOCUMENTITEMDEX` | deprecated | `C_SALESDOCUMENTITEMDEX_1` |
| CDS view `I_SALESORDER` | released | |

The file also uses a fourth state, `notToBeReleasedStable`; check SAP's viewer before you rely on what it means for an object. This is the list an architect uses when an interface reads tables, or when an extraction pipeline names a view ([CDS extraction pipelines for AI](https://erpfde.com/topics/cds-extraction-pipelines-for-ai/)).

#### Events

The Events category lists business events by package. Each event has a reference page with its payload, headers and schema, in CloudEvents format ([SAP CodeJam](https://developers.sap.com/tutorials/codejam-events-process-1-bah.html); [CAP documentation](https://cap.cloud.sap/docs/guides/messaging/s4)). Notification events carry only the key of the changed object; data events carry the data. Calder treats S/4HANA's events as notifications, so a consumer reads the details through an API ([Event mesh and event-driven architecture](https://erpfde.com/topics/event-mesh-and-event-driven-architecture/)). The fit check for an event is therefore two checks: the event, and the API the consumer will read afterwards.

#### The sandbox

Try Out sends calls to `sandbox.api.sap.com` with your personal API key in an `APIKey` header ([SAP tutorial](https://developers.sap.com/tutorials/hcp-abh-test-locally.html)). It is SAP's system with SAP's data: perfect for learning a payload, useless for proving fit with your configuration. *Configure Environments* points Try Out at your own test system instead, once an administrator has opened the service there.

#### The judgement, as a flow

```mermaid
flowchart TD
  N[Need: consumer, fields, access] --> F[Find candidates on the hub]
  F --> P{Published?}
  P -- no --> R[Find the published equivalent<br/>or successor]
  R --> F
  P -- yes --> S{Active for our product<br/>for the interface's life?}
  S -- deprecated --> R
  S -- yes --> FIT{Spec carries the fields,<br/>writable where needed?}
  FIT -- no --> O[Other entity, other API<br/>or an extension]
  O --> F
  FIT -- yes --> A{Consumer is an agent?}
  A -- yes --> RT[Name the endorsed route]
  A -- no --> REC[Record: owner, date,<br/>how it is opened, tried where]
  RT --> REC
```

### Build it yourself: review Calder's API shortlist

You will run a small lab that does what an integration lead does with a partner's shortlist. It reads a register of Calder's seven needs, checks each candidate against nine course rules, reads a real API specification for fields, and looks up release states in SAP's Cloudification Repository format. Then you review the corrected shortlist.

```mermaid
flowchart LR
  I[--init] --> D[register_draft.json]
  I --> V[register_reviewed.json]
  I --> E[sample EDMX + release file]
  D --> R[review: rules H01-H09]
  V --> R
  E --> R
  R --> OUT[verdict per need:<br/>USE, CONFIRM or FIX]
  H[hub: API Specification download] --> S[spec: check fields]
  G[GitHub: release file] --> L[released: state and successor]
```

**Before you start:** complete [Set up your computer for this course](https://erpfde.com/topics/set-up-your-computer/) and [Set up for Unit 26](https://erpfde.com/topics/set-up-for-unit-26/). This walkthrough needs none of the setup's trials. The optional sandbox step uses the `SAP_API_KEY` you saved in [Calling your first SAP API](https://erpfde.com/topics/calling-your-first-sap-api/).

> **Note** New words. A **register** is a list of needs and the API chosen for each; the layout here is the course's, not an SAP format. **EDMX** is the XML file that describes an OData service. A **release file** is one of SAP's Cloudification Repository JSON files. **Exit code** is the number a program returns; `2` here means at least one rule failed.

> **Warning** Rule IDs `H01` to `H09`, verdicts, need IDs, owners and the register's states and dates are course values, not SAP data. The sample EDMX is a trimmed copy of the real Sales Order API metadata, and the sample release file copies eleven entries from SAP's `objectReleaseInfo_PCE2023_3.json`. Before you rely on any state for real work, read it on the live hub page for your product.

#### What you need

- Python and your `orchestrate-course` folder with its `.venv`, from the setup topic.
- No account and no extra libraries for the main path; the script uses built-in modules only and has no randomness, so your output matches the samples.
- Optional: a free SAP account to download a specification from the hub, and your sandbox API key in `.env`.
- About 35 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):**

     ```powershell
     .venv\Scripts\Activate.ps1
     ```

   - **macOS / Linux:**

     ```bash
     source .venv/bin/activate
     ```

4. Create the unit folder if it doesn't exist yet:

   - **Windows (PowerShell):**

     ```powershell
     New-Item -ItemType Directory -Force unit26
     ```

   - **macOS / Linux:**

     ```bash
     mkdir -p unit26
     ```

#### Step 2: Look at one API on the hub

This step is reading, not code. It shows you where the register's facts come from.

1. Open [api.sap.com](https://api.sap.com/) in your browser.
2. Search for `API_SALES_ORDER_SRV` and open the Sales Order API for the S/4HANA product you care about. Note the product name on the page: that is the product the facts below belong to.
3. On **Overview**, find the version, the documentation links and any state or deprecation notice.
4. Open **API Reference** and expand `A_SalesOrder`. Find `TotalCreditCheckStatus`.
5. If you are signed in, find the specification download (**API Specification**) and save the EDMX file into `orchestrate-course/unit26/hub/`. You'll use it in Step 7.

If you can't sign in, skip the download: the lab ships a trimmed copy.

#### Step 3: Create the script

1. In VS Code, create a new file `unit26/hub_fit.py`.
2. Paste the code below and save.

```python
"""Judge whether SAP's published APIs, events and CDS views fit Calder's needs.

Course lab for Unit 26, "Using the SAP Business Accelerator Hub".
Built-in modules only, no randomness. No network unless you pass --sandbox.

  python unit26/hub_fit.py --init                 write the sample files to unit26/hub/
  python unit26/hub_fit.py review                 review unit26/hub/register_draft.json
  python unit26/hub_fit.py review --file unit26/hub/register_reviewed.json
  python unit26/hub_fit.py spec --file unit26/hub/sample_API_SALES_ORDER_SRV.edmx
       --entity A_SalesOrder --fields SalesOrder,DeliveryStatus
  python unit26/hub_fit.py released --names VBAK,C_SALESDOCUMENTITEMDEX
  python unit26/hub_fit.py released --file objectReleaseInfo_PCE2023_3.json --names VBAK
  python unit26/hub_fit.py spec --sandbox API_SALES_ORDER_SRV --entity A_SalesOrder --fields SalesOrder
  python unit26/hub_fit.py --self-test

Register layout, rule IDs H01-H09, verdicts and Calder's values are course
labels, not SAP formats. The release states in the sample release file are
copied from SAP's Cloudification Repository on GitHub (file
objectReleaseInfo_PCE2023_3.json, read 2026-11-30).
"""
import argparse
import datetime as dt
import json
import os
import sys
import urllib.request
import xml.etree.ElementTree as ET

HERE = os.path.join("unit26", "hub")
SAP = "{http://www.sap.com/Protocols/SAPData}"
MAX_AGE_DAYS = 90  # course rule: re-check a hub page at least every 90 days
ENDORSED_ROUTES = {"Integration Suite MCP gateway", "A2A to a Joule agent"}  # course list

SYSTEM = {"id": "S4P", "product": "SAP S/4HANA Cloud Private Edition", "release": "2023"}

# A trimmed copy of the real $metadata of API_SALES_ORDER_SRV (OData V2).
# Field names, types and sap: flags are copied from the service's metadata.
SAMPLE_EDMX = """<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
  xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
  xmlns:sap="http://www.sap.com/Protocols/SAPData">
 <edmx:DataServices m:DataServiceVersion="2.0">
  <Schema Namespace="API_SALES_ORDER_SRV" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
   <EntityType Name="A_SalesOrderType" sap:label="Sales Order Header">
    <Key><PropertyRef Name="SalesOrder"/></Key>
    <Property Name="SalesOrder" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Sales Order"/>
    <Property Name="SalesOrderType" Type="Edm.String" MaxLength="4" sap:label="Sales Order Type"/>
    <Property Name="SalesOrganization" Type="Edm.String" MaxLength="4" sap:label="Sales Organization"/>
    <Property Name="DistributionChannel" Type="Edm.String" MaxLength="2" sap:label="Distribution Channel"/>
    <Property Name="SoldToParty" Type="Edm.String" MaxLength="10" sap:label="Sold-To Party"/>
    <Property Name="LastChangeDateTime" Type="Edm.DateTimeOffset" Precision="7" sap:label="Time Stamp" sap:creatable="false" sap:updatable="false"/>
    <Property Name="PurchaseOrderByCustomer" Type="Edm.String" MaxLength="35" sap:label="Customer Reference"/>
    <Property Name="TotalNetAmount" Type="Edm.Decimal" Precision="16" Scale="3" sap:label="Net Value" sap:creatable="false" sap:updatable="false"/>
    <Property Name="TransactionCurrency" Type="Edm.String" MaxLength="5" sap:label="Document Currency"/>
    <Property Name="RequestedDeliveryDate" Type="Edm.DateTime" Precision="0" sap:label="Requested Delivery Date"/>
    <Property Name="HeaderBillingBlockReason" Type="Edm.String" MaxLength="2" sap:label="Billing Block"/>
    <Property Name="DeliveryBlockReason" Type="Edm.String" MaxLength="2" sap:label="Delivery Block"/>
    <Property Name="OverallSDProcessStatus" Type="Edm.String" MaxLength="1" sap:label="Overall Status" sap:creatable="false" sap:updatable="false"/>
    <Property Name="TotalCreditCheckStatus" Type="Edm.String" MaxLength="1" sap:label="Credit Status" sap:creatable="false" sap:updatable="false"/>
    <Property Name="OverallTotalDeliveryStatus" Type="Edm.String" MaxLength="1" sap:label="Ovrl Delivery Status" sap:creatable="false" sap:updatable="false"/>
   </EntityType>
   <EntityType Name="A_SalesOrderItemType" sap:label="Sales Order Item">
    <Key><PropertyRef Name="SalesOrder"/><PropertyRef Name="SalesOrderItem"/></Key>
    <Property Name="SalesOrder" Type="Edm.String" Nullable="false" MaxLength="10" sap:label="Sales Order" sap:creatable="false" sap:updatable="false"/>
    <Property Name="SalesOrderItem" Type="Edm.String" Nullable="false" MaxLength="6" sap:label="Item"/>
    <Property Name="Material" Type="Edm.String" MaxLength="40" sap:label="Material"/>
    <Property Name="RequestedQuantity" Type="Edm.Decimal" Precision="15" Scale="3" sap:label="Requested Quantity"/>
    <Property Name="RequestedQuantityUnit" Type="Edm.String" MaxLength="3" sap:label="Requested Qty Unit"/>
    <Property Name="NetAmount" Type="Edm.Decimal" Precision="16" Scale="3" sap:label="Net Value" sap:creatable="false" sap:updatable="false"/>
    <Property Name="SDProcessStatus" Type="Edm.String" MaxLength="1" sap:label="Overall Status" sap:creatable="false" sap:updatable="false"/>
    <Property Name="DeliveryStatus" Type="Edm.String" MaxLength="1" sap:label="Delivery Status" sap:creatable="false" sap:updatable="false"/>
   </EntityType>
   <EntityContainer Name="API_SALES_ORDER_SRV_Entities" m:IsDefaultEntityContainer="true">
    <EntitySet Name="A_SalesOrder" EntityType="API_SALES_ORDER_SRV.A_SalesOrderType"/>
    <EntitySet Name="A_SalesOrderItem" EntityType="API_SALES_ORDER_SRV.A_SalesOrderItemType"/>
   </EntityContainer>
  </Schema>
 </edmx:DataServices>
</edmx:Edmx>
"""


def ddls(name, state, comp, successor=None):
    entry = {"tadirObject": "DDLS", "tadirObjName": name, "objectType": "CDS_STOB",
             "objectKey": name, "softwareComponent": "S4CORE",
             "applicationComponent": comp, "state": state,
             "successorClassification": "oneObject" if successor else ""}
    if successor:
        entry["successors"] = [{"tadirObject": successor[0], "tadirObjName": successor[1]}]
    return entry


def tabl(name, comp, successor):
    entry = ddls(name, "notToBeReleased", comp, ("DDLS", successor))
    entry.update(tadirObject="TABL", objectType="TABL")
    return entry


# Eleven entries copied from SAP's objectReleaseInfo_PCE2023_3.json (same layout, fewer fields).
SAMPLE_RELEASE = {"formatVersion": "1", "objectReleaseInfo": [
    tabl("VBAK", "SD-SLS", "I_SALESDOCUMENT"),
    tabl("VBAP", "SD-SLS", "I_SALESDOCUMENTITEM"),
    tabl("AFKO", "PP-SFC", "I_MANUFACTURINGORDER"),
    tabl("AFPO", "PP-SFC", "I_MANUFACTURINGORDERITEM"),
    tabl("EKKO", "MM-PUR", "I_PURCHASEORDERAPI01"),
    ddls("C_SALESDOCUMENTITEMDEX", "deprecated", "SD-ANA", ("DDLS", "C_SALESDOCUMENTITEMDEX_1")),
    ddls("C_SALESDOCUMENTITEMDEX_1", "released", "SD-ANA"),
    ddls("I_SALESDOCUMENT", "released", "SD-SLS"),
    ddls("I_SALESORDER", "released", "SD-SLS-SO"),
    ddls("I_MANUFACTURINGORDER", "released", "PP-VDM"),
    ddls("I_PURCHASEORDERAPI01", "released", "MM-PUR-PO"),
]}  # 11 entries

SO_FIELDS = ["SalesOrder", "SoldToParty", "PurchaseOrderByCustomer", "RequestedDeliveryDate"]


def need(nid, text, consumer, kind, owner, access, entity, fields, cand):
    return {"id": nid, "need": text, "consumer": consumer, "consumer_kind": kind,
            "owner": owner, "access": access, "entity": entity, "fields": fields,
            "candidate": cand}


def cand(name, kind, **kw):
    base = {"name": name, "kind": kind, "api_type": "", "product": SYSTEM["product"],
            "state": "", "successor": "", "deprecated_from": "", "spec": "",
            "fields_in_spec": [], "how_opened": "", "tried": "", "checked": "",
            "route": "", "reads": [], "note": ""}
    base.update(kw)
    return base


def draft_register():
    edmx = "sample_API_SALES_ORDER_SRV.edmx"
    return {"as_of": "2026-11-30", "system": SYSTEM, "author": "partner shortlist, November 2026",
            "needs": [
        need("N01", "Distributor order-status app shows an order's status", "W02 order-status app",
             "app", "00100292", "read", "A_SalesOrder", SO_FIELDS + ["DeliveryStatus", "DeliveryBlockReason"],
             cand("API_SALES_ORDER_SRV", "api", api_type="OData V2", state="active", spec=edmx,
                  tried="2026-11-26 sandbox", checked="2026-11-26")),
        need("N02", "Invoice triage reads purchase orders", "AGT_INV_TRIAGE (code picks every call)", "pipeline",
             "00100244", "read", "", [],
             cand("API_PURCHASEORDER_PROCESS_SRV", "api", api_type="OData V2",
                  product="SAP S/4HANA Cloud Public Edition", state="deprecated",
                  how_opened="destination S4_ODATA", tried="2026-08-14 sandbox",
                  checked="2026-08-14")),
        need("N03", "CRM learns about changed sales orders and their requested date", "CRM",
             "integration", "00100296", "events", "SalesOrder.Changed", ["SalesOrder", "RequestedDeliveryDate"],
             cand("sap.s4.beh.salesorder.v1.SalesOrder.Changed.v1", "event", api_type="event",
                  state="active", fields_in_spec=["SalesOrder"],
                  how_opened="event enablement to calder-aem-prod", tried="2026-11-20 S4Q",
                  checked="2026-11-20")),
        need("N04", "Cost centers reach SuccessFactors Employee Central", "SF-EC", "integration",
             "00100312", "write", "", [],
             cand("prebuilt point-to-point cost center flows", "package", api_type="integration package",
                  state="active", deprecated_from="SAP S/4HANA 2025", how_opened="Cloud Integration tenant",
                  tried="2026-10-30 calder-int-test", checked="2026-10-30")),
        need("N05", "Sales order items extracted to the data layer (I07)", "Datasphere", "integration",
             "00100280", "extract", "", [],
             cand("C_SALESDOCUMENTITEMDEX", "cds", api_type="CDS view", state="released",
                  how_opened="CDS extraction", tried="2026-11-02 S4Q", checked="2026-11-02")),
        need("N06", "MES reads released production orders", "MES Rockford", "integration",
             "00100314", "read", "", [],
             cand("Z_MES_GET_ORDERS", "custom", api_type="RFC", state="", reads=["AFKO", "AFPO"],
                  how_opened="RFC user TU_MES_RFC", tried="in production since 2021",
                  checked="2026-11-30")),
        need("N07", "Order-exceptions agent reads blocked orders", "AGT_ORDER_EXC", "agent",
             "00100296", "read", "A_SalesOrder", SO_FIELDS + ["TotalCreditCheckStatus", "DeliveryBlockReason"],
             cand("API_SALES_ORDER_SRV", "api", api_type="OData V2", state="active", spec=edmx,
                  how_opened="destination S4_ODATA", tried="2026-11-26 sandbox", checked="2026-11-26")),
    ]}


def reviewed_register():
    reg = draft_register()
    reg["author"] = "integration lead review, 2026-11-30"
    by = {n["id"]: n for n in reg["needs"]}
    n = by["N01"]
    n["fields"] = SO_FIELDS + ["OverallTotalDeliveryStatus", "DeliveryBlockReason"]
    n["candidate"].update(how_opened="destination S4_ODATA (Principal propagation)", checked="2026-11-30")
    n = by["N02"]
    n["candidate"].update(name="API_PURCHASEORDER", api_type="OData V4", state="active",
                          successor="", checked="2026-11-30", tried="2026-11-30 sandbox",
                          note="successor named in SAP KBA 3360429; confirm on the Private Edition page by 2026-12-14; V2 calls stay until then")
    n = by["N03"]
    n["fields"] = ["SalesOrder"]
    n["candidate"].update(checked="2026-11-30",
                          note="notification event; the CRM reads the requested date through API_SALES_ORDER_SRV")
    n = by["N04"]
    n["candidate"] = cand("SAP Master Data Integration (cost centers)", "service", api_type="MDI",
                          state="active", how_opened="MDI tenant calder-mdi-prod",
                          tried="2026-11-27 calder-mdi-test", checked="2026-11-30",
                          note="decision I13 by MDI, master data topic")
    n = by["N05"]
    n["candidate"].update(name="C_SALESDOCUMENTITEMDEX_1", tried="2026-11-30 S4Q", checked="2026-11-30")
    n = by["N06"]
    n["candidate"] = cand("I_MANUFACTURINGORDER", "cds", api_type="CDS view", state="released",
                          how_opened="custom RAP service on the released view (developer extension)",
                          tried="2026-11-30 S4D", checked="2026-11-30",
                          note="replaces Z_MES_GET_ORDERS by 2027-06-30")
    n = by["N07"]
    n["candidate"].update(route="Integration Suite MCP gateway", checked="2026-11-30")
    return reg


# ---------- reading a specification ----------

def read_spec(path_or_text, is_text=False):
    """Return {entity set or schema name: {field: {"updatable": bool or None}}} and the format."""
    raw = path_or_text if is_text else open(path_or_text, encoding="utf-8").read()
    if raw.lstrip().startswith("{"):
        doc = json.loads(raw)
        schemas = doc.get("components", {}).get("schemas") or doc.get("definitions") or {}
        out = {}
        for name, sch in schemas.items():
            props = sch.get("properties") or {}
            if props:
                out[name] = {p: {"updatable": None if not v.get("readOnly") else False}
                             for p, v in props.items()}
        return out, "OpenAPI JSON"
    root = ET.fromstring(raw)
    types, sets, fmt = {}, {}, "EDMX"
    for el in root.iter():
        tag = el.tag.split("}")[-1]
        if tag == "Schema":
            fmt = "EDMX OData V4" if "oasis-open.org/odata/ns/edm" in el.tag else "EDMX OData V2"
        if tag == "EntityType":
            fields = {}
            for p in el:
                if p.tag.split("}")[-1] == "Property":
                    upd = p.get(SAP + "updatable")
                    fields[p.get("Name")] = {"updatable": None if upd is None and fmt.endswith("V4")
                                             else upd != "false"}
            types[el.get("Name")] = fields
        if tag == "EntitySet":
            sets[el.get("Name")] = el.get("EntityType", "").split(".")[-1]
    out = {name: types.get(t, {}) for name, t in sets.items()}
    for t, f in types.items():
        out.setdefault(t, f)
    return out, fmt


def check_fields(spec, entity, fields, access):
    """Return (missing, read_only, hints)."""
    have = spec.get(entity, {})
    missing = [f for f in fields if f not in have]
    read_only = [f for f in fields if f in have and access == "write" and have[f]["updatable"] is False]
    hints = []
    for f in missing:
        elsewhere = [e for e, flds in spec.items() if f in flds and e != entity and not e.endswith("Type")]
        if elsewhere:
            hints.append(f"{f} exists on {', '.join(elsewhere)}")
    return missing, read_only, hints


# ---------- release information (Cloudification Repository) ----------

def load_release(path):
    data = SAMPLE_RELEASE if path is None else json.load(open(path, encoding="utf-8"))
    index = {}
    for o in data.get("objectReleaseInfo", []):
        index.setdefault(o.get("tadirObjName", "").upper(), o)
        index.setdefault(o.get("objectKey", "").upper(), o)
    return index


def release_line(index, name):
    o = index.get(name.upper())
    if not o:
        return name, "not in file", ""
    succ = ", ".join(s.get("tadirObjName", "") for s in o.get("successors", []))
    return name, o.get("state", ""), succ


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

def age_days(as_of, day):
    try:
        return (dt.date.fromisoformat(as_of) - dt.date.fromisoformat(day[:10])).days
    except ValueError:
        return None


def check(reg, base, release_index):
    findings = []  # (need id, level, rule, text)
    for n in reg["needs"]:
        c, nid = n["candidate"], n["id"]

        def add(level, rule, text):
            findings.append((nid, level, rule, text))

        # H01 published
        if c["kind"] in ("custom", "table"):
            add("FAIL", "H01", f"{c['name']} is not a published SAP API; SAP may change it without notice")
            for obj in c["reads"]:
                name, state, succ = release_line(release_index, obj)
                if state not in ("not in file", "released"):
                    add("FAIL", "H01", f"{name} is {state}" + (f"; successor {succ}" if succ else ""))
        else:
            add("OK", "H01", f"{c['kind']} {c['name']} is published")
        # H02 state
        state = c["state"]
        if c["kind"] in ("cds", "table"):
            name, rstate, succ = release_line(release_index, c["name"])
            if rstate != "not in file" and rstate != state:
                add("FAIL", "H02", f"register says {state or 'nothing'}; release file says {rstate}"
                    + (f", successor {succ}" if succ else ""))
                state = rstate
        if c["kind"] not in ("custom", "table") and not any(f[0] == nid and f[2] == "H02" for f in findings):
            if state in ("active", "released") and not c["deprecated_from"]:
                add("OK", "H02", f"state {state}")
            elif state in ("active", "released"):
                add("WARN", "H02", f"deprecated from {c['deprecated_from']}; plan the successor before that upgrade")
            elif state == "beta":
                add("WARN", "H02", "beta: not for production")
            elif state == "deprecated":
                add("FAIL", "H02", "deprecated: don't start new use" +
                    (f"; successor {c['successor']}" if c["successor"] else "; no successor recorded"))
            elif state == "decommissioned":
                add("FAIL", "H02", "decommissioned")
            else:
                add("WARN", "H02", "state not recorded")
        # H03 product
        if c["kind"] in ("api", "event", "cds") and c["product"] != reg["system"]["product"]:
            add("WARN", "H03", f"found on the {c['product']} page; confirm it for {reg['system']['product']}")
        elif c["kind"] in ("api", "event", "cds"):
            add("OK", "H03", f"product {c['product']}")
        # H04 fields
        if n["fields"]:
            if c["spec"]:
                spec, _ = read_spec(os.path.join(base, c["spec"]))
                missing, read_only, hints = check_fields(spec, n["entity"], n["fields"], n["access"])
                ok = not missing and not read_only
                text = f"{len(n['fields'])} fields on {n['entity']}"
                if missing:
                    text = f"missing on {n['entity']}: {', '.join(missing)}"
                    if hints:
                        text += f" ({'; '.join(hints)})"
                if read_only:
                    text += f"; read-only: {', '.join(read_only)}"
                add("OK" if ok else "FAIL", "H04", text)
            else:
                missing = [f for f in n["fields"] if f not in c["fields_in_spec"]]
                add("FAIL" if missing else "OK", "H04",
                    f"not in the {c['kind']}: {', '.join(missing)}" if missing
                    else f"{len(n['fields'])} fields in the {c['kind']}")
        # H05 how it is opened
        add("FAIL" if not c["how_opened"] else "OK", "H05",
            "how it is opened in the system not recorded" if not c["how_opened"] else c["how_opened"])
        # H06 tried
        add("OK" if c["tried"] else "WARN", "H06", f"tried {c['tried']}" if c["tried"] else "not tried")
        # H07 agents
        if n["consumer_kind"] == "agent":
            if c["route"] in ENDORSED_ROUTES:
                add("OK", "H07", f"agent route {c['route']}")
            else:
                add("FAIL", "H07", f"agent route '{c['route'] or 'none'}' is not an endorsed route")
        # H08 checked recently
        age = age_days(reg["as_of"], c["checked"]) if c["checked"] else None
        if age is None or age > MAX_AGE_DAYS:
            add("WARN", "H08", f"hub page last checked {c['checked'] or 'never'}")
        else:
            add("OK", "H08", f"checked {c['checked']}")
        # H09 owner
        add("OK" if n["owner"] else "FAIL", "H09", f"owner {n['owner']}" if n["owner"] else "no owner")
    return findings


def verdict(levels):
    if "FAIL" in levels:
        return "FIX"
    if "WARN" in levels:
        return "CONFIRM"
    return "USE"


def review(path, release_path):
    reg = json.load(open(path, encoding="utf-8"))
    base = os.path.dirname(path)
    findings = check(reg, base, load_release(release_path))
    s = reg["system"]
    print(f"Calder Pumpworks (fictional): API fit review as of {reg['as_of']}")
    print(f"  system {s['id']}, {s['product']} {s['release']}; {reg['author']}")
    counts = {"OK": 0, "WARN": 0, "FAIL": 0}
    verdicts = {}
    for n in reg["needs"]:
        mine = [f for f in findings if f[0] == n["id"]]
        print(f"\n{n['id']} {n['need']}")
        print(f"   candidate {n['candidate']['name']} ({n['candidate']['api_type'] or n['candidate']['kind']})")
        for _, level, rule, text in mine:
            counts[level] += 1
            if level != "OK":
                print(f"   {level:4} {rule} {text}")
        if n["candidate"]["note"]:
            print(f"   note: {n['candidate']['note']}")
        verdicts[n["id"]] = verdict([f[1] for f in mine])
        print(f"   verdict {verdicts[n['id']]}")
    print(f"\n{counts['OK']} OK, {counts['WARN']} WARN, {counts['FAIL']} FAIL across {len(reg['needs'])} needs")
    return 2 if counts["FAIL"] else 0


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

def cmd_spec(args):
    if args.sandbox:
        from_env = os.environ.get("SAP_API_KEY") or read_dotenv().get("SAP_API_KEY")
        if not from_env:
            print("SAP_API_KEY is not set in .env; add it or use --file")
            return 1
        url = f"https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/{args.sandbox}/$metadata"
        req = urllib.request.Request(url, headers={"APIKey": from_env, "Accept": "application/xml"})
        with urllib.request.urlopen(req, timeout=30) as resp:
            spec, fmt = read_spec(resp.read().decode("utf-8"), is_text=True)
        source = url
    else:
        spec, fmt = read_spec(args.file)
        source = args.file
    print(f"{source}: {fmt}")
    sets = [e for e in spec if not e.endswith("Type")] or list(spec)
    print(f"  {len(sets)} entity sets or schemas: {', '.join(sets[:8])}{' ...' if len(sets) > 8 else ''}")
    if not args.entity:
        return 0
    fields = [f for f in (args.fields or "").split(",") if f]
    missing, read_only, hints = check_fields(spec, args.entity, fields, "write" if args.write else "read")
    for f in fields:
        if f in missing:
            print(f"  MISSING  {f}")
        else:
            upd = spec[args.entity][f]["updatable"]
            flag = {True: "updatable", False: "read-only", None: "write flag not stated"}[upd]
            print(f"  found    {f} ({flag})")
    for h in hints:
        print(f"  hint     {h}")
    return 2 if missing or read_only else 0


def cmd_released(args):
    index = load_release(args.file)
    print(f"release file: {args.file or 'built-in sample (11 entries)'}")
    for name in [n for n in args.names.split(",") if n]:
        name, state, succ = release_line(index, name)
        print(f"  {name:32} {state:18} {('successor ' + succ) if succ else ''}".rstrip())
    return 0


def read_dotenv(path=".env"):
    values = {}
    if os.path.exists(path):
        for line in open(path, encoding="utf-8"):
            if "=" in line and not line.lstrip().startswith("#"):
                k, v = line.split("=", 1)
                values[k.strip()] = v.strip().strip('"')
    return values


def init():
    os.makedirs(HERE, exist_ok=True)
    files = {
        "register_draft.json": json.dumps(draft_register(), indent=2),
        "register_reviewed.json": json.dumps(reviewed_register(), indent=2),
        "sample_API_SALES_ORDER_SRV.edmx": SAMPLE_EDMX,
        "sample_release_info.json": json.dumps(SAMPLE_RELEASE, indent=2),
    }
    for name, text in files.items():
        with open(os.path.join(HERE, name), "w", encoding="utf-8") as fh:
            fh.write(text + ("\n" if not text.endswith("\n") else ""))
        print(f"wrote {os.path.join(HERE, name)}")


def self_test():
    spec, fmt = read_spec(SAMPLE_EDMX, is_text=True)
    tests = [
        ("sample is OData V2", fmt == "EDMX OData V2"),
        ("entity set maps to its type", "OverallTotalDeliveryStatus" in spec["A_SalesOrder"]),
        ("header has no DeliveryStatus", "DeliveryStatus" not in spec["A_SalesOrder"]),
        ("hint points to the item", check_fields(spec, "A_SalesOrder", ["DeliveryStatus"], "read")[2]
         == ["DeliveryStatus exists on A_SalesOrderItem"]),
        ("credit status is read-only", spec["A_SalesOrder"]["TotalCreditCheckStatus"]["updatable"] is False),
        ("requested date is updatable", spec["A_SalesOrder"]["RequestedDeliveryDate"]["updatable"] is True),
        ("VBAK successor", release_line(load_release(None), "vbak") == ("vbak", "notToBeReleased", "I_SALESDOCUMENT")),
        ("DEX view deprecated", release_line(load_release(None), "C_SALESDOCUMENTITEMDEX")[1] == "deprecated"),
        ("90-day age", age_days("2026-11-30", "2026-08-14") == 108),
        ("verdicts", [verdict(["OK"]), verdict(["OK", "WARN"]), verdict(["WARN", "FAIL"])] == ["USE", "CONFIRM", "FIX"]),
    ]
    tmp = os.path.join(HERE, "_selftest")
    os.makedirs(tmp, exist_ok=True)
    with open(os.path.join(tmp, "sample_API_SALES_ORDER_SRV.edmx"), "w", encoding="utf-8") as fh:
        fh.write(SAMPLE_EDMX)
    for name, reg, fails in (("draft", draft_register(), 9), ("reviewed", reviewed_register(), 0)):
        path = os.path.join(tmp, f"{name}.json")
        with open(path, "w", encoding="utf-8") as fh:
            json.dump(reg, fh)
        got = sum(1 for f in check(reg, tmp, load_release(None)) if f[1] == "FAIL")
        tests.append((f"{name} has {fails} FAIL", got == fails))
    passed = sum(1 for _, ok in tests if ok)
    for name, ok in tests:
        if not ok:
            print(f"failed: {name}")
    print(f"{passed} of {len(tests)} self-test checks passed")
    return 0 if passed == len(tests) else 1


def main():
    p = argparse.ArgumentParser(description=__doc__.splitlines()[0])
    p.add_argument("--init", action="store_true", help="write the sample files")
    p.add_argument("--self-test", action="store_true")
    sub = p.add_subparsers(dest="cmd")
    r = sub.add_parser("review")
    r.add_argument("--file", default=os.path.join(HERE, "register_draft.json"))
    r.add_argument("--release-file", default=None, help="a Cloudification Repository JSON file")
    s = sub.add_parser("spec")
    s.add_argument("--file", default=os.path.join(HERE, "sample_API_SALES_ORDER_SRV.edmx"))
    s.add_argument("--sandbox", help="read $metadata of this API from SAP's sandbox (needs SAP_API_KEY)")
    s.add_argument("--entity")
    s.add_argument("--fields")
    s.add_argument("--write", action="store_true", help="the fields will be written")
    rel = sub.add_parser("released")
    rel.add_argument("--file", default=None)
    rel.add_argument("--names", required=True)
    args = p.parse_args()
    if args.init:
        init()
        return 0
    if args.self_test:
        return self_test()
    if args.cmd == "review":
        if not os.path.exists(args.file):
            print(f"{args.file} not found; run: python unit26/hub_fit.py --init")
            return 1
        return review(args.file, args.release_file)
    if args.cmd == "spec":
        return cmd_spec(args)
    if args.cmd == "released":
        return cmd_released(args)
    p.print_help()
    return 0


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

#### Step 4: Write the sample files and check them

1. Run:

   ```bash
   python unit26/hub_fit.py --init
   ```

   You see:

   ```text
   wrote unit26/hub/register_draft.json
   wrote unit26/hub/register_reviewed.json
   wrote unit26/hub/sample_API_SALES_ORDER_SRV.edmx
   wrote unit26/hub/sample_release_info.json
   ```

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

2. Run the self-test:

   ```bash
   python unit26/hub_fit.py --self-test
   ```

   You see `12 of 12 self-test checks passed`.

3. Open `unit26/hub/register_draft.json`. It is the partner's shortlist: seven needs, each with a consumer, an owner, the fields it needs and one candidate with the facts the partner recorded from the hub.

> **Note** On Windows, if `python` opens the Microsoft Store or isn't found, use `py` instead in every command.

#### Step 5: Review the partner's shortlist

1. Run:

   ```bash
   python unit26/hub_fit.py review
   ```

2. The output starts like this:

   ```text
   Calder Pumpworks (fictional): API fit review as of 2026-11-30
     system S4P, SAP S/4HANA Cloud Private Edition 2023; partner shortlist, November 2026

   N01 Distributor order-status app shows an order's status
      candidate API_SALES_ORDER_SRV (OData V2)
      FAIL H04 missing on A_SalesOrder: DeliveryStatus (DeliveryStatus exists on A_SalesOrderItem)
      FAIL H05 how it is opened in the system not recorded
      verdict FIX

   N02 Invoice triage reads purchase orders
      candidate API_PURCHASEORDER_PROCESS_SRV (OData V2)
      FAIL H02 deprecated: don't start new use; no successor recorded
      WARN H03 found on the SAP S/4HANA Cloud Public Edition page; confirm it for SAP S/4HANA Cloud Private Edition
      WARN H08 hub page last checked 2026-08-14
      verdict FIX
   ```

3. Scroll down. The rest reads:

   ```text
   N05 Sales order items extracted to the data layer (I07)
      candidate C_SALESDOCUMENTITEMDEX (CDS view)
      FAIL H02 register says released; release file says deprecated, successor C_SALESDOCUMENTITEMDEX_1
      verdict FIX

   N06 MES reads released production orders
      candidate Z_MES_GET_ORDERS (RFC)
      FAIL H01 Z_MES_GET_ORDERS is not a published SAP API; SAP may change it without notice
      FAIL H01 AFKO is notToBeReleased; successor I_MANUFACTURINGORDER
      FAIL H01 AFPO is notToBeReleased; successor I_MANUFACTURINGORDERITEM
      verdict FIX

   N07 Order-exceptions agent reads blocked orders
      candidate API_SALES_ORDER_SRV (OData V2)
      FAIL H07 agent route 'none' is not an endorsed route
      verdict FIX

   40 OK, 3 WARN, 9 FAIL across 7 needs
   ```

   The exit code is `2`.

The rules:

| Rule | Checks | Source |
| --- | --- | --- |
| `H01` | The candidate is published, and any objects a custom interface reads are released | SAP API Policy 1.1 and 1.2; Cloudification Repository |
| `H02` | The state is active or released, not beta, deprecated or decommissioned, and not deprecated in a release you'll upgrade to | SAP KBA 3360429 and 3727053; release file for CDS views |
| `H03` | The page belongs to the product the interface calls | Course rule |
| `H04` | Every needed field is on the named entity, and writable if written | The specification |
| `H05` | How the API is opened in the system is recorded | Course rule |
| `H06` | It was tried in the sandbox or a test system | Course rule (a warning) |
| `H07` | An agent consumer uses an endorsed route | Course list after SAP's API policy topic |
| `H08` | The hub page was checked in the last 90 days | Course rule (a warning) |
| `H09` | The need has an owner | Course rule |

Read the findings that matter most:

- **N01** asks for `DeliveryStatus` on the order header. The header calls it `OverallTotalDeliveryStatus`; `DeliveryStatus` is an item field. The partner would have built an item read for a header question.
- **N02** picked an API from the Public Edition page, where SAP deprecated it in 2308. Calder runs Private Edition, so the state there must be confirmed, and the successor named.
- **N03** expects the requested date inside the sales order event. Calder's events are notifications: the CRM gets the key and reads the date through the API.
- **N04** is a warning, not a failure: the prebuilt flows work on Calder's 2023 release, but their base is deprecated from S/4HANA 2025.
- **N05** was copied from an old list. The release file shows the view deprecated, with a successor.

#### Step 6: Look up release states

1. Run:

   ```bash
   python unit26/hub_fit.py released --names VBAK,AFKO,C_SALESDOCUMENTITEMDEX,I_SALESORDER,ZMES_ORDERS
   ```

2. You see:

   ```text
   release file: built-in sample (11 entries)
     VBAK                             notToBeReleased    successor I_SALESDOCUMENT
     AFKO                             notToBeReleased    successor I_MANUFACTURINGORDER
     C_SALESDOCUMENTITEMDEX           deprecated         successor C_SALESDOCUMENTITEMDEX_1
     I_SALESORDER                     released
     ZMES_ORDERS                      not in file
   ```

3. Now use SAP's real file. Download it (about 10 MB):

   - **Windows (PowerShell):**

     ```powershell
     Invoke-WebRequest -Uri https://raw.githubusercontent.com/SAP/abap-atc-cr-cv-s4hc/main/src/objectReleaseInfo_PCE2023_3.json -OutFile unit26/hub/objectReleaseInfo_PCE2023_3.json
     ```

   - **macOS / Linux:**

     ```bash
     curl -sSL -o unit26/hub/objectReleaseInfo_PCE2023_3.json https://raw.githubusercontent.com/SAP/abap-atc-cr-cv-s4hc/main/src/objectReleaseInfo_PCE2023_3.json
     ```

4. Look up the same names plus two more:

   ```bash
   python unit26/hub_fit.py released --file unit26/hub/objectReleaseInfo_PCE2023_3.json --names VBAK,KNA1,BAPI_SALESORDER_CREATEFROMDAT2
   ```

   You see:

   ```text
   release file: unit26/hub/objectReleaseInfo_PCE2023_3.json
     VBAK                             notToBeReleased    successor I_SALESDOCUMENT
     KNA1                             notToBeReleased    successor I_CUSTOMER
     BAPI_SALESORDER_CREATEFROMDAT2   notToBeReleased    successor I_SALESORDERTP
   ```

   SAP updates these files. If a line differs, the file changed after 30 November 2026: your result is the current one.

5. Run the review against the real file:

   ```bash
   python unit26/hub_fit.py review --release-file unit26/hub/objectReleaseInfo_PCE2023_3.json
   ```

   The totals match Step 5 while SAP's file keeps these states.

#### Step 7: Check fields against a specification

1. Run the field check on the sample EDMX:

   ```bash
   python unit26/hub_fit.py spec --entity A_SalesOrder --fields SalesOrder,DeliveryStatus,OverallTotalDeliveryStatus,TotalCreditCheckStatus
   ```

2. You see:

   ```text
   unit26/hub/sample_API_SALES_ORDER_SRV.edmx: EDMX OData V2
     2 entity sets or schemas: A_SalesOrder, A_SalesOrderItem
     found    SalesOrder (updatable)
     MISSING  DeliveryStatus
     found    OverallTotalDeliveryStatus (read-only)
     found    TotalCreditCheckStatus (read-only)
     hint     DeliveryStatus exists on A_SalesOrderItem
   ```

3. Now ask the write question: could a CRM set these three fields?

   ```bash
   python unit26/hub_fit.py spec --entity A_SalesOrder --fields RequestedDeliveryDate,DeliveryBlockReason,TotalCreditCheckStatus --write
   ```

   The credit status comes back `read-only`, and the exit code is `2`. A credit block is released through credit management, not by writing a status field.

4. If you downloaded the real EDMX in Step 2, point the script at it (use your file's name):

   ```bash
   python unit26/hub_fit.py spec --file unit26/hub/API_SALES_ORDER_SRV.edmx --entity A_SalesOrder --fields SalesOrder,OverallTotalDeliveryStatus
   ```

   The script lists the real service's entity sets (the full API has more than the sample's two) and the same two fields. It also reads OData V4 EDMX and OpenAPI JSON files; for those it reports whether a field exists, and says when the file states no write flag.

5. Optional, with a sandbox key: read the specification straight from SAP's sandbox. Your `.env` must hold `SAP_API_KEY=...` from [Calling your first SAP API](https://erpfde.com/topics/calling-your-first-sap-api/).

   ```bash
   python unit26/hub_fit.py spec --sandbox API_SALES_ORDER_SRV --entity A_SalesOrder --fields SalesOrder,TotalCreditCheckStatus
   ```

> **Warning** The API key is personal. Keep it in `.env`, never in the script or in Git.

#### Step 8: Review the corrected shortlist

1. Run:

   ```bash
   python unit26/hub_fit.py review --file unit26/hub/register_reviewed.json
   ```

2. The interesting lines:

   ```text
   N02 Invoice triage reads purchase orders
      candidate API_PURCHASEORDER (OData V4)
      WARN H03 found on the SAP S/4HANA Cloud Public Edition page; confirm it for SAP S/4HANA Cloud Private Edition
      note: successor named in SAP KBA 3360429; confirm on the Private Edition page by 2026-12-14; V2 calls stay until then
      verdict CONFIRM
   ```

   and at the end:

   ```text
   51 OK, 1 WARN, 0 FAIL across 7 needs
   ```

   The exit code is `0`.

3. Compare the two registers in VS Code (right-click one, **Select for Compare**, then **Compare with Selected** on the other). The fixes: the header delivery status field; the successor named for purchase orders, with a date to confirm it; the CRM reading the date through the API after the event; cost centers by Master Data Integration, as decided in [Master Data Integration and the One Domain Model](https://erpfde.com/topics/master-data-integration-and-one-domain-model/); the successor extraction view; a custom service on the released `I_MANUFACTURINGORDER` instead of the table read; and the agent through the Integration Suite MCP gateway.

> **Note** The register, its states and the verdicts are made up for the course; they show the method, not the state of any API in a real system. Only the release states looked up in Step 6 come from SAP's file.

#### Step 9: Save your work

```bash
git add unit26/hub_fit.py unit26/hub/register_*.json unit26/hub/sample_*
git commit -m "Unit 26: API fit review for Calder's shortlist"
```

Leave SAP's 10 MB release file out of Git; download it again when you need it.

#### How the code works

| Part | What it does |
| --- | --- |
| `SAMPLE_EDMX` | A trimmed copy of the Sales Order API's `$metadata`, with SAP's real field names and `sap:` flags |
| `SAMPLE_RELEASE`, `load_release()` | Eleven entries from SAP's release file, or the full file with `--file`; indexed by object name |
| `draft_register()`, `reviewed_register()` | The partner's shortlist and the corrected one, written to JSON by `--init` |
| `read_spec()` | Reads OData V2 or V4 EDMX, or OpenAPI JSON, into entity sets and fields with their write flag |
| `check_fields()` | Finds missing and read-only fields, and hints where a missing field lives instead |
| `check()` | Applies `H01` to `H09` to each need |
| `review()` | Prints the findings, a verdict per need (`FIX` on any failure, `CONFIRM` on a warning, `USE` otherwise) and the totals; exit code 2 on a failure |
| `cmd_spec()`, `cmd_released()` | The `spec` and `released` commands; `--sandbox` reads `$metadata` from SAP's sandbox with your key |
| `self_test()` | Twelve 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 | The script needs built-in modules only; paste it again from Step 3 |
| `register_draft.json not found` | Step 4 hasn't run, or you are in another folder | Run `python unit26/hub_fit.py --init` from `orchestrate-course` |
| `json.decoder.JSONDecodeError` on the release file | The download stopped early, or saved an error page | Download it again and check it is about 10 MB |
| `xml.etree.ElementTree.ParseError` | The saved specification isn't EDMX (perhaps an HTML page) | Download it again from **API Specification** |
| `SAP_API_KEY is not set in .env` | No sandbox key | Add it as in Calling your first SAP API, or use `--file` |
| `HTTP Error 401` with `--sandbox` | The key is wrong or expired | Copy it again from **Show API Key** on the hub |
| `URLError` or a proxy error | A company network blocks the download | Download in a browser and save the file into `unit26/hub/`; the main path needs no network |
| Your counts differ from the samples | The files were edited, or SAP's release file changed | Run `--self-test`, then `--init` to restore the samples |

### The SAP way

What SAP provides, as of 30 November 2026:

- **The SAP Business Accelerator Hub** at api.sap.com, free to browse, with Try Out on a sandbox after sign-in and *Configure Environments* for your own systems ([SAP tutorial](https://developers.sap.com/tutorials/hcp-abh-getting-started.html); [SAP Learning](https://learning.sap.com/learning-journeys/developing-soap-web-services-on-sap-erp/exploring-apis-in-the-sap-universe_c765ebfe-26e4-44ae-9c85-cda235bf9da2)).
- **The definition of a published API** in SAP's API policy: on the hub or identified in product documentation; non-published APIs may change or be removed without notice ([SAP API Policy](https://help.sap.com/doc/sap-api-policy/latest/en-US/API_Policy_latest.pdf)).
- **Deprecation, product by product.** For S/4HANA Cloud APIs, at least 12 months from deprecated to decommissioned, with the successor available on day one ([SAP KBA 3360429](https://userapps.support.sap.com/sap/support/knowledge/en/3360429)). Support articles announce individual cases, such as the cost center flows from S/4HANA 2025 ([SAP KBA 3727053](https://userapps.support.sap.com/sap/support/knowledge/en/3727053)).
- **The Cloudification Repository** with released objects and successors per release, its public viewer, and the ATC check that reads it ([SAP on GitHub](https://github.com/SAP/abap-atc-cr-cv-s4hc)).
- **Tools that read hub specifications.** CAP imports an EDMX downloaded from the hub ([CAP documentation](https://cap.cloud.sap/docs/guides/messaging/s4)); [Generating an MCP server from an OData API](https://erpfde.com/topics/generating-mcp-servers-from-odata-apis/) starts from the same file.
- **Licensing note.** Browsing and the sandbox need only a free SAP account. Using an API in your system follows your product's licence; the hub page doesn't grant a right of use.

### Build vs. SAP

| Need | SAP | Your own | Use which |
| --- | --- | --- | --- |
| Find which API or event exists | The hub | Asking around, old project files | The hub, always; it is the definition of published |
| Know which APIs you depend on | Nothing that knows your interfaces | An interface register with the API, state, owner and check date | Your register; the hub can't know your usage |
| Know the state of ABAP objects your code uses | Cloudification Repository, ATC check | Your own lists | SAP's files and the ATC check |
| Try a payload | Sandbox Try Out | A mock you write | Sandbox for learning; your test system for fit |
| Offer your own APIs to partners | Developer Hub in API Management | A wiki page | Developer Hub |
| Notice a state change | Hub pages, support articles | A scheduled re-check | A scheduled re-check of every API in your register |

### Architecture view

**Where it sits.** The hub sits outside your landscape: a design-time source, never a runtime dependency. Facts flow from it into your interface register and your design documents; calls flow from your consumers to your systems, through Integration Suite where the [integration platform decision](https://erpfde.com/topics/integration-platform-and-clean-core/) says so.

```mermaid
flowchart LR
  HUB[Business Accelerator Hub<br/>specs, states, events] -. design time .-> REG[Interface register<br/>API, state, owner, date]
  CR[Cloudification Repository] -. design time .-> REG
  REG --> ADR[Design docs and ADRs]
  C[Consumers: apps, CRM, MES, agents] --> IS[Integration Suite<br/>API Management, MCP gateway]
  IS --> S4[S4P: published APIs and events]
```

**Non-functional requirements** that decide the design:

| Requirement | Typical target | What breaks if missed |
| --- | --- | --- |
| Interface life vs. API life | No API deprecated on any release you'll run in the next 24 months, or a dated plan | A forced rebuild at an upgrade |
| Recency of facts | Every API in the register re-checked every 90 days (course rule) | A state change found by an outage |
| Fit | Every needed field confirmed in the spec for your product | Rework after build, or a hidden extension |
| Publication | No production interface on unpublished APIs or tables without a dated exit | Upgrade breakage, policy exposure |
| Agent routes | Every agent consumer on an endorsed route | Throttling or suspension under the API policy |

**Integration and identity.** The hub's facts don't move at runtime. What it changes is which released API, event or CDS view carries the data, and therefore which communication arrangement or service activation, which technical or propagated user, and which roles. Record "how it is opened" next to each API, so the security review can see the identity path ([SOAP and OData services in depth](https://erpfde.com/topics/soap-and-odata-services-in-depth/)).

**The decision to record** (short ADR form from [the design-doc topic](https://erpfde.com/topics/writing-a-solution-design-doc/)):

- *Context:* Calder's partner shortlisted seven SAP APIs and views for new interfaces; three were deprecated or unpublished on Calder's release.
- *Options:* (1) accept the shortlist and fix issues as they appear; (2) review each candidate against the hub and the release files before build, and keep the facts in the interface register; (3) buy a third-party API catalogue.
- *Decision:* option 2. Every new interface names a published SAP API with its state, product page, check date and owner; the register is re-checked every 90 days.
- *Consequences:* a review step of about an hour per interface; N02 waits for confirmation by 2026-12-14; the MES table read is replaced by 2027-06-30.

**What a design review will ask:**

1. Which of these APIs are deprecated on any release we'll run during the interface's life?
2. Were the states read on our product's page, and when?
3. Which interfaces read tables or custom functions, and what is their exit?
4. Who is told when SAP deprecates something we use, and how fast must they act?
5. Which agents call SAP, and through which endorsed route?

### Production concerns

- **Security and authorizations.** A published API still needs roles. Ask for the narrowest communication scenario or service, and a user that reads only what the consumer needs. Never reuse your personal sandbox key outside learning.
- **Evaluation.** The fit check is a test: keep the field list per need in the register, and rerun it against your test system's metadata after every upgrade.
- **Cost.** The hub and sandbox are free. The cost is in the rebuilds you avoid; count them in the review's business case.
- **Operations.** Put the 90-day re-check in the integration team's calendar. Subscribe to the support articles for the APIs you rely on. When SAP deprecates one, open a ticket with the successor and a date.
- **Clean core.** Published APIs and released objects are what clean core is made of. Table reads and custom functions over SAP data are the debt; the release file names the way out ([RFC and BAPI in depth](https://erpfde.com/topics/rfc-and-bapi-in-depth/)).

### Where AI fits

- **Agents are one more consumer.** An agent reading blocked orders needs the same three gates, plus an endorsed route. The [Integration Suite MCP gateway](https://erpfde.com/topics/integration-suite-mcp-gateway-hands-on/) turns a published API into governed tools; it doesn't make an unpublished one safe.
- **Specs become tools.** A hub EDMX is the input for generating MCP tools ([Generating an MCP server from an OData API](https://erpfde.com/topics/generating-mcp-servers-from-odata-apis/)). The fit check here is the same work as trimming the generated tools.
- **Models invent API names.** Coding assistants suggest plausible SAP service names and fields that don't exist, or that are deprecated. Check every suggestion against the hub and the release file, as `spec` and `released` do. SAP has started offering release files in the compact TOON format for language models, as a pilot ([SAP on GitHub](https://github.com/SAP/abap-atc-cr-cv-s4hc)).
- **Nothing replaces the date.** An assistant trained last year doesn't know this quarter's deprecations. The register's check date is the control.

### Pitfalls

- **Reading the first search hit.** Hub pages are per product. A Public Edition state says little about a Private Edition system.
- **Taking a field's label for its name.** Labels such as "Delivery Status" appear on several entities. Check the technical name on the entity you'll call.
- **Writing to read-only fields.** `sap:updatable="false"` means the API won't take it; the business process behind it has its own API.
- **Expecting data in a notification event.** Plan the follow-up read, and its authorizations.
- **Copying old lists.** States change with every release. A spreadsheet from a previous project is a list of things to re-check.
- **Treating the sandbox as a test system.** It proves the call shape, not fit with your configuration, roles or data.
- **Leaving table reads "for now".** Without an owner and a date in the register, now lasts until the upgrade breaks it.

### Exercise

Extend the register with a need that writes, and with your own release-file check. Your output feeds the interface inventory in later Unit 26 topics.

1. Run `python unit26/hub_fit.py --init` to start from clean samples.
2. Open `unit26/hub/register_reviewed.json` and copy need `N01`. Change the copy to: `"id": "N08"`, `"need": "CRM sets requested date and delivery block"`, `"consumer": "CRM"`, `"owner": "00100296"`, `"access": "write"`, `"fields": ["RequestedDeliveryDate", "DeliveryBlockReason", "TotalCreditCheckStatus"]`. Save.
3. Run `python unit26/hub_fit.py review --file unit26/hub/register_reviewed.json`. `N08` fails `H04` with `read-only: TotalCreditCheckStatus`.
4. Remove `TotalCreditCheckStatus` from N08's fields; a credit release goes through the credit analyst's route instead. Run the review again.
5. With the real release file from Step 6, look up one table or function that an interface you know reads (for example `EKKO`), and write its successor into the note of the need that uses it.

**Done when:** the review prints `N08 ... verdict USE`, the totals read `59 OK, 1 WARN, 0 FAIL across 8 needs`, and your register names at least one successor you found in SAP's release file.

### Check yourself

1. The partner's register asks for DeliveryStatus on A_SalesOrder. What does the spec check show, and what is the fix?
   - A. The field is missing everywhere, so the order-status app needs an extension field
   - B. The header field is OverallTotalDeliveryStatus; DeliveryStatus is an item field
   - C. The field is present but read-only, so the app must read it through another API
   - D. The field exists in the V4 API only, so the app must move to OData V4

   Answer: B. The trimmed EDMX shows DeliveryStatus on A_SalesOrderItem and OverallTotalDeliveryStatus on the header. Using the label instead of the technical name on the right entity would have built an item read for a header question.

2. According to SAP's support article for the S/4HANA Cloud purchase order API, what happens between deprecation and decommissioning?
   - A. The API stops accepting writes but keeps answering reads
   - B. SAP decommissions it at the next quarterly release, with no minimum period set
   - C. It stays deprecated for 12 months or more, with the successor already live
   - D. It moves to beta again while SAP builds and tests the successor

   Answer: C. The article names Active, Deprecated and Decommissioned, and a minimum of 12 months in the deprecated state. The successor has to exist on the day the old version is deprecated.

3. The register says C_SALESDOCUMENTITEMDEX is released, but the review fails it. Where does the contradiction come from?
   - A. The hub page for the view was checked more than 90 days ago
   - B. SAP's Private Edition 2023 release file lists it as deprecated
   - C. Extraction views are not published APIs under SAP's policy
   - D. The view is listed on a Public Edition page instead of Calder's product

   Answer: B. For CDS views the lab reads the state from the Cloudification Repository format, and SAP's file shows C_SALESDOCUMENTITEMDEX as deprecated with C_SALESDOCUMENTITEMDEX_1 as its successor. The register had been copied from an old list.

4. A CRM team wants to release credit blocks by writing TotalCreditCheckStatus through the Sales Order API. What would you do?
   - A. Approve it, because the field sits on the A_SalesOrder header entity set
   - B. Approve it for the sandbox first, then for the production system
   - C. Ask for an extension that makes the field writable in the API
   - D. Refuse it: the spec marks the field read-only; use credit management

   Answer: D. The EDMX flags TotalCreditCheckStatus with sap:updatable="false". The status is the result of a process, and the release has its own owner and route, not a field write.

5. Calder's MES reads AFKO and AFPO through a custom RFC function. What does the release file add to the review?
   - A. It shows the tables are deprecated and will be removed at the next release
   - B. It shows the RFC function is released if it was written in customer namespace
   - C. It lists them as not to be released, with released CDS views as successors
   - D. It shows the tables are released for reads but not for writes

   Answer: C. SAP's file marks both tables notToBeReleased and names I_MANUFACTURINGORDER and I_MANUFACTURINGORDERITEM. That gives the replacement a concrete starting point instead of a vague "use an API".

6. Your system is on S/4HANA 2023 and the prebuilt cost center flows to Employee Central work today. Why does the review still warn?
   - A. The flows are beta and not supported in production on 2023
   - B. The flows were removed from the hub when MDI became available
   - C. Their base is deprecated from S/4HANA 2025, so an upgrade needs a plan
   - D. The flows only work when the system is the S/4HANA Cloud Public Edition

   Answer: C. SAP's support article deprecates the component under those flows with S/4HANA 2025 and keeps them only as a temporary fallback. The check asks about the releases you will run during the interface's life, not only today's.

7. An order-exceptions agent reads blocked orders through the right published API, but the review fails it. Why?
   - A. Agents may only use OData V4 APIs, never the older V2 ones of a system
   - B. The agent's owner was not recorded in the register
   - C. It has no endorsed route, which SAP's policy expects for agents
   - D. The API's sandbox does not allow calls made by an agent

   Answer: C. The API passes the first three gates. For a consumer that plans its own calls, SAP's policy limits access to endorsed routes, so the review asks for one, such as the Integration Suite MCP gateway.

8. A coding assistant suggests an SAP API name you have never seen. What is the right first check?
   - A. Ask the assistant to confirm that the API exists and is current
   - B. Call it in production with a read-only user to see if it answers
   - C. Search the company wiki for earlier projects that used the same name
   - D. Look it up on the hub for your product, and in the release file

   Answer: D. Models can produce plausible names that don't exist or are deprecated. The hub defines what is published and the release file gives ABAP object states; both carry a date the model can't know.

## Sources

- [Get Started with SAP Business Accelerator Hub (SAP Developer Center tutorial, read 2026-11-30)](https://developers.sap.com/tutorials/hcp-abh-getting-started.html): Categories menu, APIs with policy templates and API packages; browse by API type (REST, OData, SOAP) or by package; Overview tab (download the API reference, documentation, version), API Reference, Try Out after login, Run; sandbox environment; business processes, partner content, integration and workflow content
- [Exploring Events and More in the SAP Business Accelerator Hub (SAP Developer Center, SAP CodeJam, read 2026-11-30)](https://developers.sap.com/tutorials/codejam-events-process-1-bah.html): Content for SAP products: APIs, events, business objects, CDS views and BAdIs; SAP Build content; Events category grouped by package; event specification in JSON or YAML; CloudEvents; notification events carry an ID, data events carry the data; hub reached at hub.sap.com; bylines dated March and October 2025
- [Test SAP Business Accelerator Hub APIs locally with curl (SAP Developer Center tutorial, read 2026-11-30)](https://developers.sap.com/tutorials/hcp-abh-test-locally.html): Try Out, then Code Snippet, curl; the API key travels in an APIKey header; sandbox host sandbox.api.sap.com
- [Exploring APIs in the SAP Universe (SAP Learning, read 2026-11-30)](https://learning.sap.com/learning-journeys/developing-soap-web-services-on-sap-erp/exploring-apis-in-the-sap-universe_c765ebfe-26e4-44ae-9c85-cda235bf9da2): Explore menu; API packages per product; filter OData V2 and V4; REST, OData and SOAP; Try Out on the sandbox, code snippets, API key, OpenAPI documentation; Configure Environments to point Try Out at your own system; no page date
- [Setting up Integrations with Available Resources (SAP Learning, S/4HANA Cloud Private Edition course, read 2026-11-30)](https://learning.sap.com/courses/implementing-sap-s-4hana-cloud-private-edition/setting-up-integrations-with-available-resources_b57a5f37-f8be-4432-b7de-00296d724721): Hub formerly SAP API Business Hub; public catalog of integration and extension content from SAP and partners; APIs in the Open API format; SAP requires content on the hub to follow a deprecation policy (versioning, compatibility, applicability); consultants identify resources there for customer-driven integrations
- [SAP Knowledge Base Article 3360429 on the Purchase Order OData API (read 2026-11-30)](https://userapps.support.sap.com/sap/support/knowledge/en/3360429): States Active, Deprecated, Decommissioned; Deprecated for a minimum of 12 months before Decommissioned; the successor must be available on the day the previous version is deprecated; API_PURCHASEORDER_PROCESS_SRV (OData V2) deprecated with 2308; OData V4 API_PURCHASEORDER; environments SAP S/4HANA Cloud 2308 and 2402
- [SAP Knowledge Base Article 3727053 on cost center replication to Employee Central (read 2026-11-30)](https://userapps.support.sap.com/sap/support/knowledge/en/3727053): Software component ODTFINCC, the base of the point-to-point Cloud Integration flows, deprecated with S/4HANA 2025; MDI strongly recommended; the flows stay on the hub for backward compatibility as a temporary fallback
- [SAP API Policy v.4.2026a (SAP Help Portal PDF, read 2026-11-30)](https://help.sap.com/doc/sap-api-policy/latest/en-US/API_Policy_latest.pdf): 1.1 Published APIs are those on the SAP Business Accelerator Hub or identified in product documentation; 1.2 non-published APIs may change or be removed without notice; 2.1 deprecation schedules per API are documented in product documentation or on the hub
- [Receiving Events from SAP S/4HANA Cloud Systems (CAP documentation, read 2026-11-30)](https://cap.cloud.sap/docs/guides/messaging/s4): Find an event on the hub, View Event Reference, Schema tab; event names such as sap.s4.beh.businesspartner.v1.BusinessPartner.Changed.v1; download the EDMX from API Specification and import it with cds import; CloudEvents format
- [SAP Cloud ERP released and classic API list, the Cloudification Repository (SAP on GitHub, files read 2026-11-30)](https://github.com/SAP/abap-atc-cr-cv-s4hc): JSON list of released ABAP objects with not-released objects and their successors, used by the ATC check; objectReleaseInfoLatest.json for SAP Cloud ERP, objectReleaseInfo_PCE<release>.json per Private Edition feature pack; viewer at sap.github.io; TOON files for LLMs in pilot; states seen in objectReleaseInfo_PCE2023_3.json: released, deprecated, notToBeReleased, notToBeReleasedStable
