Chapter 12 · Real-World Skills
Enhancements & Standard SAP
How to add custom logic to standard SAP without breaking it — User Exits, BAdIs, and the Enhancement Framework.
Here is the uncomfortable truth about SAP: Standard SAP code does not do everything your company needs. Every business has slightly different processes, and eventually someone will ask you to make standard SAP behave differently.
You have two options. The wrong one: modify the SAP source code directly. This breaks the support agreement, causes upgrade nightmares, and gets flagged in every audit. The right one: use Enhancements — SAP’s official mechanism for adding custom logic without touching the original code.
This chapter teaches you all the main enhancement techniques: User Exits, BAdIs, Implicit and Explicit Enhancements, and the Enhancement Framework that ties them all together.
🎯 What You Will Learn in This Chapter
- What enhancements are and why you must never modify standard code
- How to find and activate User Exits using SMOD and CMOD
- How to create and implement classic BAdIs with SE18 and SE19
- How to work with new BAdIs in the Enhancement Framework
- The difference between Implicit and Explicit Enhancements
- How to add code at enhancement points using SE80 / SE38
- When to use an enhancement vs when a modification is unavoidable
🚫 Why You Must Never Modify Standard SAP Code
It is tempting. You find the exact line in SAP’s code that needs to change, you edit it, and everything works. Then upgrade season comes, and everything falls apart.
| Problem with Modifications | Impact |
|---|---|
| SAP support agreement is void | SAP can refuse to help with issues |
| Upgrades overwrite your code | Weeks of rework after every release |
| Other modules may depend on original behavior | Unexpected breakdowns elsewhere |
| Audit trails get messy | Compliance teams demand documentation |
| Testing burden multiplies | Full regression needed on every patch |
🧩 Technique 1: User Exits (Legacy but Still Common)
User Exits are SAP-provided subroutine hooks. SAP leaves empty FORM routines in its standard code, and developers fill them with custom logic. This is the oldest enhancement technique but still appears in many production systems.
Two transactions you must know
| Transaction | Purpose |
|---|---|
| SMOD | View all available User Exits in SAP standard code |
| CMOD | Activate User Exits and assign them to a custom Enhancement Project |
How to use a User Exit
Go to SMOD. Search for the SAP module or program you want to enhance (e.g., M06B0001 for purchasing). SMOD lists all available User Exits with short descriptions.
Go to CMOD. Create a new project with a name like ZENH_PO_EXIT. Give it a description and save.
In your CMOD project, click Components. Add the SMOD enhancement name (e.g., M06B0001). This assigns the User Exit to your project.
Double-click the include (e.g., ZXM06U01). SAP opens the include where you write your custom logic. The include is part of your namespace (Z or Y prefix), so it survives upgrades.
Save, activate the include, then click Activate on the CMOD project. The User Exit is now live.
🎯 Technique 2: BAdIs (Business Add-Ins)
BAdIs are the modern, object-oriented enhancement technique. Instead of filling empty FORMs, BAdIs use interfaces and implementing classes. This allows multiple implementations, filtering, and clean separation of logic.
Classic BAdI vs New BAdI
| Feature | Classic BAdI | New BAdI |
|---|---|---|
| Transaction for definition | SE18 | SE18 (Enhancement Spot) |
| Transaction for implementation | SE19 | SE19 (via Enhancement Spot) |
| Based on | Interface + implementing class | Enhancement Framework |
| Multiple active implementations | ❌ No (one active per BAdI) | ✅ Yes |
| Filters supported | Limited | ✅ Full support |
| Cloud ready | No | Yes |
| Recommended for | Legacy maintenance | All new development |
How to implement a classic BAdI
Go to SE18. Enter the BAdI name (e.g., MB_MIGO_BADI for MIGO enhancements) or search by description. View the interface and documentation.
Go to SE19. Click Create. Give your implementation a name like ZIMPL_MIGO_CHECK. Enter the BAdI name it implements.
SE19 generates a class that implements the BAdI interface. Double-click each method and add your custom logic. The BAdI interface defines which methods are called — you just fill them in.
Save, activate the class, then activate the BAdI implementation. The BAdI is now live — whenever SAP calls the BAdI, your implementation runs.
🔧 Technique 3: Implicit & Explicit Enhancements
When User Exits and BAdIs do not exist at the location you need, the Enhancement Framework provides two more options: Implicit Enhancements and Explicit Enhancements.
Implicit Enhancements
SAP automatically provides Implicit Enhancement points at:
- Beginning and end of FORM routines
- Beginning and end of Function Modules
- Beginning and end of Methods
- End of include programs
- End of class implementations
You do not need SAP to place a marker. Every FORM, FM, and Method has these points available.
How to add an Implicit Enhancement
Navigate to the location where you want to add logic (e.g., inside a FORM routine).
In the menu, choose Edit → Enhancement Operations → Show Implicit Enhancement Options. SAP highlights the available enhancement points with a special icon.
Right-click the enhancement point. Choose Create Enhancement. Give it a name (Z-prefixed). SAP generates an overlay where you can add code.
Add your code in the generated enhancement block. Save and activate. Your logic now runs at that point in the standard code — without modifying the original line.
Explicit Enhancements
Explicit Enhancements are marker points that SAP places deliberately in standard code using:
" Enhancement Point — free insertion point
ENHANCEMENT-POINT z_my_enhancement SPOTS z_enh_spot.
" Enhancement Section — replaces a code block
ENHANCEMENT-SECTION z_my_section SPOTS z_enh_spot.
" Standard code that can be replaced
END-ENHANCEMENT-SECTION.
You implement them the same way as Implicit Enhancements — through the Enhancement Framework in SE38 or SE80.
⚖️ Which Enhancement Technique Should You Use?
| Scenario | Recommended Technique |
|---|---|
| A User Exit exists at the exact place you need | User Exit (SMOD/CMOD) |
| A BAdI exists for the functionality | BAdI (SE18/SE19) — preferred over User Exit if both exist |
| No BAdI, but an Implicit point exists | Implicit Enhancement via SE38/SE80 |
| No Implicit point, but an Explicit point exists | Explicit Enhancement |
| Multiple implementations needed | BAdI (only technique that supports this) |
| Modern ABAP Cloud project | New BAdI via Enhancement Framework |
| No enhancement available anywhere | Modification (last resort, register in Modification Assistant) |
📝 Chapter Summary
- Never modify SAP standard code directly — it breaks upgrades and voids support.
- Enhancements are SAP’s official way to add custom logic without touching the original.
- User Exits — legacy technique using SMOD (view) and CMOD (activate). One active implementation per exit.
- BAdIs — modern object-oriented technique using SE18 (definition) and SE19 (implementation). Support multiple implementations and filters.
- Implicit Enhancements — automatically available at start/end of FORMs, FMs, Methods, includes.
- Explicit Enhancements — placed deliberately by SAP using ENHANCEMENT-POINT and ENHANCEMENT-SECTION.
- The Enhancement Framework unifies all of these — same tooling, consistent process.
- Use Modifications only as a last resort — and always register them in the Modification Assistant.
🎤 Interview Questions & Answers
Enhancements are a favorite interview topic because they reveal whether you understand upgrade-safe development. Know these cold.
An Enhancement in SAP ABAP is a mechanism that allows developers to add custom logic to standard SAP programs without modifying the original SAP source code. It is needed because directly modifying SAP standard code is dangerous — SAP support agreements forbid it, and modifications break during upgrades. Enhancements preserve SAP’s warranty and survive version updates.
A User Exit is an older enhancement technique where SAP provides predefined subroutine hooks (FORM routines) that developers can activate and fill with code. A BAdI (Business Add-In) is the modern, object-oriented enhancement technique based on interfaces and implementing classes. BAdIs support multiple implementations, filtering, and are upgrade-safe. User Exits are legacy but still common in older systems.
SMOD is the transaction used to view and select User Exits provided by SAP. CMOD is the transaction used to activate those User Exits and assign them to a custom enhancement project. You use SMOD to find available User Exits, and CMOD to implement them.
Classic BAdI uses transaction SE18 for definition and SE19 for implementation. It is based on interfaces but has limitations like a single active implementation per BAdI. New BAdI (sometimes called Enhancement Spot BAdI) is created via the Enhancement Framework and supports multiple active implementations, filters, and full integration with modern ABAP. New BAdI is recommended for all new development.
An Implicit Enhancement is a predefined extension point that SAP has built into standard code without any explicit declaration. These are automatically available at certain points like the beginning and end of FORM routines, Function Modules, Methods, and at the end of include programs. Developers can add code at these points using the Enhancement Framework in SE80 or SE38.
An Explicit Enhancement is a specific extension point that SAP has explicitly marked in the standard code using ENHANCEMENT-POINT or ENHANCEMENT-SECTION statements. Unlike Implicit Enhancements, these are intentionally placed by SAP where they expect customers to add custom logic.
The Enhancement Framework is SAP’s unified technology for all enhancement techniques. It provides a consistent way to create Enhancement Spots, Enhancement Points, Enhancement Sections, and BAdI implementations. Everything in modern ABAP enhancements — including new BAdIs — runs on this framework.
Use an enhancement whenever possible — it is upgrade-safe, doesn’t break SAP’s support, and preserves your warranty. Use a modification only when no enhancement point exists at the required location AND the change cannot be achieved any other way. Even then, modifications should be documented and registered in SAP’s Modification Assistant to track them.
🛠 Practice Task for This Chapter
Practice all three enhancement techniques. The goal is to understand the workflow, not to memorize every step.
- User Exit (SMOD + CMOD): Find any User Exit in SMOD for a common transaction (e.g.,
M06B0001). Create a CMOD project, activate the User Exit, and write a simple WRITE statement to verify it runs. - Classic BAdI (SE18 + SE19): Find a well-documented BAdI (e.g.,
MB_MIGO_BADIor any BAdI in your system). Create an implementation in SE19, implement one method to display a MESSAGE, and test it. - Implicit Enhancement: Open any standard FORM in SE38. Go to Edit → Enhancement Operations → Show Implicit Enhancement Options. Create an enhancement at the top of the FORM and add a simple comment or message.
- Read documentation: For each BAdI or User Exit you work with, read the SAP documentation (click the Documentation button in SE18). Understanding what each enhancement was designed to do is more important than the syntax.
Test: Kon Banega Crorepati?
5 questions. ₹1 Crore. Prove you understood Enhancements. No pressure — restart anytime.
Explore Our Instructor-Led SAP & IT Courses
Self-study works. But if you want guided training, real project practice, and placement support — here are the courses we offer. Book a free demo before you decide.
WhatsApp us