ABAP Enhancements, BAdIs and User Exits
Upgrade-safe extensibility concepts, discovery techniques, implementation flow, filters, multiple use and real interview scenarios.
What is an enhancement in SAP ABAP?
An enhancement adds customer-specific behavior at an intended extension point while keeping the original SAP object unchanged. This improves upgrade handling compared with direct modification. The Enhancement Framework integrates modern enhancement spots and kernel-based BAdIs while supporting classic technologies for compatibility.
1. Enhancement versus modification
| Enhancement | Modification |
|---|---|
| Uses an offered enhancement option or plug-in contract. | Changes SAP-delivered source or object directly. |
| Separated in a customer implementation object. | Can require adjustment during upgrades. |
| Preferred when a suitable option exists. | Last resort with strict governance. |
2. Main enhancement technologies
- New/kernel BAdI: object-oriented plug-in managed by the Enhancement Framework.
- Classic BAdI: older object-oriented enhancement accessed through generated proxy/handler mechanisms.
- Customer exit: SAP-provided function, screen or menu exit, commonly organized with SMOD and implemented through CMOD projects.
- User exit: project terminology often used for customer hooks; in practice confirm whether it is a FORM exit, customer exit function module or another classic mechanism.
- Explicit enhancement point/section: a named source-code enhancement option.
- Implicit enhancement: enhancement options available at defined structural positions such as the start or end of suitable processing blocks.
3. What is a BAdI?
A Business Add-In is an object-oriented plug-in concept. A BAdI definition describes the contract, usually through a BAdI interface. One or more BAdI implementations provide customer logic. New BAdIs can support filters, multiple use, fallback classes and different instance-creation modes.
4. New BAdI call pattern
DATA lo_badi TYPE REF TO badi_name.
GET BADI lo_badi
FILTERS
process_type = lv_process_type.
CALL BADI lo_badi->check_document
EXPORTING
is_header = ls_header
CHANGING
ct_messages = lt_messages.The exact BAdI reference type, filters and method signature come from the definition. Do not copy names from an example into a production system without checking SE18/SE19 or ADT.
5. Classic BAdI versus new BAdI
- Classic BAdIs are older and commonly identified/implemented through SE18 and SE19.
- New BAdIs are integrated into enhancement spots in the Enhancement Framework and use
GET BADIandCALL BADI. - Both are object-oriented extension mechanisms, but their runtime and metadata models differ.
- Do not mix calling patterns without checking the BAdI type.
6. What do “multiple use” and “filter dependent” mean?
Multiple use allows more than one active implementation to participate. The caller must not assume one deterministic implementation unless the definition guarantees it. Filter dependent means runtime filter values determine eligible implementations—for example company code, country or process type.
7. What is a fallback class?
A fallback class supplies default behavior when no active implementation is selected. It is defined by the BAdI provider. Interview answer: check whether the BAdI has a fallback before assuming that no implementation means no behavior.
8. Customer exit implementation flow
- Identify the transaction's main program/package and candidate enhancement.
- Inspect the enhancement in SMOD or repository information tools.
- Create a CMOD project and assign the enhancement.
- Implement the provided customer include, function, screen or menu component.
- Activate the include and CMOD project, then test positive and negative paths.
FUNCTION exit_sapxxxx_001.
* Import parameters are supplied by SAP standard code.
* Customer logic belongs in the generated ZX... include.
INCLUDE zxxxxu01.
ENDFUNCTION.
"Inside the customer include:
IF i_document_type = 'Z1'.
e_blocked = abap_true.
ENDIF.
9. How do you find a BAdI or exit?
- Check application documentation and IMG nodes first.
- Use SE18/SE19 and enhancement spot searches for known business areas.
- Use SE84 or ADT repository search for enhancement definitions and implementations.
- Debug relevant framework calls, including
GET BADI,CALL BADIor classic handler calls where appropriate. - Search the package and main program for explicit enhancement points, customer-exit function modules and enhancement sections.
- Confirm runtime execution with breakpoints and a controlled test case—do not implement based only on a name match.
10. Explicit versus implicit enhancement
An explicit enhancement point or section is deliberately declared by the original developer. An implicit enhancement option exists automatically at framework-defined structural positions. Prefer the most explicit, semantically appropriate and documented option. An implicit enhancement should not be chosen merely because it is easy to reach.
11. Enhancement point versus enhancement section
An enhancement point adds code at a defined position. An enhancement section can replace a provided source section through an active implementation. Sections are more intrusive and require stronger testing and governance.
12. How do you avoid upgrade problems?
- Prefer released APIs and documented extension points.
- Keep enhancement implementations small; delegate business logic to tested Z classes.
- Avoid assumptions about screen sequence, internal tables or undocumented global data.
- Record the business requirement, enhancement ID, filter values, transports and test cases.
- Run regression tests and inspect adjustment-impact tools during upgrades.
13. Can you commit work inside a BAdI?
Usually you should not issue COMMIT WORK or ROLLBACK WORK inside an enhancement unless the contract explicitly allows it. The standard application normally owns the logical unit of work. An unexpected commit can break atomicity, update-task behavior and locks.
14. Performance rules for enhancement code
- Remember that a BAdI may run in a loop or for every document item.
- Avoid SELECT inside loops; bulk-read and cache immutable reference data carefully.
- Return early when the filter/business condition is not relevant.
- Measure runtime in the real call path, not only in an isolated test.
- Never hide expensive remote calls inside frequently triggered exits.
15. Error handling and messages
Follow the BAdI or exit contract. Some interfaces expose message tables; some allow class-based exceptions; others expect status flags. Do not raise a message type that terminates standard processing unless explicitly required. Preserve useful context for support teams.
Real project scenario 1: validation before save
Strong answer: Search for a released validation BAdI or documented enhancement in the save-check phase; confirm that it runs for GUI, API and background channels; implement thin orchestration that delegates to a testable service; return messages using the interface contract; avoid COMMIT WORK; and regression-test create/change/copy scenarios.
Real project scenario 2: several implementations
Strong answer: Check whether the BAdI is multiple-use, inspect filters and activation state, verify sequence assumptions, confirm no fallback or default implementation also runs, and debug the runtime selection with the exact filter values.
Common interview mistakes
- Saying “user exit and customer exit are always identical” without clarifying the concrete technology.
- Assuming every BAdI uses
CL_EXITHANDLER=>GET_INSTANCE. - Putting all business logic directly inside the enhancement implementation.
- Ignoring channel coverage, filters, multiple-use behavior and fallback classes.
- Using implicit enhancement before checking a released or explicit option.
- Forgetting authorization, locks, update task and LUW effects.
Hands-on exercise
- Choose a sandbox transaction and identify one documented BAdI without implementing it.
- Record definition, interface, method, filter values, multiple-use setting and package.
- Design a thin implementation that delegates to a
ZCL_...service. - Write ABAP Unit tests for the service: relevant case, irrelevant case, error case and performance-safe bulk case.
- Create a transport and rollback checklist.
Rapid revision
- Enhancement extends; modification changes SAP standard directly.
- BAdI is an OO plug-in contract.
- New BAdIs belong to enhancement spots.
- GET BADI obtains a handle; CALL BADI calls a method.
- Filter values select implementations.
- Multiple use may execute several implementations.
- CMOD projects implement classic customer exits.
- Explicit options are intentional extension points.
- Keep implementation thin and testable.
- The standard application usually owns the LUW.
Official SAP references
Previous: Part 5 — ABAP Objects | Next: Part 7 — Smart Forms and Adobe Forms
Disclaimer: Enhancement options vary by product, release and extensibility model. Confirm the current contract and release status in your SAP system.

0 Comments