Sub topic 7
Developer Extensibility with ABAP Cloud
This chapter assumes you know what clean core means, what a released API is, and how the three extension options differ at a high level. It also assumes you can read basic ABAP or similar code.
What developer extensibility is
Developer extensibility lets ABAP developers build extensions that run inside the SAP S/4HANA system, written in a restricted, upgrade-safe language version called ABAP Cloud. It sits between in-app extensibility (key users, no code) and side-by-side extensions (separate BTP application).
Choose it when the extension needs ABAP code that runs in the same transaction as the core, for example a validation during posting, or when it needs direct, fast access to core data.
The ABAP Cloud rules
ABAP Cloud is a development model, not a separate product. Three rules define it:
- Released APIs only. Your code may use only objects that SAP has released for cloud development, marked with the release contract C1 (use in ABAP Cloud). Anything else is rejected by the syntax check.
- Restricted language version. The language version "ABAP for Cloud Development" removes statements that bypass the contract, such as direct access to arbitrary database tables and dynpro-based UI.
- Modern tooling and frameworks. You develop in ABAP Development Tools (ADT) in Eclipse. You build with the ABAP RESTful Application Programming Model (RAP) and CDS views, not classic reports and function modules.
Because the compiler enforces these rules, an extension that passes the check does not depend on internals that SAP may change in an upgrade.
Where the code lives
You have two main places to put ABAP Cloud code:
| Option | Where it runs | Typical use |
|---|---|---|
| On-stack developer extensibility | Inside the SAP S/4HANA system, in a software component of type "Development" | Logic tightly coupled to core transactions |
| Embedded Steampunk | Inside the S/4HANA Cloud system, same idea with the ABAP Cloud language version | Same use cases in the public cloud edition |
| ABAP environment on BTP | In a separate BTP system | Larger, loosely coupled applications (see the BTP runtimes chapter) |
Both rely on the same language rules, so skills and code are portable between them.
Extension points you can use
You do not change core code. You plug into places SAP has prepared:
- BAdIs released for ABAP Cloud, which let you add logic at defined points in a process.
- Custom CDS views and RAP business objects that read released CDS views.
- Custom business objects and fields that you add alongside key user tools.
A minimal example
The class below implements a released BAdI-style contract and reads only a released CDS view. The names are illustrative. Check the Released Objects view in ADT for the exact BAdI in your release.
CLASS zcl_check_partner_name DEFINITION
PUBLIC FINAL CREATE PUBLIC.
PUBLIC SECTION.
METHODS is_name_valid
IMPORTING iv_partner TYPE i_businesspartner-businesspartner
RETURNING VALUE(rv_valid) TYPE abap_bool.
ENDCLASS.
CLASS zcl_check_partner_name IMPLEMENTATION.
METHOD is_name_valid.
SELECT SINGLE businesspartnerfullname
FROM i_businesspartner
WHERE businesspartner = @iv_partner
INTO @DATA(lv_name).
rv_valid = xsdbool( sy-subrc = 0 AND lv_name IS NOT INITIAL ).
ENDMETHOD.
ENDCLASS.I_BusinessPartner is a released CDS view. If you replaced it with a table such as BUT000, the ABAP Cloud syntax check would fail.
Common errors
- Using an unreleased object. The error says the object is not released for ABAP Cloud. Look for a released successor in the object's release information instead of switching to classic ABAP.
- Treating on-stack code as free of upgrade impact. Released APIs are stable, but SAP can deprecate them. Check deprecation notices before each upgrade.
- Putting heavy, independent logic in the core. Long-running or externally facing logic belongs side-by-side, where it can scale and release separately.
Exercise
A team wants to add a validation that runs inside the posting transaction of a core business process, using data from a released CDS view. Which extension option fits, and which rule keeps it upgrade-safe?
Show answer
Developer extensibility with ABAP Cloud fits, because the logic must run in the same transaction as the core. Upgrade safety comes from the rule that the code may use only released APIs, which the ABAP Cloud syntax check enforces.