Sub topic 4
Classifying extensions with clean core levels A to D
This chapter assumes you know the clean core principle, the difference between released and unreleased interfaces, and the three extension options (in-app, developer, side-by-side) from earlier chapters. You should also be able to read simple JavaScript.
Why a classification model
"Keep the core clean" is hard to review as a slogan. Two teams can both say they follow it and still build very different extensions. One calls a released OData API. The other reads an SAP table directly through a custom RFC function module. Both run outside the standard code, and only one is safe for upgrades.
SAP's clean core levels give reviewers a shared scale. The scale rates an extension by what it depends on, not by where it runs. The levels are A, B, C and D. Level A is the cleanest.
The four levels
The levels describe the interfaces and objects an extension relies on.
| Level | Depends on | Upgrade stability | Typical examples |
|---|---|---|---|
| A | Released APIs and released extension points only | Stable contract, cloud-ready | A CAP app calling `API_BUSINESS_PARTNER`; ABAP Cloud code using released CDS views |
| B | Classic APIs and classic extension points that are documented and stable but not released | Generally stable, not formally cloud-ready | A BAPI called through RFC; an IDoc interface; a classic user exit |
| C | Internal SAP objects that are not released | No stability guarantee, may change or disappear | Calling an unreleased function module; selecting from SAP tables with custom code |
| D | Modifications and unsupported techniques | Breaks without warning | Changing SAP-delivered code; implicit enhancements into SAP programs; writing directly to SAP tables |
Level A
Level A extensions use only released APIs and released extension points. SAP commits to keep these interfaces compatible, or to follow a deprecation process with notice. An upgrade does not break a level A extension unless SAP removes a deprecated interface after the announced period.
Level A is the target for new development. Side-by-side extensions that use released OData or SOAP APIs and business events fit here. In-app extensions that use released extension points also fit. So does developer extensibility with ABAP Cloud, which can only use released objects.
Level B
Level B covers interfaces that existed before the released-API model, such as BAPIs, classic RFC function modules and IDocs. They are widely used, documented and usually stable. SAP has not formally released them for ABAP Cloud, so no contract commits SAP to keep them unchanged.
Level B is often an acceptable bridge. You may need it when no released API covers your process. Record each level B dependency and check regularly whether a released replacement exists.
Level C
Level C extensions use internal SAP objects with no stability promise. SAP can rename, change or delete these objects in any release, and the extension then fails. This includes custom code that reads standard tables directly.
A level C extension works until the upgrade breaks it. You do not find out beforehand unless your test coverage is good.
Level D
Level D means modifying SAP code or using techniques SAP does not support. Examples are overwriting standard programs and implicit enhancements that change standard behavior. These changes can be overwritten by upgrades. They can also cause support problems, because SAP may decline to analyze issues in modified code.
Level is a property of dependencies, not of location
A common mistake is to assume that moving code to SAP BTP makes it level A. It does not. Look at the interface the extension uses.
- A CAP service that reads
A_BusinessPartnerthrough the released OData API is level A. - The same CAP service calling a custom RFC function module through Cloud Connector depends on that function module. If the module reads unreleased tables, the extension is level C.
- An ABAP Cloud development that uses only released objects is level A, even though it runs in the S/4HANA system.
The extension from the earlier CAP example projects only released fields of API_BUSINESS_PARTNER. It depends on the API contract and not on S/4HANA internals, so it is level A:
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
};
}One extension, several dependencies
Real extensions rarely have a single dependency. Rate the whole extension by its weakest one. If an extension has nine level A calls and one level C call, it is level C.
A better practice is to rate each dependency and record the result. The following Node.js script shows the idea. It reads a list of dependencies and reports the lowest level.
const order = ['A', 'B', 'C', 'D']
const dependencies = [
{ name: 'API_BUSINESS_PARTNER', kind: 'OData V2', level: 'A' },
{ name: 'BAPI_SALESORDER_GETLIST', kind: 'RFC', level: 'B' },
{ name: 'ZREAD_VBAK', kind: 'custom RFC on SAP table', level: 'C' }
]
function overallLevel(deps) {
return deps
.map(d => d.level)
.reduce((worst, l) => (order.indexOf(l) > order.indexOf(worst) ? l : worst), 'A')
}
const result = overallLevel(dependencies)
console.log(`Overall level: ${result}`)
dependencies
.filter(d => d.level !== 'A')
.forEach(d => console.log(`Review: ${d.name} (${d.kind}) is level ${d.level}`))Running it prints Overall level: C, followed by one review line for the BAPI and one for the custom RFC. The overall level is the worst level found. The review lines show where to put the effort.
A classification flow
Work through these questions for each dependency.
The flow checks level D first, because a modification overrides any other property of the dependency.
How to find the level in practice
Several sources help you decide.
- API release state. Released objects carry a release contract. For ABAP, contract C1 allows use in ABAP Cloud development and key user extensibility. Contract C2 allows use as a stable interface between systems and components. Check the state in the ABAP Development Tools (ADT) properties of the object. For public interfaces, check SAP Business Accelerator Hub.
- The Cloudification Repository. SAP publishes a repository that maps classic objects to released successors. Use it to find a replacement for a level B or C dependency.
- ATC checks. The ABAP Test Cockpit can run checks that flag use of unreleased objects. Run them in your pipeline so violations surface before an upgrade does.
- Review of custom code. For existing extensions, inventory the custom code and its dependencies before you assign a level. Documentation alone is usually incomplete.
Common errors
- Rating by runtime. "It runs on BTP, so it is level A." The interface decides the level.
- Rating by the best dependency. The weakest dependency decides the overall level.
- Treating level B as permanent. Level B is usually a stage, not a goal. Plan a move to a released API when one appears.
- Hiding level C behind a wrapper. A custom OData service that wraps an unreleased table read is still level C. You have moved the problem, not removed it.
- Classifying once. SAP changes release states over time. A dependency can gain a release state or be deprecated, so re-check regularly.
Using levels in decisions
Levels support three decisions.
- Design. Target level A. Accept level B only when no released API covers the need, and record why.
- Review. Ask for the level of each dependency in design reviews and flag anything below A.
- Upgrade planning. Test level B, C and D extensions first, because they carry the upgrade risk. Level A extensions need regression tests but rarely break from interface changes.
Later chapters build on this scale in the decision framework and governance practices.
Exercise
A CAP application on SAP BTP reads sales orders through a released OData API (level A) and creates deliveries through a classic BAPI called via RFC (level B). A developer proposes adding a custom RFC function module that selects directly from an SAP table (level C) to speed up one report. What is the extension's overall level before and after the change, and what should the team do before accepting the change?
Show answer
Before the change the overall level is B, because the weakest dependency is the BAPI. After the change it is C, because the direct table read is the weakest dependency. Before accepting it, the team should look for a released API or CDS view that provides the same data, check the Cloudification Repository for a successor, and measure whether the performance problem is real. If the level C dependency stays, the team should document the reason, assign an owner, and add tests that run before each upgrade.
Exercise
A team moves custom logic from an S/4HANA system to a side-by-side application on SAP BTP. The logic still reads standard tables through a custom OData service in the S/4HANA system. Is the new extension level A?
Show answer
No. The side-by-side application depends on the custom OData service, which in turn reads unreleased tables, so the dependency is level C. Moving the code to SAP BTP does not change the level. To reach level A, the team must replace the table read with a released API or event.