Sub topic 1
What clean core means and why it matters
Prerequisites
This chapter assumes you have the following background:
- Basic familiarity with SAP S/4HANA business processes and the role of an ERP system.
- A general understanding of REST and OData APIs.
- Basic knowledge of cloud concepts such as services, tenants, and OAuth 2.0.
- Ability to read simple JavaScript or Node.js code.
You do not need to know ABAP. Later chapters cover the extension options in detail. This chapter builds the working model that the rest of the tutorial relies on.
The problem clean core solves
Every SAP S/4HANA customer eventually needs behavior the standard product does not provide. A company may need an extra approval step, a custom field on a sales order, or a report that combines ERP data with data from another system.
For decades the usual answer was to change the system itself. Teams modified SAP standard code, added custom code that read SAP database tables directly, and called internal function modules that SAP never promised to keep stable. This worked on the day it was built. It caused trouble on the day of the next upgrade.
SAP changes its internals between releases. It renames tables, restructures data models, and rewrites function modules. Custom code that depends on those internals can break without warning. The result is a familiar pattern:
- Upgrades become projects of months, because every custom object must be tested and often repaired.
- Customers postpone upgrades, so they miss new functions and security fixes.
- Cloud-style update cycles, with frequent releases, become impossible to follow.
Clean core is SAP's answer. It is a set of rules for extending S/4HANA so that upgrades stay predictable.
Definition of clean core
The clean core principle says: keep the S/4HANA system as close to standard as possible, and put every extension on a stable, supported interface. Concretely, an extension should follow these rules:
- It does not modify SAP-delivered objects.
- It uses only released APIs and released extension points. These are interfaces SAP has declared stable and has committed to keep compatible.
- It stays upgrade-stable, which means a new S/4HANA release should not force you to change it.
- It is kept separate from the core where possible, so it can be built, deployed, and updated on its own schedule.
Clean core is not a product you install. It is a design discipline, and SAP supports it with tools such as released-object lists, ABAP Cloud, and checks in ABAP Test Cockpit (ATC).
What "core" refers to
The core is the S/4HANA system with its standard business logic and data model. The extensions are everything you add around or on top of it. Clean core does not mean "no extensions". It means that the line between core and extension is explicit, and that the extension crosses that line only through stable contracts.
Core idea: depend on contracts, not on internals
A contract is a documented interface whose behavior the provider promises to preserve. A released OData API such as the Business Partner API is a contract. The database table that stores business partners is an internal detail.
If your extension reads the table directly, you depend on something SAP can change. If it calls the API, SAP must keep that API working, or version it and announce the change.
The diagram shows the difference in dependency direction.
When SAP upgrades the internals, it keeps the released API behaving the same. The clean extension keeps working. The non-clean extension may fail.
What clean core prevents
The benefits are practical, and each one maps to a specific upgrade problem.
| Upgrade problem | Cause | How clean core helps |
|---|---|---|
| Custom code breaks after an upgrade | Code uses internal tables or unreleased function modules | Code uses only released objects, which SAP keeps compatible |
| Long regression testing | Many modifications touch standard behavior | Fewer touchpoints, so less to retest |
| Delayed upgrades | Fear of breaking custom code | Upgrades become routine |
| Blocked cloud adoption | Modifications are not allowed in cloud editions | Extensions follow the rules cloud editions enforce |
| Hard to move to a new release or edition | Extensions are tangled with core internals | Extensions are portable because they rely on public contracts |
In SAP S/4HANA Cloud Public Edition, SAP updates the system on a fixed cadence and the customer cannot opt out. Modifications are not possible there at all. For this edition, clean core is enforced by the platform. In S/4HANA Cloud Private Edition and on-premise installations, nothing technical stops you from breaking the core, so clean core becomes a matter of governance and discipline.
How extensions stay outside the core
Clean core allows three families of extensions. Later chapters cover each one in depth, so here is only the overview needed to place them.
- In-app extensibility. Key users and developers extend the system from inside it, using supported tools such as custom fields and custom logic.
- Developer extensibility. Developers write ABAP in the ABAP Cloud development model, which restricts them to released objects.
- Side-by-side extensibility. Applications run outside S/4HANA, typically on SAP Business Technology Platform (BTP), and talk to S/4HANA through released APIs and events.
This tutorial concentrates on the third family. Side-by-side extensions are the strongest form of separation, because the extension has its own runtime, its own release cycle, and no code inside the core.
A first look at a clean extension
Here is the shape of a side-by-side extension, so you can see what "depends only on a stable contract" looks like in code. The following fragment, from a CAP (SAP Cloud Application Programming Model) project, registers the released Business Partner OData V2 API as a remote service. The host and credentials come from a BTP destination named S4HC_BP, so no URL or password appears in the code.
{
"cds": {
"requires": {
"API_BUSINESS_PARTNER": {
"kind": "odata-v2",
"model": "srv/external/API_BUSINESS_PARTNER",
"credentials": {
"destination": "S4HC_BP",
"path": "/sap/opu/odata/sap/API_BUSINESS_PARTNER"
}
}
}
}
}Notice what the extension depends on: the name of a released API, and a destination that points to the system. It does not name any table, class, or function module of S/4HANA. You will build this project step by step in later chapters, so you do not need to run it now.
Common misconceptions and errors
Several mistakes come up repeatedly when teams first apply clean core.
- "Clean core means no custom code." It does not. Custom code is fine when it is built on released interfaces. The rule limits how you extend, not whether you extend.
- "Side-by-side is always clean." Not automatically. A BTP application that reads S/4HANA tables through a direct database connection, or that calls unreleased RFC function modules, depends on internals just as much as in-core code does. Location does not make an extension clean. The interface it uses does.
- "Released means unchanging." Released APIs can still evolve, but SAP follows a compatibility policy and deprecates before removing. You still need to watch deprecation notices.
- "We can clean up later." Each unreleased dependency you add makes the eventual cleanup larger. It is cheaper to choose the right interface the first time.
- "Clean core is only for new projects." Existing systems carry legacy modifications. Teams usually assess the existing custom code and remove or replace the worst offenders over time, which later chapters on levels and governance describe.
Trade-offs to expect
Clean core is not free. Knowing the costs helps you plan.
- Missing APIs. Not every business scenario has a released API yet. Sometimes you must wait, request one from SAP, or choose a different approach.
- Added architecture. A side-by-side extension means another system to run, secure, monitor, and pay for.
- Latency and data volume. Calling an API over the network is slower than an in-process database read. Extensions that need to process large amounts of core data must be designed with this in mind.
- Skills. Teams must learn new tools such as ABAP Cloud, CAP, and BTP services.
The return on these costs is upgrade stability, which usually outweighs them once a system lives through several release cycles.
Summary of the working model
Keep these points in mind as the tutorial continues:
- Clean core means extending S/4HANA without modifying it and without depending on internal objects.
- The stable contract is the released API or released extension point.
- Upgrades become predictable because SAP preserves those contracts.
- The principle is enforced technically in public cloud and by governance elsewhere.
- Clean core is about the interface you use, not about where the code runs.
Exercise
A team builds a Node.js application on SAP BTP that reads business partner data by connecting directly to the S/4HANA database tables through a database user. They say the extension is clean core because it runs outside S/4HANA. Is that correct? Name the problem and the change that would fix it.
Show answer
It is not correct. Running outside the core is not enough, because the extension depends on internal tables that SAP can change in any release, so an upgrade can break it. The fix is to replace the direct table access with the released Business Partner OData API (APIBUSINESSPARTNER), reached through a BTP destination. The extension then depends only on a stable contract.
Exercise
Give two reasons why clean core is easier to enforce in SAP S/4HANA Cloud Public Edition than in an on-premise system, and name what replaces enforcement in the on-premise case.
Show answer
In Public Edition, SAP applies updates on a fixed cadence and does not allow modifications, so the platform itself prevents many breaking changes. In an on-premise system, nothing technical stops direct table access or modifications. Governance replaces enforcement: coding guidelines, ATC checks, and review of extensions against the clean core rules.