Enhancements and BAdIs

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

A company that buys standard SAP software soon wants something the standard does not do: a different approval rule for expense claims, an extra check before a document is saved, a field filled from another system. The tempting way is to open SAP’s program and edit it, and that is called a modification. The next upgrade then overwrites the edit, or forces somebody to merge it by hand. Enhancements are the planned alternative: SAP, or any developer, leaves marked places in the code where other code can be attached, and your code lives in your own objects, separate from the original. This page explains the old and the new forms of these marked places (customer exits, Business Transaction Events, the Enhancement Framework, and Business Add-Ins, BAdIs), shows how a BAdI is defined, implemented and called with GET BADI and CALL BADI, and says what is allowed in ABAP Cloud, where only released extension points can be used. It is written against Standard ABAP release 8.16, ABAP for Cloud Development release 9.20 (2608) and SAP S/4HANA 2025 FPS02 for the on-premise pages. Customer exits, enhancement points and sections, classic BAdIs and Business Transaction Events exist in classic Standard ABAP (on premise and Private Edition) only; kernel-based BAdIs work in classic ABAP and in ABAP Cloud, and the key user tools belong to the cloud products.

Before you read

Key terms

  • Modification: a change made directly in the source of an SAP object; it is lost or must be merged at an upgrade.

  • Enhancement: an addition to a repository object that changes its behavior without modifying it; it is a transport object of its own.

  • Enhancement option: a position in a repository object where an enhancement can be attached; it is explicit (placed by a developer) or implicit (always there).

  • Enhancement spot: the container in which explicit enhancement options, including BAdIs, are defined and made known to other developers.

  • Enhancement implementation: the container for the enhancements that implement the options of one enhancement spot.

  • BAdI: Business Add-In, an object-oriented enhancement option made of an interface, filters and settings; code plugs in as a class.

  • Fallback class: the class a single-use BAdI uses when no implementation matches.

  • Customer exit: an older, now obsolete enhancement technique with function modules, managed in the transactions SMOD and CMOD.

  • Release contract: the stability promise that makes an SAP object usable in ABAP Cloud; the contract named "extend" covers extension points.

  • ABAP for Key Users: the smallest ABAP language version, for enhancements made by key users in dedicated tools.

Where each technique stands

SAP has offered several enhancement techniques over the years, and a system in the field often has all of them. The ABAP Keyword Documentation’s glossary describes two of them in one sentence each: customer exits are an option provided by SAP for enhancing delivered programs without modifying them, managed by SAP in transaction SMOD, with customers grouping the enhancements they want into projects in transaction CMOD, and the glossary states that customer exits are obsolete and have been replaced by BAdIs and other enhancement points. It also notes that the classic BAdIs replaced the function module exits and were processed directly in the BAdI Builder.

Technique What it is Today

Modification

Editing SAP source directly; registered with the Software Change Registration (SSCR) procedure.

Against the clean core idea (see below); use an enhancement instead.

Customer exit

Blank function modules that SAP calls from standard programs; projects in CMOD, exits listed in SMOD.

Obsolete according to the glossary; you meet it in old systems and may still have to maintain it.

Business Transaction Event (BTE)

A function module registered for an event in transaction FIBF, mostly in financial accounting.

Older technique; still described in the SAP S/4HANA on-premise 2025 pages.

Enhancement point or section

Explicit source code plug-in positions, plus implicit ones, of the Enhancement Framework.

Classic Standard ABAP; not in the ABAP Cloud keyword documentation.

Classic BAdI

BAdI built with the BAdI Builder (transactions SE18 and SE19), called through a factory method.

Legacy; can be migrated to a kernel-based BAdI.

Kernel-based BAdI

BAdI of the Enhancement Framework, called with GET BADI and CALL BADI.

The standard way; works in ABAP Cloud when the BAdI is released.

Key user logic extension

Low-code extensions made in web-based key user tools.

For cloud products and small, guided changes.

Source: Keyword Documentation for ABAP Cloud: ABAP Technology Glossary (entries "customer exit", "BAdI" and "BAdI Builder") and ABAP Platform: Business Add-Ins (BAdIs). The two cells about the status of Business Transaction Events and key user tools restate the sections below; the table is this page’s summary, not a table of SAP’s.

