What is Enhancement in SAP?
- Enhancement in SAP refers to the process of customizing or extending the standard SAP software without modifying its original code.
- When a company implements SAP, it comes with predefined standard objects provided by SAP. However, businesses often require additional functionality to meet specific needs that are not covered by the standard features.
- Enhancements enable organizations to introduce new functionalities or modify existing ones while preserving the integrity of the core SAP system.
- Dictionary Object Enhancement: Used to add custom fields (Z-fields) to standard SAP tables.
- Domain Value Enhancement: Allows adding new values to standard SAP domains that are not provided by SAP.
- Source Code Enhancement: Used to insert custom logic into standard SAP programs. Ex: Adding validation rules to a standard SAP report.
- Screen Enhancement: Enables adding fields to standard SAP screens.
Types of Enhancement:
- User Exits (Obsolete):
- Available only in the SD module (Sales and Distribution).
- SAP provides subroutines (PERFORM statements) that begin with
USEREXIT_ in standard programs. - Requires an access key for implementation, hence it is called modification rather than an enhancement.
- Downside: Changes do not persist after an SAP upgrade.
- Customer Exits:
- Provides a custom way to enhance functionality of std.programs, function modules and screens.
- Also known as Function Module Exits, Because Customer Exits are implemented thrw FM.
- Types:
- Menu Exits – Add custom menu options.
- Screen Exits – Add custom fields to standard screens.
- Function Module Exits – Extend SAP logic via function modules.
- TCode: SMOD – Search for available customer exits.
- TCode: CMOD – Create and configure enhancement projects.
- BAdI (Business Add-Ins):
- Types: Old BAdIs and New/Kernal BAdIs
- Flexible, object-oriented approach to enhancements, supporting multiple implementations.
- Find BAdIs at SE18 using pkg or using class
CL_EXIT_HANDLER in SE24 or using Get BAdI/ Call BAdI. - Implement BAdIs at TCode: SE19.
- Enhancement Options:
- Implicit Enhancements
- Explicit Enhancements
- Enhancement Points
- Enhancement Sections
- BTE (Business Transaction Events):
- Used primarily in FI (Financial Accounting) modules.
- Custom function module attached to the standard SAP program to enhance functionality.
- Available only in the SD module (Sales and Distribution).
- SAP provides subroutines (PERFORM statements) that begin with
USEREXIT_in standard programs. - Requires an access key for implementation, hence it is called modification rather than an enhancement.
- Downside: Changes do not persist after an SAP upgrade.
- Provides a custom way to enhance functionality of std.programs, function modules and screens.
- Also known as Function Module Exits, Because Customer Exits are implemented thrw FM.
- Types:
- Menu Exits – Add custom menu options.
- Screen Exits – Add custom fields to standard screens.
- Function Module Exits – Extend SAP logic via function modules.
- TCode: SMOD – Search for available customer exits.
- TCode: CMOD – Create and configure enhancement projects.
- Types: Old BAdIs and New/Kernal BAdIs
- Flexible, object-oriented approach to enhancements, supporting multiple implementations.
- Find BAdIs at SE18 using pkg or using class
CL_EXIT_HANDLERin SE24 or using Get BAdI/ Call BAdI. - Implement BAdIs at TCode: SE19.
- Implicit Enhancements
- Explicit Enhancements
- Enhancement Points
- Enhancement Sections
- Used primarily in FI (Financial Accounting) modules.
- Custom function module attached to the standard SAP program to enhance functionality.
SAP Recommended Usage by Enhancement Type
-
BAdIs (New/Kernal BAdIs)
🔹 Use for most modern enhancements – especially in S/4HANA.
🔹 Preferred method for flexible, object-oriented, multiple implementation support. -
Customer Exits
🔹 Use when SAP provides predefined exits (still valid in ECC & some S/4HANA areas).
🔹 Recommended if BAdI is not available. -
Enhancement Points (Implicit/Explicit)
🔹 Use when no BAdI or Customer Exit is available.
🔹 Use to enhance standard code without modifications (safe for upgrades). -
BTE (Business Transaction Events)
🔹 Use specifically for FI module enhancements where SAP exposes BTE points.
🔹 Use when financial transaction enhancement is required and BAdI is not offered. -
User Exits
🔹 Not recommended by SAP.
🔹 Use only in legacy SD scenarios where other options are unavailable.
________________________Lets See In Detail________________________
Customer Exit
Types of Customer Exits:
-
Menu Exits – Add custom menu options to standard SAP applications.
-
Screen Exits – Add extra fields or modify the layout of standard SAP screens.
-
Function Module Exits – Extend SAP logic by enhancing function modules.
- TCode: SMOD and SE24 – To find customer exits. SE24->Enhnc->Cust.Ext
- TCode: CMOD – To Create and Implement enhancement projects.
To Find and Implement Funtion Module Exits:
-
Open MM01 transaction → Go to System → Status → Program Name.
Step 2: Find the Package Name
-
Double-click the Program Name → Goto → Object Directory Entry → Package Name.
-
Alternatively, use SE93:
-
Enter TCode MM01 → Find Program Name & Package Name.
-
Step 3: Search for Customer Exit
-
Open SMOD → Press F4 → Select Information System.
-
Enter the Package Name obtained from Step 2.
-
Review the available exits and select the one that fits the requirement.
Step 4: Create an Enhancement Project in CMOD
-
Open CMOD and create a new Project (ZMAT).
Step 5: Implement the Validation Logic & Activate
-
Write the custom validation logic inside the include.
- IF wmara-mtart = 'NOF1'.IF wmara-meins NE 'FT2'.MESSAGE 'For NOF1 Material, UOM must be FT2' TYPE 'E'.ENDIF.IF wmara-matkl NE 'RS21312'.MESSAGE 'For NOF1 Material, Material Group must be RS21312' TYPE 'E'.ENDIF.ENDIF.
-
Activate the enhancement project in CMOD.
Step 6: Test the Implementation
-
Run MM01 and check if the validation logic is working as expected.
-
Identify the Menu Exit:
-
Open SE38 → System → Status.
-
Double-click on the menu options (e.g., Program, Edit, Goto, Utilities) to check if +CUS exists, confirming that a custom menu option can be added.
-
-
Find the Package of the Program:
-
Open SE38, display any program.
-
Navigate to System → Status.
-
Double-click on the program name (e.g., SAPLS38E).
-
Go to Object Directory Entry and find the package name.
-
-
Find Menu Exit Using SMOD:
-
Open SMOD → Press F4 → Select Information System.
-
Enter the package name found in the previous step.
-
Look for the Menu Exit (e.g., SEU00002).
-
-
Implement Using CMOD:
-
Open CMOD → Create a project (e.g., ZSE38).
-
Assign the Menu Exit found in the previous step under Enhancement Assignment.
-
Click on Components → Select the provided menu exit (e.g., SAPLWBABAP).
-
Enter the Function Text (e.g., Call Smartform).
-
Navigate to the function module provided → Double-click on the Z-include.
-
Implement the required logic and activate it.
-
-
Custom Logic in Z-Include:
-
Single Enhancement Project per Customer Exit:
-
Only one enhancement project can be created for each customer exit.
-
Multiple implementations are not possible for the same customer exit.
-
-
Limited Flexibility:
-
Enhancement points are predefined by SAP, restricting where and how modifications can be made.
-
Customization is limited to available exits, making it less adaptable for complex business requirements.
Procedural Implementation:
-
Customer exits follow a procedure-oriented approach, meaning they rely on function modules and procedural coding rather than object-oriented principles
- Implementation is done using custom includes(Z*) provided inside function modules associated with the enhancement.
- The required logic is written inside these includes to extend the standard functionality.
-
BAdI (Business Add-Ins).
- BAdI (Business Add-In) is an enhancement technique in SAP that allows multiple implementations and offers greater flexibility compared to customer exits.
- It follows object-oriented programming (OOP) principles and is implemented through interfaces.
- More flexible than Customer Exits, supporting multiple implementations, filters and better performance.
Transaction Codes:
- SE18 / SE84 – Define or search for a BAdI.
- SE19 – Implement the BAdI.
1. Classical BAdI (Old BAdI)
- Definition: The BAdI approach introduced after customer exits as part of the enhancement framework.
- System will automatically generate a Z-Class while creating implemetation of the classical BAdI.
2. Kernel BAdI (New BAdI)
- Definition: The newer and more advanced version of BAdI introduced in the Enhancement Framework after Classical BAdIs.
- Kernal BAdI has enhancement spots, which act as containers for BAdI implementations.
- We have to enter Z-Class name while creating implemetation of the New/Kernal BAdI.
To Finding a BAdI: (SE18, SE84, Prog way for kernal, Prg way for classical)
- Open SE18 → Enter the BAdI name or package by pressing F4 to search for available BAdIs.
- BAdIs without enhancement spots are Classical BAdIs.
- BAdIs with enhancement spots are Kernel BAdIs.
- SE84->Enhancement->Bussiness Add-Ins->Defenition->Enter the BAdI name or package to search for available BAdIs.
- Finding a Kernel BAdI Programmatically:Kernel BAdIs are directly called in ABAP code using
GET BADIandCALL BADI. You can find them dynamically by debugging.Steps to Identify a Kernel BAdI in a Transaction Code:
-
Open the transaction (T-code) where you want to find the BAdI.
-
Enter the necessary details and stop just before performing the action that triggers the BAdI.
-
Activate the Debugger:
-
Enter
/hin the command field and press Enter to start the global debugger.
-
-
Set Breakpoints on Kernel BAdI Statements:
-
In the debugger, go to:Menu Bar → Breakpoints → Breakpoint At → Breakpoint At Statement
-
Enter
GET BADIandCALL BADIas breakpoints.
-
-
Press F8 (Continue) repeatedly to reach the first breakpoint.
-
The debugger will stop at the
GET BADIstatement, revealing the BAdI instance being used. -
Continue pressing F8 until the
CALL BADIstatement is reached, where you can see the exact method being executed.
Key Concepts:-
GET BADIreturns an instance of the BAdI implementation class. -
CALL BADIexecutes the methods of the retrieved BAdI instance, triggering the custom business logic.
-
- Finding Classical BAdI using CL_EXITHANDLER (Programmatic Search)
- Classical BAdIs are invoked using the proxy class
CL_EXITHANDLER. - Methods like
CL_EXITHANDLER=>GET_INSTANCEhelp identify the BAdI dynamically.
Steps to Find BAdI in Code:
- Open SE24 → Enter class CL_EXITHANDLER.
- In display mode, go to the Methods tab.
- Double-click on GET_INSTANCE to view the source code.
- Set a breakpoint on: CALL METHOD CL_EXITHANDLER=>GET_CLASS_NAME_BY_INTERFACE
- Run the transaction code for which you want to find the classical BAdI.
- The debugger will stop at this method, helping you find the associated classica BAdI at exit.
- SAP Internal - Only for SAP internal uses, we cannot use.
-
Single Implementation BAdI – Allows only one active implementation.
-
Multiple Implementation BAdI – Supports multiple active implementations running in parallel.
-
Filter BAdI – Allows different implementations to be executed based on specific filter values.
Enhancement Options.
Enhancement options define specific positions within the SAP Object Repository where enhancements can be implemented. These options can either be explicitly defined by the developer or provided by SAP.
Types of Enhancement Options
1. Implicit Enhancement Options
-
Provided by the framework and always exist at fixed positions in SAP standard programs.
-
They do not require an enhancement spot for activation.
-
Available at fixed positions, such as:
-
Start and end of a program
-
Subroutines
-
Function Modules
-
Methods in Classes
-
-
Usage:
-
Allows adding additional logic without modifying SAP standard code.
-
Cannot replace or change SAP standard logic.
-
2. Explicit Enhancement Options
-
Defined by developers within an SAP program.
-
Managed using Enhancement Spots and enhanced using Enhancement Implementations.
-
Can be placed anywhere within the code.
- Types of Explicit Enhancements:
- Enhancement Point:
- Allows adding custom logic without modifying SAP standard code.
- Does not provide default implementation.
- Enhancement Section:
- Allows modification or replacement of SAP standard code.
- Provides a default implementation, which can be overridden.
BTE (Business Transaction Events).
BTE is Business Transaction Event, an enhancement technique designed primarily for the FI (Financial Accounting) module in SAP.
It allows developers to add custom functionality using predefined interfaces by implementing custom function modules.
-
Find a Suitable BTE Event
-
Go to transaction FIBF
-
Navigate to:
Environment → Information System → Execute -
Search and identify the relevant BTE event that matches your business requirement.
-
-
Create a Custom Function Module
-
In the same screen, select the BTE event.
-
Click on Sample Function Module.
-
Copy it to a custom function module under your own function group.
-
Add your custom logic and activate it.
-
-
Create and Activate a Product
-
Go to:
FIBF → Settings → Products → Of a Customer → New Entries -
Enter a unique Product ID and description.
-
Check the Active checkbox and save.
-
-
Assign the Function Module to the BTE Event
-
Go to:
FIBF → Settings → P/S Modules → Of a Customer → New Entries -
Enter:
-
Event ID (e.g., 00001650)
-
Product ID (created in Step 3)
-
Function Module (created in Step 2)
-
-
Save your entries.
-
-
Go to Tcode: FIBF
-
Navigate to:
Environment → Information System → Execute -
Search for a suitable event based on your requirement.
- For FI line item and header commonly used enhancements, are:
- Event 00001650 – Line Item Display: Add to data per line
- Event 00001640 – Line Item Display: Additional header lines
To include the Customer Name in the output, we have add field to the structures mentioned in the BTE events documentation:
-
Add field NAME1 to the structures: RFPOS and RFPOSX using append structure.
-
Use Program:
RFPOSXEXTENDvia SE38 to regenerate and activate the updated structure.
-
Go back to FIBF → Environment → Information System → Execute
-
Select Event 00001650
-
Click on Sample Function Module
-
Copy the sample FM to a custom FM (e.g.
ZSAMPLE_INTERFACE_00001650) under a custom function group -
Implement logic to fetch Customer Name (e.g., from table
KNA1) and populate the new field -
Activate the function module
-
Go to:
FIBF → Settings → Products → Of a Customer → New Entries -
Enter:
-
Product ID: e.g.,
ZFI_CUST -
Description: e.g., FBL5N Enhancement - Add Customer Name
-
Check the Active checkbox
-
-
Save
-
Go to:
FIBF → Settings → P/S Modules → Of a Customer → New Entries -
Enter:
-
Event:
00001650 -
Product:
ZFI_CUST -
Function Module:
ZSAMPLE_INTERFACE_00001650
-
-
Save your entries
-
Go to Tcode: FBL5N
-
Execute the report
-
Click on Change Layout
-
Find and add the new field (e.g., Customer Name) to the report output
-
The new field should now display the corresponding values
REAL TIME EXAMPLES
Example 1: Material Master Screen Enhancement (Adding Custom Field)
Objective:
To enhance the Material Master screen by adding a custom field using a combination of SPRO and ABAP coding.
Steps:
-
Append Custom Fields to MARA Table:
-
Create an append structure and add your custom fields to the
MARAtable.
-
-
Create Function Group via SPRO (Not SE80):
-
Navigate through SPRO to create the Function Group.
-
This ensures the system copies the standard Function Group (FG) to a customer-specific Function Group.
-
-
Add custom fields to Screen 0001:
-
The Function Group will contain default screens
0001and0002. -
Add the custom field to screen
0001.
-
-
Implement PBO and PAI Logic:
-
Write the necessary PBO (Process Before Output) and PAI (Process After Input) logic in the TOP include of the Function Group.
-
-
Add the Custom Screen in Standard data screen via SPRO:
-
Using SPRO, include your custom screen in the standard data screen sequence.
-
-
Test the Enhancement:
-
Create a new Material to verify that the custom field appears and behaves as expected.
-
Step By Step Procedure:
-
Append Custom Fields to MARA Table
-
Go to SE11 → Open
MARAtable -
Use Append Structure to add custom fields (e.g.,
ZZ*fields)
-
-
Create Function Group via SPRO (Not SE80)
-
Navigate:
SPRO → SAP Reference IMG → Logistics General → Material Master → Config Material Master → Create program for customized subscreen - Choose Retail → Execute
-
Enter Custom Function Group name (e.g.,
ZMDG4) and description → Save -
Now go to SE80 → Select Function Group → Enter
ZMDG4→ Right-click → Activate - This creates default screens
0001and0002and a TOP include program.
-
Add Custom Fields to Screen 0001
-
In SE80 → Open
Screen 0001ofZMDG4→ Change Mode → Layout -
Add a Box using the toolbox → Name it as RERA AREA → Assign to group (e.g.,
GRP1) -
Use Dictionary Program Fields Window icon(F6) to fetch fields from
MARA(ZZ* fields) -
Add fields inside the box → Assign to group (
GRP1) → Save → Activate
-
Write Logic in the TOP Include
-
In the function group include (e.g.,
LZMDG4TOP), create modules:
-
MODULE modify_screen in PBO:-
Controls edit/display mode depending on Tcode (e.g., MM03 = display mode)
- This controls whether the custom field is in display or edit mode.
-
-
MODULE get_data in PBO:-
Use standard FM
MARA_GET_SUBto fetch data
-
-
-
MODULE set_data in PAI:-
Use standard FM
MARA_SET_SUBto update data
-
-
Save → Check → Activate
-
Register Custom Subscreen via SPRO
-
Go to:
SPRO → Logistics General → Material Master → Config Material Master → Define Structure of Data Screens for Each Screen Sequence -
Select the Standard Industry tab page
-
On the left, double-click Data Screen → Then select e.g., Basic Data 1
-
Under the subscreen list, locate screen
0001→ Replace the program name fromSAPLMGD1to your custom FG (e.g.,SAPLZMDG4) -
Save your changes to a transport request
-
Test the Enhancement
-
Go to
MM01,MM02, orMM03 -
Check that your custom fields are now visible on the screen
-
Create a new material and verify the custom field is working as expected
-
Summary:
SAP offers several types of enhancements:
Dictionary Object Enhancement: Used to add custom fields (Z-fields) to standard SAP tables.
Domain Value Enhancement: Allows adding new values to standard SAP domains.
Source Code Enhancement: Used to insert custom logic into standard SAP programs.
Screen Enhancement: Enables adding fields to standard SAP screens.
specific enhancement technologies In-Short:
User Exits: These are subroutines provided by SAP ( starting with USEREXIT_ ) within standard SD (Sales and Distribution) module programs. Implementing them requires an access key and is considered a modification, as changes may not persist after SAP upgrades. SAP does not recommend their use except in legacy SD scenarios when other options are unavailable.
Customer Exits: These provide a way to enhance the functionality of standard programs, function modules, and screens through function modules. They are also known as Function Module Exits.
Types include Menu Exits (add custom menu options), Screen Exits (add custom fields to screens), and Function Module Exits (extend SAP logic).
Transaction codes SMOD (search for exits) and CMOD (create/configure enhancement projects) are used.
Limitations include only one enhancement project per customer exit, limited flexibility due to predefined exit points, and a procedural implementation approach.
BAdI (Business Add-Ins): This is a flexible, object-oriented approach supporting multiple implementations. There are two types:
Classical (Old) BAdIs: Introduced after customer exits. A Z-class is automatically generated during implementation. They can be found using SE18, SE84, or programmatically via class CL_EXIT_HANDLER.
Kernel (New) BAdIs: A more advanced version with enhancement spots as containers for implementations. You have to enter a Z-class name during implementation. They can be found using SE18, SE84, or programmatically using GET BADI and CALL BADI statements (debugging is often used).
Transaction codes SE18/SE84 (define/search) and SE19 (implement) are used.
BAdIs support SAP Internal, Single Implementation, Multiple Implementation, and Filter-dependent implementations.
SAP recommends using New/Kernel BAdIs for most modern enhancements, especially in S/4HANA, due to their flexibility and support for multiple implementations.
Enhancement Options: These define specific positions where enhancements can be implemented.
Implicit Enhancements: Provided by the framework at fixed positions (e.g., start/end of programs, subroutines, function modules, methods) and do not require an enhancement spot. They allow adding logic without modifying standard code but cannot replace existing logic.
Explicit Enhancements: Defined by developers and managed using Enhancement Spots and Implementations.
Enhancement Points: Allow adding custom logic without modifying standard code and do not provide a default implementation.
Enhancement Sections: Allow modification or replacement of standard code and provide a default implementation that can be overridden.
SAP recommends using Enhancement Points/Sections when no BAdI or Customer Exit is available. They are safe for upgrades.
BTE (Business Transaction Events): Primarily used in the FI (Financial Accounting) module. Custom function modules are attached to standard SAP programs to enhance functionality.
Transaction code FIBF is used to find events, create products, and assign function modules.
SAP recommends using BTEs specifically for FI module enhancements where BTE points are exposed and when financial transaction enhancement is required and a BAdI is not offered.
Points to Remember:
Enhancement in SAP is the process of customizing or extending standard SAP software without modifying its original code.
SAP offers various enhancement techniques including Dictionary/Domain/Source Code/Screen Enhancements, User Exits, Customer Exits, BAdIs (Classical and Kernel), Enhancement Options (Implicit and Explicit with Points and Sections), and BTEs.
User Exits are obsolete and not recommended by SAP, primarily available in the SD module, require an access key, and their changes do not persist after upgrades.
Customer Exits use function modules to extend standard functionality in programs, function modules, and screens. Key T-codes are SMOD (find) and CMOD (implement). They have limitations like single implementation and predefined exit points.
BAdIs are a flexible, object-oriented approach supporting multiple implementations. New/Kernel BAdIs are the preferred method for modern enhancements, especially in S/4HANA. Key T-codes are SE18/SE84 (find) and SE19 (implement).
Enhancement Options allow adding or replacing code at defined positions within SAP programs. Implicit enhancements are at fixed positions and cannot replace code, while explicit enhancements (Points and Sections) are developer-defined. Use them when no BAdI or Customer Exit is available; they are safe for upgrades.
BTEs are used primarily for FI (Financial Accounting) module enhancements by attaching custom function modules to standard programs. The key T-code is FIBF.
Understanding the appropriate transaction codes (SMOD, CMOD, SE18, SE19, FIBF) is crucial for finding and implementing different types of enhancements.
SAP recommends using New/Kernel BAdIs for most modern enhancements, Customer Exits when predefined exits are available and no BAdI exists, Enhancement Points/Sections when no BAdI or Customer Exit is available, and BTEs specifically for FI module enhancements where BTE points are exposed. User Exits are not recommended.





No comments:
Post a Comment