Sub topic 16
Extending S/4HANA While Keeping the Core Clean
This chapter assumes you know the module landscape, the deployment options, and how CDS views expose data for analytics. It covers how to add custom behavior to S/4HANA without making upgrades painful.
Why the core must stay clean
Every company needs some behavior that standard SAP does not provide. Older SAP systems met that need by modifying standard code or writing custom programs that read and wrote SAP tables directly. Those changes often broke during upgrades, because SAP could change the code or tables they depended on.
Clean core is the approach that avoids this. You keep the standard SAP code unmodified and add custom logic only through released, stable interfaces. SAP then promises that those interfaces keep working across upgrades.
Extension options
The options below run from least to most invasive. Prefer the first one that meets the need.
| Approach | Where it runs | Typical use |
|---|---|---|
| Key user extensibility (in-app) | Inside S/4HANA | Add a custom field to a Fiori app, a document, and a CDS view. Create a custom business logic rule. |
| Developer extensibility (on-stack) | Inside S/4HANA, using ABAP Cloud | Write custom ABAP that uses only released objects. |
| Side-by-side extensibility | On SAP Business Technology Platform (BTP) | Build a separate app or workflow that talks to S/4HANA through APIs and events. |
Availability depends on the deployment option. Cloud Public Edition allows only the clean-core approaches above. Private Edition and on-premise systems also allow classic custom code, but following clean-core rules keeps their upgrades cheaper.
Released interfaces
A released object is one that SAP has marked as stable for customer use. It has a release contract, for example "use in ABAP Cloud development" or "use as a remote API". ABAP Cloud enforces this. Your custom code can only call released objects, and the syntax check rejects other access.
Here is the practical effect. The earlier examples in this tutorial queried ACDOCA and VBAK directly. That is fine for learning how the data is stored. In ABAP Cloud, you would read the same data through a released CDS view, such as one of the I_ views that SAP publishes for journal entries or sales orders.
SELECT FROM I_SalesOrder
FIELDS SalesOrder, SoldToParty, SalesOrganization
WHERE SalesOrganization = '1010'
INTO TABLE @DATA(orders)
UP TO 100 ROWS.Check the release state of I_SalesOrder and its fields in your system before you rely on it. Release states differ between versions and editions.
Common errors
- Reading standard tables such as
VBAKdirectly in new code. Use released CDS views or APIs instead. - Using side-by-side extensions for logic that must roll back with the core transaction. A remote call cannot take part in the same database commit.
- Adding custom fields in several places by hand. Use the in-app custom fields tool so the field reaches the UI, the CDS views, and the APIs together.
- Copying standard objects to change them. The copy no longer receives SAP's fixes.
Exercise
A business wants a nightly synchronization of sales orders to an external marketing tool, and the sync does not need to be part of the order-saving transaction. Which extension approach fits best, and why?
Show answer
Side-by-side extension on SAP BTP. The logic is separate from the core transaction, so it can use released APIs or business events to get the orders. This keeps the S/4HANA core unmodified and lets the extension be upgraded on its own schedule.