flowchart TD Q["Standard behavior must change"] --> M{"Is there a released or documented extension point?"} M -- "BAdI, kernel-based" --> B["Implement the BAdI: new class, no change to SAP source"] M -- "Enhancement point or section, classic ABAP" --> P["Source code plug-in in an enhancement implementation"] M -- "Customer exit or BTE, old module" --> L["Function module in a CMOD project or a FIBF entry (legacy)"] M -- "Only a code change would work" --> X["Modification: ties the system to every upgrade"] B --> C["Clean core friendly"] P --> D["Classic only, adjust at upgrade if incompatible"] L --> D X --> E["Avoid; replace with an enhancement"]

Source: ABAP Platform: Enhancement Concept. The diagram is this page’s decision aid built from that page and the glossary entries above.

The Enhancement Framework

The Enhancement Framework is the common mechanism behind all new-style enhancements. Its documentation says it provides a technology for enhancing source code units without modifying them, by offering enhancement options in development objects, which work like hooks. When you assign an enhancement to an option, the enhancement is processed at run time when the control flow reaches the option, and it behaves as if it belonged to the enhanced object, while as a transport object it does not.

The documentation names the advantage over a modification: an upgrade replaces all SAP objects with new versions, so every modification disappears and has to be adjusted whether or not the underlying object changed. Enhancements are separate transport objects in customer packages and are never overwritten. After an upgrade you adjust only the enhancements that no longer fit, for example because an enhanced object was deleted, and the framework’s tools tell you which ones.

Four concepts carry the rest of the page.

  • An enhancement option is a position in a repository object. Implicit options exist without preparation; explicit options have to be inserted in the source or defined, in a central initial system, by the developer who wants to be extensible.

  • An enhancement spot is a container for explicit options. A spot is also the transport object of a BAdI: there is no standalone BAdI, exactly like a method always belongs to a class.

  • An enhancement implementation element holds the actual enhancement, for example the source code to add.

  • An enhancement implementation is the container for such elements. When you implement a BAdI, you first assign an enhancement implementation to the spot, then create the BAdI implementation inside it.

The framework’s tools are the Enhancement Builder in the ABAP Workbench and, for BAdIs in current systems, ADT. The Switch Framework can switch an enhancement on or off by package; the keyword pages for GET BADI and ENHANCEMENT-POINT refer to switch states "on", "stand-by" and off, and a source code plug-in or BAdI implementation without an assigned switch behaves as if its switch is on.

flowchart LR subgraph Definition["Definition side, in the system that offers the option"] O["Explicit enhancement option"] --> S["Enhancement spot"] end subgraph Implementation["Implementation side, in the follow-on system"] E["Enhancement implementation element"] --> I["Enhancement implementation"] end S -- "implemented by" --> I IM["Implicit enhancement option"] -. "no spot needed" .-> E

Enhancement points and sections in source code

For plain source code, the framework offers two kinds of enhancement options. Implicit ones need no preparation. The documentation lists predefined positions: the beginning and the end of every form routine, function module and method, the end of a report or include, the end of a local structure, and the end of the sections of a local class. In the ABAP Editor they are shown with the path Edit, Enhancement Operations, Show Implicit Enhancement Options, and you enhance them with source code plug-ins. Explicit ones are placed by a developer with two statements.

  • ENHANCEMENT-POINT defines a position at which a plug-in can add code. Without the addition STATIC the enhancement is dynamic and meant for executable code; with STATIC it is meant for data declarations.

  • ENHANCEMENT-SECTION …​ END-ENHANCEMENT-SECTION turns a section of the program into an option that a plug-in can replace. If no plug-in is found, the original section runs. The section may only contain complete control structures and processing blocks.

Both statements need at least one enhancement spot after the keyword SPOTS, and the identifier must be unique in the compilation unit. The addition INCLUDE BOUND ties the option to an include program.

" An option that other code can be added to
ENHANCEMENT-POINT zep_exp_before_save SPOTS zes_exp_claim.

" A section that a plug-in can replace
ENHANCEMENT-SECTION zes_exp_limit SPOTS zes_exp_claim.
  limit = 1000.
END-ENHANCEMENT-SECTION.

Source: Keyword Documentation for Standard ABAP: ENHANCEMENT-POINT, Keyword Documentation for Standard ABAP: ENHANCEMENT-SECTION and ABAP Platform: Explicit Enhancement Options in ABAP Source Code. The names zep_exp_before_save, zes_exp_claim and zes_exp_limit and the variable limit are invented for this page. This listing requires an SAP system; not run here.

