Sub topic 3
The three extension options at a glance
This chapter assumes you know what an ERP system does, can read basic REST and OData calls, and understand cloud terms such as tenant and OAuth 2.0. It also assumes you have met the clean core principle and the idea of released APIs from the earlier chapters. Here you get a working model of the three ways to extend SAP S/4HANA Cloud, the typical use cases for each, and the errors teams make when they pick one.
Why there are three options
An extension adds behavior that the standard product does not provide. Clean core says you must add it without changing the SAP-delivered code and without relying on internals that SAP can change in an upgrade. SAP offers three extension options that satisfy this rule. They differ in where the extension runs, who builds it, and which tools it uses.
| Option | Runs | Typical builder | Typical tools |
|---|---|---|---|
| In-app (key user) extensibility | Inside S/4HANA | Business or key user | Fiori apps for custom fields, custom logic, and custom business objects |
| Developer extensibility | Inside S/4HANA | ABAP developer | ABAP Cloud, ABAP Development Tools in Eclipse |
| Side-by-side extensibility | On SAP BTP, outside S/4HANA | Cloud developer | CAP, SAP Build, Cloud Foundry, Kyma, ABAP environment |
The first two are called on-stack extensions, because the code runs on the same stack as the S/4HANA application. The third is an off-stack extension, because it runs on a separate platform and talks to S/4HANA through APIs and events.
In-app extensibility
In-app extensibility (also called key user extensibility) lets a trained business user change the system through delivered Fiori apps. No code deployment or transport to a separate system is needed in the usual case.
Typical tasks:
- Add a custom field to a business object, then show it on a UI, in a form, or in an email template.
- Write small custom logic, for example a validation that runs when a document is saved.
- Create a custom business object with its own table and a generated UI.
- Adjust UI layout, add custom analytical queries, or define custom CDS views for reporting.
Strengths: it is fast, it is cheap to maintain, and SAP keeps the extension compatible across upgrades because the tools only expose supported extension points. The limits are real, though. You can only extend where SAP has opened an extension point, the logic is small in scope, and you cannot call arbitrary external systems with complex flows.
Developer extensibility
Developer extensibility lets ABAP developers write full ABAP code inside the S/4HANA system, restricted to the ABAP Cloud language version. ABAP Cloud limits the code to released APIs, released objects, and the cloud-ready subset of the language. Static checks in ABAP Development Tools enforce this at development time, so a call to an unreleased function module is an error, not a warning you can ignore.
Typical tasks:
- Implement a custom business logic hook, such as a BAdI implementation, that must run in the same transaction as the standard process.
- Build a custom RAP business object (ABAP RESTful Application Programming Model) with its own persistence and a Fiori UI.
- Read or process large data volumes close to the database, where a network hop to another system would be too slow.
Strengths: the code runs in the same logical unit of work as the core, so you get transactional consistency and low latency. The cost is that you must have ABAP skills, and your extension shares the lifecycle and resources of the S/4HANA system. A badly written extension can use up work processes or database capacity that the core also needs.
Side-by-side extensibility
Side-by-side extensibility builds an independent application on SAP Business Technology Platform (SAP BTP). The application reads and writes S/4HANA data only through released APIs, and it can react to business events published by S/4HANA. Because it is a separate application, it has its own release cycle, its own scaling, and its own technology choices.
Typical tasks:
- Build a new application for a separate user group, such as a supplier self-service portal that shows data from S/4HANA.
- Combine data from S/4HANA with other systems, for example a partner review app that merges business partner data with a compliance service.
- Run long-running or compute-heavy work, such as a machine learning scoring job, that should not load the ERP system.
- Integrate with third-party systems on a schedule or on events.
- Use BTP services that S/4HANA does not provide, such as workflow, document processing, or AI services.
The rest of this tutorial follows this option in detail. The three code examples in the Topic Spine show the shape of it: a CAP project registers the released Business Partner API as a remote service, exposes a read-only projection, and forwards reads to S/4HANA.
{
"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"
}
}
}
}
}You do not need to understand every line yet. Notice that the extension names a destination and a released API path. It never contains S/4HANA table names or internal function calls. Later chapters cover destinations and CAP in depth.
Comparing the options
The right option depends on a few properties of the requirement.
| Question | In-app | Developer | Side-by-side |
|---|---|---|---|
| Needs the same database transaction as the core? | Yes, for simple cases | Yes | No, it is eventually consistent |
| Needs a new UI for non-SAP users? | Limited | Possible with RAP | Best fit |
| Needs non-ABAP skills or libraries? | No | No | Yes |
| Affects core performance if poorly built? | Little | Yes | Little, apart from API load |
| Can run when S/4HANA is in maintenance? | No | No | Partly, with its own data |
| Who maintains it? | Key user | ABAP team | Cloud development team |
Two points in the table deserve attention. First, side-by-side extensions work with copies and references of core data, not with the core's own transaction. If you update a business partner in S/4HANA and also write to your own database in one request, you have two systems and no shared commit. You need to design for failure, for example with retries and idempotent calls. Second, availability is coupled in one direction. If S/4HANA is down, a side-by-side app that needs live data cannot serve it, unless it keeps its own copy.
Common errors
These mistakes appear again and again when teams first choose an option.
- Choosing by team skills alone. An ABAP team that builds everything as developer extensions ends up with UIs and integrations that would be easier on BTP. A cloud team that builds everything side-by-side ends up with chatty APIs for logic that belongs in the core transaction.
- Using side-by-side for a simple field. A custom field and a validation are in-app tasks. A full BTP application for them adds deployment, authentication, and monitoring cost with no benefit.
- Using in-app or developer extensions for heavy external logic. Calling slow external services from inside a core transaction blocks work processes and users.
- Copying core data into the extension by default. Replicating data creates synchronization problems and storage of personal data in a second place. Read through the API when you can, as the third code example does by forwarding the query to the remote service, and replicate only when you need offline access or performance.
- Assuming "on BTP" means clean. A side-by-side extension that calls an unreleased or private endpoint, or uses a technical user with excessive rights, still breaks clean core. The location of the code does not decide this. The interface it depends on does.
- Mixing options without a boundary. A common healthy pattern combines them: a custom field added in-app, exposed through a released API, and consumed by a side-by-side app. Problems start when the pieces depend on each other's internals.
A short selection routine
Use this order of questions as a first pass. A later chapter gives the full decision framework.
- Can a key user meet the need with a custom field, simple logic, or a custom business object? If yes, use in-app.
- Does the logic need to run inside the core transaction, or process large data near the database? If yes, use developer extensibility.
- Does it need a separate UI, other systems, other technologies, or independent scaling? If yes, use side-by-side.
- In every case, confirm that each dependency is a released API, event, or extension point.
Exercise
A finance team wants a new approval screen for external auditors, who have no S/4HANA user. The screen shows invoice data from S/4HANA and also pulls data from an audit-management SaaS tool. Which extension option fits best, and why? Name one design concern you must handle.
Show answer
Side-by-side extensibility on SAP BTP fits best. The audience is external, the UI is new, and the app combines S/4HANA data with another system, none of which suit in-app or developer extensibility. It must read invoice data only through released APIs. A design concern to handle is that there is no shared transaction with S/4HANA, so writes need retries and idempotent calls. Another valid concern is how to authenticate external users and limit the S/4HANA data they can see.
Exercise
A team adds a BTP application that reads S/4HANA data by calling an unreleased internal OData service through a destination. Is the extension clean core compliant because it runs on BTP? Explain.
Show answer
No. Running on BTP does not make an extension clean. Clean core depends on the interfaces used. An unreleased internal service can change or disappear in an upgrade without notice, so the extension can break. The team should switch to a released API, or request one from SAP if none exists.