WhatsApp Button




top of page

Mastering SAP ABAP Enhancements : Kernel BADI

ree

Business Add-Ins (BAdIs) are one of the most powerful enhancement techniques in SAP, allowing developers to add custom business logic without modifying standard SAP code. Among the different types of BAdIs available, Kernel BAdI (also called New BAdI or Kernel-Based BAdI) stands out as a modern and optimized framework introduced to overcome the limitations of Classic BAdIs.

In this blog, we’ll explore:

  • What Kernel BAdIs are and why they matter

  • How they differ from Classic BAdIs

  • A practical step-by-step example in MM01 (hiding unwanted buttons)

  • How to create your own Kernel BAdI definition 


 What is Kernel BAdI and Why Do We Need It?

A Kernel BAdI is an enhancement technique embedded in the ABAP Kernel to deliver better performance and flexibility compared to Classic BAdIs. They were introduced with the Enhancement Framework in SAP NetWeaver 7.0 and are now the standard method for implementing BAdIs.

Why use Kernel BAdIs?

  •   🚀 Faster Execution: Kernel-level integration improves performance.

  •   🔄 Upgrade-Safe Enhancements: Changes remain intact during system upgrades.

  •   🎛 Flexible: Supports multiple and filter-dependent implementations.

  •   📦Better Framework: Managed under Enhancement Spots for easier organization.


 Classic BAdI vs. Kernel BAdI

Aspect

Classic BAdI

Kernel (New) BAdI

Finding

Via CL_EXITHANDLER=>GET_INSTANCE

Via  CALL BADI / GET BADI

Container

None

Enhancement Spot

Implementation Container

Not required

Enhancement Implementation

Implementing Class

Auto-generated

Defined manually

Usage

Limited

Stronger Integration, Better Performance

ree

Practical Example: Hiding Unwanted Buttons in MM01

Let’s walk through a business scenario where a customer requires changes in the Material Creation (MM01) transaction.

Requirement

When creating a material in MM01, the user provides the following input:

  • Industry Sector: Pharmaceuticals

  • Material Type: Raw Materials

ree

After pressing Enter, the system asks to select the required views. The user clicks Continue and proceeds to the next screen, where they provide:

  • Material Description

  • Base Unit of Measure

At this stage, the application toolbar displays additional options like “Additional Data” and “Org. Levels.”

Create Material – Basic Data Screen in SAP MM

 However, the customer’s requirement is simple:

They do not need these two buttons, as the business process does not use them. Our goal is to hide or disable the “Additional Data” and “Org. Levels” buttons to make the screen cleaner and customer-specific.

Why Use a BAdI Here?

Since these buttons are part of the standard MM01 transaction, we cannot simply hide them through configuration. Instead, we must apply a customer-specific enhancement.

This is where a Kernel BAdI (New BAdI) comes into play:

  • It allows us to control and adapt the toolbar elements without modifying the standard SAP code.

  • We can implement logic to suppress or disable the “Additional Data” and “Org. Levels” buttons, ensuring the UI matches the customer’s requirement.

Since this requirement involves modifying the standard MM01 toolbar, we first need to check the feasibility and identify the correct Kernel BAdI.

Approach: Debugging with CALL BADI / GET BADI

The most reliable way to discover the relevant BAdI is through debugging, by setting breakpoints on the statements CALL BADI or GET BADI. This approach is preferred by technical consultants because it gives full control and visibility into where SAP is instantiating BAdIs during runtime.

Steps:

  1. Go to transaction MM01.

    SAP Easy Access Command Field with Transaction Code MM01

  1. Activate debugging by typing h in the command field.

    SAP GUI Command Field – Debug Mode Activation (/h)

  1. Set breakpoints:

    • Navigate to Breakpoints → Breakpoint at → Statement.

ABAP Debugger – Breakpoint Menu Options
  1. Enter CALL BADI and GET BADI and click on continue.

    Create Breakpoints Dialog – ABAP Commands

               

  1. Press F8 to continue execution.

The debugger will stop whenever a BAdI is called. However, we are only interested in the point after the Basic Data screens, because that’s where the application toolbar (with Additional Data and Org. Levels) appears. So we skip earlier stops and continue until the relevant screen is loaded.

Discovering the Kernel BAdI

When the debugger halts at a GET BADI statement, check the program/include details. For example, we find:

GET BADI l_badi

ABAP Debugger showing method with GET BADI and CALL BADI implementation for enhancement


Class Builder display of CL_EX_BADI_MATERIAL_OD method PF_STATUS_SETZEN, highlighting BADI call with exporting and changing parameters.

 

 

Here, l_badi is an object referring to the BAdI definition BADI_MATERIAL_OD. Double-clicking this leads us to the BAdI definition and its interface methods.

Enhancement Spot display screen

Unlike Classic BAdIs, Kernel BAdIs are tied to Enhancement Spots. In this case:

  • BAdI: BADI_MATERIAL_OD

  • Enhancement Spot: BADI_MATERIAL_OD

  • Relevant Method: PF_STATUS_SETZEN

  • Parameter: EXTAB_INSERT (used to activate/deactivate toolbar functions)

Why This Works

  • The method PF_STATUS_SETZEN controls the GUI Status, which includes the application toolbar.

  • By using the parameter EXTAB_INSERT, we can deactivate specific toolbar buttons — exactly what our requirement demands (hiding Additional Data and Org. Levels).

  • SAP follows the same object-oriented principle:

    • GET BADI creates the BAdI object.

    • The instance method (here, PF_STATUS_SETZEN) is then called through that object.