The documentation advises that these statements are normally created with the Enhancement Builder and cannot be deleted by editing afterwards. It also warns that STATIC on ENHANCEMENT-SECTION replaces declarations instead of adding to them, so it is to be used with maximum caution, and that application developers at SAP should not use it at all because the change would be active in the whole customer system. A source code plug-in sits between the statements ENHANCEMENT and ENDENHANCEMENT; it is created in the Enhancement Builder by assigning an enhancement implementation, not typed from scratch.

Where this applies: these statements and the implicit options belong to classic Standard ABAP. The ABAP Cloud keyword documentation has no page for ENHANCEMENT-POINT or ENHANCEMENT-SECTION; in ABAP Cloud you extend through BAdIs and the other released extension points described at the end of the page.

The new BAdI: interface, filters and settings

A BAdI is, in the words of the platform documentation, an object-oriented enhancement option, a hook for an object plug-in. The idea is that SAP (or you) defines an interface and calls its methods at a chosen position, and anyone can later supply a class that implements the interface; at run time the system finds and calls the right class. A BAdI consists mainly of the BAdI interface with its methods and a set of filters. The settings of the definition are:

  • Single or multiple use. A single-use BAdI allows one implementation in an internal session and requires one to exist. A multiple-use BAdI allows any number of implementations, including none. A BAdI is single-use by default. Because all implementations of a multiple-use BAdI are called and nobody could say which result wins, its methods must not have EXPORTING or RETURNING parameters; CHANGING parameters are allowed, since each implementation then works on the value the previous one left.

  • Filters. A filter is a named value that selects which implementations are used, for example a country. Callers pass values for every filter when they create the BAdI object.

  • Fallback class. For a single-use BAdI, the class used when no implementation matches. The documentation recommends always specifying one, and implementing it in the same system as the BAdI; without it, GET BADI raises an exception when nobody has implemented the BAdI yet.

  • Instantiation. The object plug-ins (the instances of the implementation classes) are either created anew at each GET BADI, reused within the internal session, or tied to a context object that implements the tag interface IF_BADI_CONTEXT.

The BAdI interface must include the tag interface IF_BADI_INTERFACE; the tools add it when they create the interface. The name rules recommend the prefix BADI_, or ZBADI_ in the customer namespace. BAdIs share their namespace with global classes, interfaces and data types.

The running example

The examples use an approval rule for the expense claims of the running example, the table ZEXP_CLAIM of Database Tables and Structures with its fields client, claim_id, employee_id, status, currency_code, total_amount and the included structure zexp_s_audit. The page does not extend the table. The objects named below do not exist in any SAP system until somebody creates them; the names are invented for this page.

Object Role

ZES_EXP_CLAIM

The BAdI enhancement spot that contains the BAdI.

ZBADI_EXP_CLAIM_APPROVAL

The BAdI, single use, with one filter CURRENCY_CODE of type character and a fallback class.

ZIF_EXP_CLAIM_APPROVAL

The BAdI interface, with the method needs_approval.

ZCL_EXP_CLAIM_APPROVAL_FB

The fallback class, the default rule.

ZEI_EXP_CLAIM_APPROVAL

The enhancement implementation that contains one BAdI implementation for one currency.

ZCL_EXP_CLAIM_APPROVAL_USD

The implementation class of that BAdI implementation.

Creating the pieces in ADT

In ADT, the sequence is the one the ABAP cheat sheet on BAdIs walks through. You create a BAdI enhancement spot in a package, then choose Add BAdI in it to create the BAdI definition with its settings. On the definition you create the filter with Add Filter, then follow the Interface link to create the BAdI interface, then the Fallback Class link to create the fallback class. To implement the BAdI you create a BAdI enhancement implementation for the spot, choose Add BAdI Implementation in it, pick the BAdI definition, follow the Implementing Class link, and finally choose Add Filter Combination to set the filter value for which this implementation applies. In the classic Enhancement Builder (transaction SE80) the same objects exist as an enhancement spot with a Create BAdI function and an enhancement implementation with a BAdI implementation inside; the platform documentation walks through that variant. Several of the dialogs differ between ADT and the classic tool, so treat the sequence here as the outline and follow the dialog.

The interface and the classes

The interface includes IF_BADI_INTERFACE and declares the method. Because the BAdI is single-use, the method may have output parameters.

