SAP defines three distinct extensibility tiers. Determining whether an extension belongs in Tier-1 In-App vs. Developer Extensibility is the first governance gate of Clean Core architecture:
| Dimension | Tier-1: Key-User In-App | Tier-1: Developer Extensibility | Tier-3: Side-by-Side (BTP) |
|---|---|---|---|
| Target Persona | Business Key Users, Functional Consultants | SAP Professional Developers, ABAP Architects | Cloud Developers, Full-Stack Engineers |
| Tooling | SAP Fiori Custom Fields & Custom Logic Apps | ABAP Development Tools (ADT) in Eclipse | SAP Business Application Studio (BAS), VS Code |
| Language / Runtime | Restricted ABAP (Cloud Language Version 2) | ABAP Cloud (Language Version 5) | Node.js (CAP), Java (Spring Boot / CAP), Python |
| Namespace | YY1_* prefix (strictly enforced) |
Customer Z* / Y* or Partner namespace |
Custom microservice domain / CF Space |
| Lifecycle / Transport | Export / Import Software Collection (Fiori) | Standard Transport Organizer (Workbench Request) | Git CI/CD Pipeline (Cloud Transport Mgmt) |
| Clean Core Score | 100% (Level A) — Upgrade-safe zero regression | 100% (Level A) — Contract-based releases | 100% (Level A) — Complete physical decoupling |
In SAP S/4HANA, custom fields cannot be arbitrarily attached to database tables via classic APPEND STRUCTURE. Instead, SAP provides pre-engineered Business Contexts that bundle:
VBAK, VBAP, BKPF, BSEG, BUT000).| Business Context Identifier | Domain / Entity | Underlying Tables Extracted | Available Extensibility Points |
|---|---|---|---|
SALESDOCUMENT |
Sales Order Header | VBAK |
Fiori VA01/02/03, OData API_SALES_ORDER, Cloud BAdI |
SALESDOCUMENTITEM |
Sales Order Item | VBAP |
Item UI, Pricing Determination, BAdI Calculations |
PURCHASINGDOCUMENT |
Purchase Order Header | EKKO |
ME21N/22N/23N Fiori equivalents, Cloud BAdI Validation |
PURCHASINGDOCUMENTITEM |
Purchase Order Line Item | EKPO |
Accounting derivation, Confirmation interfaces |
BUSINESS_PARTNER |
Business Partner Master | BUT000 |
Manage Business Partner Fiori App, BP SOAP/OData API |
PRODUCTMASTER |
Product / Material Master | MARA |
Manage Product Master Data, Stock valuation views |
Key-User Custom Logic executes in a sandboxed, security-hardened environment known as Restricted ABAP (Language Version 2). This guarantees that custom business logic cannot crash the application server, corrupt memory, or introduce SQL injection vulnerabilities.
INSERT, UPDATE, DELETE), triggers database commits (COMMIT WORK), opens classic dynpro screens (CALL SCREEN), or accesses unreleased standard tables is completely disabled at compile time.
| Category | Permitted Statements (Allowed) | Forbidden Statements (Blocked at Syntax Check) |
|---|---|---|
| Database Operations | Read-only SELECT on C1-released CDS Views; READ ENTITIES OF (EML) on released RAP BOs. |
INSERT, UPDATE, MODIFY, DELETE, EXEC SQL, Open SQL on raw tables. |
| Transaction Control | None. Transaction commit is managed strictly by the caller framework. | COMMIT WORK, ROLLBACK WORK, CALL TRANSACTION, SUBMIT. |
| Flow Control & Logic | IF / ELSEIF / ENDIF, CASE / WHEN, LOOP AT ... INTO, CHECK, RETURN. |
GOTO, CALL FUNCTION 'BAPI_*', CALL SCREEN, LEAVE TO TRANSACTION. |
| Internal Tables | APPEND, INSERT INTO TABLE, READ TABLE ... WITH KEY, SORT, DELETE ... WHERE. |
Obsolete Header Lines, Tables with obsolete types, uncontrolled pointer manipulation. |
| String & Math | CONCATENATE, SPLIT, CONDENSE, TRANSLATE, built-in string functions. |
Direct memory manipulation, EXPORT / IMPORT MEMORY ID. |
| System Information | cl_abap_context_info=>get_user_technical_name( ), get_system_date( ), get_system_time( ). |
Direct read/write on system variables (sy-uname, sy-datum directly modified). |
The following is a production-grade implementation of an S/4HANA Key-User Custom Logic enhancement for the SALESDOCUMENT context, calculating order prioritization and validating compliance:
" Business Context: SALESDOCUMENT
" Extension Point: BAdI Definition 'SD_SLS_MODIFY_HEAD' (Sales Order Header Modification)
" Language Version: Restricted ABAP (Language Version 2)
CLASS zcl_keyuser_sales_logic DEFINITION PUBLIC FINAL CREATE PRIVATE.
" In Key-User Custom Logic, class scaffolding is handled by SAP Fiori
ENDCLASS.
" Implementation logic injected into Custom Logic Fiori App:
DATA: lv_user TYPE syuname,
lv_sys_date TYPE sydatum,
lv_amount TYPE p DECIMALS 2.
" 1. Retrieve runtime context via released system utility
lv_user = cl_abap_context_info=>get_user_technical_name( ).
lv_sys_date = cl_abap_context_info=>get_system_date( ).
" 2. Guard Clause: Skip execution if sales order is already locked for billing
CHECK salesdocument-billingblockstatus IS INITIAL.
" 3. Custom Field Derivation (YY1_ApprovalRequired_SDH)
" If net amount exceeds threshold, enforce mandatory VP approval flag
IF salesdocument-totalnetamount > 50000.
salesdocument-yy1_approvalrequired_sdh = abap_true.
salesdocument-yy1_approvernotes_sdh = 'High-value order exceeding 50,000 EUR threshold'.
ELSE.
salesdocument-yy1_approvalrequired_sdh = abap_false.
ENDIF.
" 4. Audit Trail Population
salesdocument-yy1_lastauditedby_sdh = lv_user.
salesdocument-yy1_lastauditeddate_sdh = lv_sys_date.
" 5. Validation Check: Raise business message if delivery block missing on restricted accounts
IF salesdocument-yy1_customerrisklevel_sdh = 'HIGH' AND salesdocument-deliveryblockreason IS INITIAL.
" Raise message into SAP Fiori message log
messages-add_message(
iv_msgid = 'ZSD_CLEAN_CORE'
iv_msgno = 001
iv_msgty = 'E'
iv_msgv1 = 'High-risk customer requires an active Delivery Block reason'
).
ENDIF.
Creating a custom field via the Custom Fields app is only the first step. To make it functional, it must be published through the enablement pipeline:
YY1_ prefix and provisions the field in the underlying CDS views.Use this architectural decision tree to determine the correct placement for any incoming extension request:
Extensibility Placement Gate:
Explore free client-side interactive utilities to accelerate your S/4HANA migration: