Sub topic 9
Clean core and ABAP Cloud
This chapter assumes you know the three editions (Cloud Public Edition, Cloud Private Edition, on-premise) and the three extensibility models from the previous chapter: in-app, developer, and side-by-side. You should also be able to read basic ABAP. The chapter covers what "clean core" means, how ABAP Cloud enforces it in code, and where the rules are strict or relaxed in each edition.
What clean core means
Clean core is a principle for keeping the standard SAP software separate from your own changes. You do not modify SAP objects. You do not read or write SAP internal tables directly. You extend the system only through interfaces that SAP has published and promised to keep stable.
The reason is upgrades. SAP changes internal tables, function modules, and classes between releases and does not announce every change. Code that depends on those internals can break when the system is upgraded. Code that depends only on released interfaces keeps working, because SAP treats a released interface as a contract.
Clean core has four dimensions:
| Dimension | Clean practice | Typical violation |
|---|---|---|
| Extensibility | Use released extension points and APIs | Modifying SAP source code |
| Data | Read data through released CDS views | `SELECT` from classic tables such as MARA |
| Processes | Stay close to the standard process | Rebuilding a standard process in custom code |
| Operations | Keep the system current with releases | Staying many releases behind |
Released objects and the release contract
A released object is an SAP object that carries a release state. The state tells you which use is allowed and how stable the object is. The most common state for custom code is "Use in Cloud Development" (also called C1, "use system-internally"). It is the state that ABAP Cloud code can depend on.
Other states cover stable use as a key user extension (C0) or as a remote API (for example, an OData service). SAP can still add fields to a released object, but it does not remove or change the meaning of existing elements without a deprecation period.
You can see an object's release state in ADT (ABAP Development Tools for Eclipse) on the object's API State tab. Objects with no release state are internal. Do not use them in ABAP Cloud code.
ABAP Cloud
ABAP Cloud is the development model that enforces clean core in code. It has three parts:
- A restricted ABAP language version, called "ABAP for Cloud Development". It removes statements that are unsafe or tied to the classic runtime, such as dynpro screens and many older statements.
- Access limited to released APIs. Your code can call only objects with a suitable release state.
- Modern development tools and artifacts: ADT, CDS views, RAP (the ABAP RESTful Application Programming Model), and ABAP unit tests.
The language version is a property of the development object. Every package and class declares it. When the version is "ABAP for Cloud Development", the syntax check rejects calls to unreleased objects. This check is what makes the rule enforceable instead of a guideline.
A compliant example
The following console class uses only released APIs. It runs on any edition that supports ABAP Cloud.
CLASS zcl_edition_probe DEFINITION PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES if_oo_adt_classrun.
ENDCLASS.
CLASS zcl_edition_probe IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
out->write( cl_abap_context_info=>get_system_date( ) ).
out->write( cl_abap_context_info=>get_user_technical_name( ) ).
ENDMETHOD.
ENDCLASS.if_oo_adt_classrun lets you run the class from ADT with F9. cl_abap_context_info is a released class that replaces the classic system variable sy-datum and similar fields. The class works in Public Edition, Private Edition, and on-premise, because it depends on nothing outside the released set.
A non-compliant example
SELECT SINGLE matnr
FROM mara
INTO @DATA(lv_matnr).MARA is the classic material master table. It has no release state for cloud development. In classic ABAP on Private Edition or on-premise, this statement is allowed. In ABAP Cloud, the syntax check rejects it. In Public Edition, you cannot write it at all, because the system only offers the ABAP Cloud language version.
The clean replacement is a released CDS view, such as I_Product, which exposes product master data through a stable interface. Check the API State tab for the exact view and release state in your release.
How strict each edition is
The principle is the same everywhere. The enforcement differs.
| Aspect | Public Edition | Private Edition | On-premise |
|---|---|---|---|
| Classic ABAP language version | Not available | Available | Available |
| ABAP Cloud | Required | Optional, recommended | Optional, recommended |
| Direct access to SAP tables | Blocked | Technically possible | Technically possible |
| Modifications of SAP code | Not possible | Technically possible | Technically possible |
| Developer extensibility | Embedded Steampunk-style ABAP Cloud only | ABAP Cloud plus classic | ABAP Cloud plus classic |
| Consequence of violating clean core | Not applicable, system prevents it | Upgrade effort grows | Upgrade effort grows |
In Public Edition, SAP controls the tenant and upgrades it on a fixed schedule, so the platform must forbid anything that could break an upgrade. Clean core is enforced by the system.
In Private Edition and on-premise, clean core is a discipline. The system lets you break it, and the cost shows up later as longer upgrade projects, more regression testing, and delayed adoption of new releases.
In the diagram, solid lines are stable paths. Dotted lines are paths that exist only in classic ABAP and can break during an upgrade.
Three-tier model for custom code
For Private Edition and on-premise, SAP's guidance sorts custom code into tiers so you can migrate toward clean core step by step. This is a working model, not a product feature.
- Tier 1: ABAP Cloud. New code that uses only released APIs. It is upgrade-safe and can move between editions.
- Tier 2: Classic extensions using released wrappers. Code that needs unreleased functionality but reaches it through a wrapper you own and that is released for cloud use. The wrapper isolates the risk in one place.
- Tier 3: Classic ABAP. Legacy code that uses unreleased objects directly. Keep it small and well documented, and plan to retire it.
Wrappers matter when SAP has not yet released a needed function. You write one class that calls the unreleased function, and you mark that class as released for cloud use. If SAP changes the internal function, you fix one wrapper instead of every caller.
Tools that support clean core
- ATC (ABAP Test Cockpit) with the cloud readiness checks reports calls to unreleased objects in existing code.
- ADT API State tab shows the release state of an object while you develop.
- Custom Code Migration app assesses custom code before a system conversion.
- Released object lists (the "Released Objects" repository on SAP's GitHub and in the help portal) let you search for the successor of an unreleased object.
Common errors
- Assuming Private Edition means anything goes. You can use classic ABAP there, but each unreleased call is future upgrade work.
- Treating a wrapper as a permanent fix. A wrapper hides the problem. If SAP releases an official API, move to it.
- Reading tables because the data is "just master data". Table structures change. A released CDS view is stable even when the underlying tables change.
- Mixing language versions in one package. Keep ABAP Cloud and classic code in separate packages so the checks stay clear.
- Putting heavy logic in side-by-side apps just to stay clean. Clean core does not mean everything leaves the ERP. Use developer extensibility for logic that needs to be transactionally close to the data, and side-by-side on SAP BTP for independent apps.
Decision criteria
Choose ABAP Cloud for new development in every edition. It keeps code portable if you later move from on-premise to Private Edition, or from Private to Public. Keep classic code only where no released alternative exists, isolate it in a wrapper, and track it for removal.
Exercise
A team on Private Edition needs the list of product numbers. A developer proposes SELECT matnr FROM mara. Explain whether the system will allow it, why it is still a problem, and what to use instead.
Show answer
Private Edition still offers the classic ABAP language version, so the statement will run. It is a problem because MARA has no release state for cloud development. SAP can change the table in an upgrade, which would break the code and add regression testing and rework. Use a released CDS view such as I_Product in ABAP Cloud code, after checking its API State in ADT.
Exercise
Why is clean core enforced by the system in Public Edition but only recommended in Private Edition and on-premise?
Show answer
In Public Edition SAP operates a multi-tenant system and upgrades it on a fixed schedule for all customers. Code that depends on internals would break those upgrades, so the platform only offers the ABAP Cloud language version and released APIs. In Private Edition and on-premise the customer controls upgrade timing and the classic language version is available, so clean core is a discipline whose cost appears as upgrade effort.