INTERFACE zif_exp_claim_approval PUBLIC.
  INTERFACES if_badi_interface.

  METHODS needs_approval
    IMPORTING im_amount         TYPE zexp_claim-total_amount
    EXPORTING ex_needs_approval TYPE abap_bool.
ENDINTERFACE.

Source: ABAP Cheat Sheet: Enhancements Using BAdIs and ABAP Platform: Building Your First BAdI. The interface name and the method are invented for this page. This listing requires an SAP system; not run here.

The fallback class implements the default rule. It also lists IF_BADI_INTERFACE, as the cheat sheet’s classes do.

CLASS zcl_exp_claim_approval_fb DEFINITION PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    INTERFACES if_badi_interface.
    INTERFACES zif_exp_claim_approval.
ENDCLASS.

CLASS zcl_exp_claim_approval_fb IMPLEMENTATION.
  METHOD zif_exp_claim_approval~needs_approval.
    ex_needs_approval = xsdbool( im_amount > 1000 ).
  ENDMETHOD.
ENDCLASS.

Source: ABAP Cheat Sheet: Enhancements Using BAdIs (class layout) and Keyword Documentation for ABAP Cloud: Enhancements Using BAdIs (fallback class). The class name and the limit of 1000 are invented for this page. This listing requires an SAP system; not run here.

An implementation, created by a person who wants a different rule for one currency, is an ordinary class that implements the same interface. Its link to the BAdI is not in the code but in the BAdI implementation, which carries the filter value USD.

CLASS zcl_exp_claim_approval_usd DEFINITION PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    INTERFACES if_badi_interface.
    INTERFACES zif_exp_claim_approval.
ENDCLASS.

CLASS zcl_exp_claim_approval_usd IMPLEMENTATION.
  METHOD zif_exp_claim_approval~needs_approval.
    ex_needs_approval = xsdbool( im_amount > 500 ).
  ENDMETHOD.
ENDCLASS.

Source: ABAP Cheat Sheet: Enhancements Using BAdIs and ABAP Platform: How to Implement a BAdI. The class name, the filter value and the limit of 500 are invented for this page. This listing requires an SAP system; not run here.

Calling a BAdI: GET BADI and CALL BADI

The program that offers the BAdI calls it in two steps, and the two statements are the whole runtime interface.

  • GET BADI creates a BAdI object, a handle for object plug-ins, and stores a reference to it in a BAdI reference variable. The static type of the variable is the BAdI itself, which tells the system which BAdI is meant. For a BAdI with filters, FILTERS supplies a value for every filter. A dynamic variant with TYPE (name) uses a variable of the type CL_BADI_BASE instead, with FILTER-TABLE for the filter values.

  • CALL BADI calls a BAdI method in all object plug-ins that the BAdI object refers to. The parameters are passed as in a method call.

When GET BADI runs, the system selects the implementation classes that are active, whose switch is on, and whose filter condition matches. If none matches, it looks for standard implementations, and then for the fallback class. For a single-use BAdI, exactly one class must remain, and otherwise an exception is raised (CX_BADI_NOT_IMPLEMENTED when there is none, CX_BADI_MULTIPLY_IMPLEMENTED when several remain after conflict resolution). For a multiple-use BAdI, any number from none up is fine, and CALL BADI then does nothing if there are none, much like raising an event nobody handles. The order in which several object plug-ins are called is the same for every CALL BADI; it can be fixed by implementing the predefined BAdI BADI_SORTER of the enhancement spot of the same name.

DATA claim_approval TYPE REF TO zbadi_exp_claim_approval.
DATA needs_approval TYPE abap_bool.

GET BADI claim_approval
  FILTERS currency_code = 'USD'.

CALL BADI claim_approval->needs_approval
  EXPORTING im_amount         = 750
  IMPORTING ex_needs_approval = needs_approval.

Source: Keyword Documentation for ABAP Cloud: GET BADI, Keyword Documentation for ABAP Cloud: CALL BADI and ABAP Platform: Building Your First BAdI (the pattern of a handle typed with the BAdI, then GET BADI and CALL BADI). The BAdI, its filter and the method are invented for this page. This listing requires an SAP system; not run here.

