Sub topic 2
Released APIs and Stable Contracts
This chapter assumes you know what a clean core is, can read OData service URLs, and can read simple Node.js code. It explains what makes an API "released", how to find one, and how to depend on it safely from a side-by-side extension.
What "released" means
A released API is an interface that SAP has formally declared stable for customer and partner use. SAP publishes it with a contract. It promises to keep the interface compatible across upgrades, or to deprecate it with advance notice before removing it.
An unreleased object, such as an internal table or a classic function module, carries no such promise. SAP can rename, change, or delete it in any release. An extension that reads it can break during an upgrade without warning.
Extensions that depend only on released APIs can be upgraded alongside the core system. The contract is the part that does not move.
Where released APIs come from
Released APIs come in several forms:
- OData services (V2 and V4) for reading and writing business data, such as
API_BUSINESS_PARTNER. - SOAP services for some older integration scenarios.
- Business events that announce changes, covered in a later chapter.
- Released ABAP objects (classes, CDS views, behavior definitions) for ABAP Cloud development inside the system.
You find them on SAP Business Accelerator Hub (api.sap.com), which lists each API with its release state, version, and downloadable specification. Inside an ABAP system, ABAP Development Tools show the release state of each object.
Release states and lifecycle
Each released object has a state. The exact labels differ by object type, but the pattern is the same:
| State | Meaning | What to do |
|---|---|---|
| Released | Stable for use in extensions | Safe to depend on |
| Deprecated | Still works, replacement exists | Plan migration |
| Decommissioned | Removed or scheduled for removal | Must migrate |
Check the state when you pick an API, and check again during governance reviews. A deprecated API still works today, but it will not work forever.
Depending only on the contract
The practical rule is to expose your own model and map it to the API. Your consumers should never see the raw S/4HANA structure. If the API changes, you fix the mapping in one place.
The following CDS service projects a few fields from the imported Business Partner API. It is read-only, and it names only fields that the released contract defines.
using { API_BUSINESS_PARTNER as bp } from './external/API_BUSINESS_PARTNER';
service PartnerReview {
@readonly
entity BusinessPartners as projection on bp.A_BusinessPartner {
key BusinessPartner,
BusinessPartnerFullName,
BusinessPartnerIsBlocked
};
}The using line imports the model that CAP generated from the downloaded EDMX file. The projection selects three fields, so the extension depends on only those. If SAP adds fields to the API later, nothing changes for you. This works because additions are compatible changes, while removal of a field would first go through deprecation.
How the pieces fit
The released API is a boundary. SAP can change everything behind it as long as the contract holds.
Common errors
- Using an API because it works. An unreleased OData service or RFC may respond fine today and still be unsupported. Working is not the same as released.
- Copying the whole entity. Projecting every field ties you to all of them. Select only what you need.
- Ignoring versions. A new API version can have different behavior. Pin the version you tested against.
- Never rechecking release state. An API that was released at design time may be deprecated a year later.
Exercise
A colleague finds an internal OData service in the system that returns exactly the data your extension needs. It works in testing. Why is it risky to use, and what should you check first?
Show answer
The service is not released, so SAP gives no compatibility promise and can change or remove it in an upgrade, which would break the extension. First check SAP Business Accelerator Hub for a released API that offers the same data, and use that one. If none exists, look for a released alternative or raise a request with SAP.
Exercise
Why does the CDS projection in this chapter list only three fields instead of the whole A_BusinessPartner entity?
Show answer
Each selected field is a dependency on the contract. Selecting only the fields you need limits the places a future API change can affect you, and it keeps your own service model small and stable.