Implementing the Kernel BAdI

Now that we’ve identified the correct Kernel BAdI (BADI_MATERIAL_OD → method PF_STATUS_SETZEN), let’s implement it to hide the unwanted toolbar buttons in MM01.

Step 1: Start Implementation

  1. Go to transaction SE19.

  2. Select the New BAdI radio button (Classic BAdI uses the “Classic” option).

    BAdI Builder Initial Screen

  1. Instead of directly entering a BAdI definition (like in Classic BAdIs), provide the Enhancement Spot:

    • Enhancement Spot: BADI_MATERIAL_OD

    Enhancement Spot Selection

            

This will list all BAdI definitions under the spot. Select BADI_MATERIAL_OD.

Step 2: Create Enhancement Implementation

Unlike Classic BAdIs, Kernel BAdIs require an Enhancement Implementation, which acts as a container for individual BAdI implementations.

  • Provide a name and description for the Enhancement Implementation.

Create Enhancement Implementation
  • Save it in your package.

Now, create a BAdI Implementation inside it:

ree
  • Assign the BAdI definition (BADI_MATERIAL_OD).

  • Provide an implementation class name (in Classic BAdIs this is generated automatically, but here we must define it).

ree

Step 3: Implement the Interface Methods

Once the class is created, SAP will insert the interface with all its methods.

ree

⚠️ Important: All interface methods must be redefined, even if you don’t add custom logic to each. Otherwise, the implementation remains inactive.

For our case, we only add logic inside:

  • Method: PF_STATUS_SETZEN

ree
  • Changing Parameter: EXTAB_INSERT (controls toolbar functions).

ree

Step 4: Find Function Codes of Buttons

Each toolbar button has a function code. To hide a button, we need to know its code.

Ways to find it:

  1. System → Status → Double-click the GUI Status (e.g., DATE00) → Check function codes.

ree
ree
  1. Or, run MM01 with a breakpoint in method PF_STATUS_SETZEN, press the button (e.g., Additional Data), and check variable sy-ucomm in the debugger.

ree
ree
ree

For example:

  • Function code for Additional Data: ZU01

  • Function code for Org. Levels: (retrieved similarly).

Step 5: Write the Logic

Inside method PF_STATUS_SETZEN, add the unwanted function codes into the internal table EXTAB_INSERT.

ree

This ensures those buttons are suppressed from the toolbar.

Step 6: Test the Implementation

  • Run MM01 again.

  • Enter the same details (Industry: Pharmaceuticals, Material Type: Raw Materials).

  • Proceed to the screen with the toolbar.

  • The buttons Additional Data and Org. Levels will now be hidden.

ree

If not, set a breakpoint in PF_STATUS_SETZEN to debug.


ree

How to Create a New Kernel BAdI Definition

So far, we have seen how to implement an existing Kernel BAdI (for example, hiding unwanted buttons in MM01). But what if we want to create our own Kernel BAdI definition?

In real SAP projects, especially in product development scenarios, SAP itself often provides the BAdI definition and customers implement it as per their needs. However, as developers, it’s also important to know how to create a new Kernel BAdI definition from scratch.

Step 1: Create an Enhancement Spot

A Kernel BAdI definition always sits inside an Enhancement Spot (a container for one or more Kernel BAdIs).

  1. Go to transaction SE18.

ree
  1. Enter an Enhancement Spot name and click Create.

ree
  1. Provide a short description and save it in your local object or custom package.

ree

Step 2: Create a New BAdI Definition

Inside the Enhancement Spot, create your own BAdI definition:

  1. Click Create BAdI.

ree
  1. Enter a BAdI Definition name and description, then click Continue.

ree
  1. Select the checkbox Multiple Use if you want to allow multiple implementations.

ree
  1. Assign an Interface name (starting with Z or Y) and save it.

    • Example: ZINT_CHANGE.

    ree

   

SAP will prompt you to confirm. Select Yes, and your interface will be generated.

Step 3: Define Methods and Parameters

  1. In the interface, define a method — for example:

    • Method: CHANGE

    • Level: Instance

    • Description: Change values or behavior.

ree
  1. Inside the Parameters section, create:

    • Parameter: PVALUE

    • Type: CHANGING

    • Data type: CHAR1.

ree

Once you complete this, your Enhancement Spot and BAdI definition will be activated automatically.

Step 4: Using Your New BAdI in a Program

Now that we have defined the Kernel BAdI, we can use it inside a custom program.

  1. Go to transaction SE38 and create a new report.

ree
  1. Since Kernel BAdIs are fully based on OOP principles, you will work with classes and objects.

  2. Just like SAP calls methods (e.g., PF_STATUS_SETZEN in MM01), you will now call your own BAdI method (CHANGE) in the program.

ree

 

Conclusion

Kernel BAdIs are the modern way to enhance SAP standard:

  • They are organized, upgrade-safe, and performance-oriented.

  • They allow developers to customize SAP behavior (like toolbar buttons in MM01).

  • They can be created and reused in product development projects.

👉 Whether you’re consuming SAP’s definitions or building your own, mastering Kernel BAdIs will make you more effective in real-world SAP enhancements.


Use full Links -

ree

Chandini Sirigirisetti

SAP ABAP Consultant






bottom of page