Reading it: with the implementation of the previous section active and a filter value USD, the amount 750 needs approval, because the USD rule has a limit of 500. With any other currency and no implementation for it, the system uses the fallback class, whose limit is 1000, and 750 does not need approval. No program source of the caller changed to get the second rule; that is the point of the technique.

Two further rules from the documentation:

  • A BAdI reference variable is only a handle. You cannot reach the BAdI object through it directly; it is used for CALL BADI, and otherwise like any object reference.

  • Methods added to a BAdI after an implementation was written are called as if they had an empty implementation, so a newer BAdI does not break an older implementation. Actual parameters of EXPORTING or RETURNING are initialized in that case. The addition DEFAULT on a method definition can state the behavior for an unimplemented method.

sequenceDiagram participant P as Program with the BAdI call participant R as ABAP runtime participant I as Implementation class, by filter participant F as Fallback class P->>R: GET BADI claim_approval FILTERS currency_code = 'USD' R->>R: select active implementations whose filter matches alt an implementation matches R-->>P: BAdI object refers to the implementation class else none matches R-->>P: BAdI object refers to the fallback class end P->>R: CALL BADI claim_approval->needs_approval alt implementation selected R->>I: needs_approval(im_amount) I-->>P: ex_needs_approval else fallback selected R->>F: needs_approval(im_amount) F-->>P: ex_needs_approval end

Source: Keyword Documentation for ABAP Cloud: GET BADI (selection order: active implementation, filter match, standard implementation, fallback class). The diagram leaves out the standard-implementation step and the exceptions.

Single-use BAdIs and the fallback class

The platform documentation sketches typical uses. A BAdI that needs one answer, such as a tax rate that SAP cannot know for every country, is defined single-use, and SAP supplies a default class; otherwise GET BADI raises an exception whenever it runs before a customer has implemented the BAdI. Different countries or industries get their own implementations, selected by a filter value. A third use turns procedural code that cannot easily be rewritten into a default: the program catches the "no implementation" exception, and the old code sits in the CATCH clause. The documentation adds that many implementations where exactly one is required is a worse mistake that the handler must leave to a higher level of the call stack.

TRY.
    GET BADI claim_approval
      FILTERS currency_code = 'USD'.
    CALL BADI claim_approval->needs_approval
      EXPORTING im_amount         = 750
      IMPORTING ex_needs_approval = needs_approval.
  CATCH cx_badi_not_implemented.
    " No implementation: run the old default code here.
    needs_approval = abap_false.
ENDTRY.

Source: ABAP Platform: Single-Use BAdI and Keyword Documentation for ABAP Cloud: GET BADI (the exceptions). Without a fallback class this would be necessary; with one, the catch is only a safety net. This listing requires an SAP system; not run here.

The plug-in idea, run in the lab

The local lab has no enhancement tools, no BAdI Builder and no GET BADI, so a real BAdI cannot run there. What can run is the shape behind it: an interface, two classes that implement it, a default, and a picker that chooses a class by a filter value. The listing below builds that by hand with plain ABAP Objects. It is an analogy, not a BAdI: the picker is code in the same program, while a real BAdI finds its classes through enhancement implementations in the repository.

REPORT zplugin.

INTERFACE lif_approval_rule.
  METHODS needs_approval
    IMPORTING amount        TYPE i
    RETURNING VALUE(result) TYPE abap_bool.
ENDINTERFACE.

CLASS lcl_default_rule DEFINITION.
  PUBLIC SECTION.
    INTERFACES lif_approval_rule.
ENDCLASS.

CLASS lcl_default_rule IMPLEMENTATION.
  METHOD lif_approval_rule~needs_approval.
    result = xsdbool( amount > 1000 ).
  ENDMETHOD.
ENDCLASS.

CLASS lcl_strict_rule DEFINITION.
  PUBLIC SECTION.
    INTERFACES lif_approval_rule.
ENDCLASS.

CLASS lcl_strict_rule IMPLEMENTATION.
  METHOD lif_approval_rule~needs_approval.
    result = xsdbool( amount > 100 ).
  ENDMETHOD.
ENDCLASS.

CLASS lcl_rule_registry DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS pick
      IMPORTING filter        TYPE string
      RETURNING VALUE(result) TYPE REF TO lif_approval_rule.
ENDCLASS.

CLASS lcl_rule_registry IMPLEMENTATION.
  METHOD pick.
    CASE filter.
      WHEN 'STRICT'.
        result = NEW lcl_strict_rule( ).
      WHEN OTHERS.
        result = NEW lcl_default_rule( ).
    ENDCASE.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  DATA(rule) = lcl_rule_registry=>pick( 'STRICT' ).
  WRITE / |STRICT, 500: { rule->needs_approval( 500 ) }|.
  rule = lcl_rule_registry=>pick( 'OTHER' ).
  WRITE / |OTHER, 500: { rule->needs_approval( 500 ) }|.
  WRITE / |OTHER, 1500: { rule->needs_approval( 1500 ) }|.

Output of the lab run (open-abap transpiler 2.14.30; the value abap_true prints as X, abap_false as a blank):

STRICT, 500: X
OTHER, 500:
OTHER, 1500: X

Source: the interface-and-plug-in structure follows the single-use example of ABAP Platform: Single-Use BAdI and the BAdI description in ABAP Platform: Business Add-Ins (BAdIs); the statements are ordinary ABAP Objects. Run in a scratch copy of the abap-lab of this site; the lab’s reduced version of the table is not used here.

Classic BAdIs

Before the Enhancement Framework, BAdIs were created and implemented in the BAdI Builder, transaction SE18 for the definition and SE19 for the implementation, according to the glossary. They are still in many systems. The platform documentation lists the differences that matter when you read old code.

  • A classic BAdI object is created by calling a factory method and referenced through a variable typed with the BAdI interface. A new BAdI object is created with the statement GET BADI.

  • Filter values of a classic BAdI are stored in a structure and passed with each call of a BAdI method. For a new BAdI they are passed once, when GET BADI creates the object.

  • New BAdIs are integrated into the ABAP kernel, switchable by the Switch Framework, and the documentation names better performance and more flexibility (contexts, more filter options) as the gains.

The BAdI Builder offers a migration: in SE18, the function Migrate Classic BAdI creates an enhancement spot and a BAdI with the same name, copies the properties, filters and existing implementations, and a later full migration changes the calls to GET BADI and CALL BADI. The documentation warns that the effort ranges from minutes to several days and needs expert knowledge of the application.

Customer exits and Business Transaction Events

Two older techniques still turn up in classic systems, so a reader of old code needs to recognize them.

A customer exit is a function module that SAP calls from a standard program, empty until the customer fills it. SAP lists the available enhancements in transaction SMOD. The customer groups the ones to use in a project in transaction CMOD, edits the components and activates the project. The glossary states that customer exits are obsolete and replaced by BAdIs and other enhancement points. An SAP S/4HANA on-premise page shows how the generations stand side by side: for the electronic bank statement, SAP offers a customer exit named FEB00001, a BAdI named FEB_BADI, and a Business Transaction Event, number 2810 with the function module OPEN_FI_PERFORM_00002810_E, and says the exits can be reached through Customizing or directly via SMOD.

A Business Transaction Event (BTE) is a registered function module for an event, found mostly in financial accounting and a few other areas. The documentation tells how to use the events of the Bank Customer Accounts: copy the delivered sample function module (names such as SAMPLE_INTERFACE_00010110), add your logic, and enter the module in the event table. The interfaces of an event are reached with transaction FIBF, where the Info system lists them, and the documentation of the interface is in the function module itself in transaction SE37. SAP’s older documentation of financial accounting describes the publish and subscribe interfaces as one-way notifications to other components or external partners: they pass data but cannot send data back.

Modifications and clean core

A modification changes SAP’s own object, and the Enhancement Concept page explains why that is costly: at an upgrade it is gone, or must be adjusted by hand whether or not the object changed. The modification procedure is covered, with the tools SPDD and SPAU, in a later page of this section. The SAP Cloud ALM documentation that the clean core work uses assigns every custom object a clean core level A to D, and level A is described as cloud development with released APIs.

Extensibility in ABAP Cloud

In ABAP Cloud, extensibility is a built-in quality: the ABAP Cloud documentation says seamless extensions and stable interfaces between SAP code and custom code are a prerequisite for cloud-ready, upgrade-safe development, supported by release contracts that guarantee stability. It offers three options.

Key user extensibility Developer extensibility Side-by-side extensibility

Scenario

Small low-code or no-code extensions

Tightly coupled, more complex extensions

Loosely coupled extensions and apps

Target

SAP S/4HANA Cloud, SAP S/4HANA, SAP S/4HANA Cloud Private Edition

The same products

SAP BTP, including the ABAP environment

Persona

Key users

Developers

Developers

Tools

Key user tools (web-based apps)

ABAP Development Tools

ABAP Development Tools

Language

ABAP for Key Users

ABAP for Cloud Development

ABAP for Cloud Development

Typical use

Custom fields on UIs, logic extensions

Custom logic, custom CDS views, ABAP-based extensions

Partner extensions, multitenant apps

Two points matter for the topic of this page. First, extension is opt-in: the documentation says that by default, data models and behavior in ABAP Cloud are not extensible, and you must first find the options the app or service offers. Everything is built on stable extension points, which the glossary ties to a release contract named "C0 contract, extend": the release contract that ensures stability at dedicated extension points so that repository objects can be extended with enhancement tools. A BAdI that SAP has released under such a contract is an extension point you can implement in ABAP Cloud without a modification. Which BAdIs are released in your system, and for which products, is shown by the released-objects tools and the Cloudification Repository (see ABAP Language Versions and Released APIs). Look the released BAdIs up there.

Second, the key user tools are web-based apps that need no development environment. The tools overview says key users can implement adaptations such as forms, custom fields or logic extensions with them, and the glossary says ABAP for Key Users is the restricted language version of enhancements that key users make at dedicated enhancement points. The extensibility pages of the product (S/4HANA Cloud or S/4HANA) describe the apps and their steps.

For RAP business objects, extension has its own mechanism with enabler and provider roles, covered in RAP Behavior Definitions: the original object opts in to the extension points, and an extension provider adds fields, behavior or nodes within them.

What older books show, and what has changed

Older ABAP books, written for systems of the 7.4 and 7.5 generation, treat customer exits (the CMOD and SMOD projects) and even modifications as the normal way to adapt SAP. Today:

  • Customer exits are obsolete according to the Keyword Documentation; BAdIs and other enhancement points replaced them, and the Enhancement Framework is the common mechanism.

  • Modifications are the case clean core is meant to remove, and enhancements replace them. The adjustment procedure at upgrades is the later modification page of this section.

  • A book may teach BAdIs only as classic BAdIs built in SE18 and SE19 with a factory method. New BAdIs are called with GET BADI and CALL BADI, are switchable and faster, and classic ones can be migrated.

  • In ABAP Cloud none of the classic techniques exist as such. Extending means a released BAdI or another released extension point in ADT, or a key user tool; enhancement points and sections are not in the ABAP Cloud keyword documentation.

Common mistakes

  • Leaving a single-use BAdI without a fallback class. Until somebody implements it, GET BADI raises CX_BADI_NOT_IMPLEMENTED, and a program that does not catch it ends in a runtime error.

  • Giving a multiple-use BAdI a method with an EXPORTING or RETURNING parameter. It is not allowed, because nobody could say which implementation’s value counts; use CHANGING.

  • Passing no value, or too few, for a filter. GET BADI needs a value for every filter of the BAdI, and the dynamic variant raises an uncatchable exception for a filter name that does not exist.

  • Expecting a BAdI implementation to run in a system where its enhancement implementation is inactive or switched off. Only active implementations whose switch is on are selected.

  • Using STATIC on an ENHANCEMENT-SECTION to change declarations, or at all as an SAP application developer; it replaces instead of adds and acts system-wide.

  • Reaching for a modification because the enhancement point is hard to find. Use the Enhancement Information System of the Enhancement Builder, or ask the owner of the code to offer a BAdI.

Summary

  • An enhancement adds your behavior to SAP code through a prepared position and lives in your own transport objects, so it survives upgrades; a modification edits SAP’s object and does not.

  • The Enhancement Framework describes the positions as enhancement options, grouped in enhancement spots, and implemented in enhancement implementations. Explicit source code options are ENHANCEMENT-POINT and ENHANCEMENT-SECTION, and they exist in classic ABAP only.

  • A kernel-based BAdI is an interface, filters and settings. Code plugs in as an implementation class, the caller uses GET BADI and CALL BADI, and a single-use BAdI should have a fallback class.

  • Classic BAdIs (SE18, SE19), customer exits (SMOD, CMOD) and Business Transaction Events (FIBF) are older techniques you will meet in classic systems; the Keyword Documentation calls customer exits obsolete.

  • In ABAP Cloud, extending means opting in: a released extension point in ADT, or a key user tool, never a modification.

References