Enhancements Part 7: Implicit Enhancements — Power and Risk
Use implicit enhancements responsibly: where they are available, how to implement them in FORMs, function modules and class methods (pre/post/overwrite), what data is accessible, the upgrade and support risks, and a checklist for approving them.
Explanation
📌 KEY POINTS
✅ Implicit enhancements let you add code at the start/end of almost any FORM, FM or method — even where SAP planned no extension.
✅ For global class methods: pre-exit, post-exit and overwrite-exit methods.
✅ Powerful, but they depend on SAP's internal code, which can change in any support package.
⚠️ An overwrite exit or an implicit enhancement in a core SAP routine can silently break standard behaviour — treat it like a modification.
━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE
Part 3 introduced implicit options. This lesson shows how to use them — and when not to.
━━━━━━━━━━━━━━━━━━━━
▶ 1. WHERE THEY ARE
- Start and end of FORM routines and function modules.
- Start and end of methods; for global classes as separate pre/post/overwrite methods.
- End of includes and programs; end of structure definitions and class sections.
- Additional optional parameters for FMs and methods.
━━━━━━━━━━━━━━━━━━━━
▶ 2. IMPLEMENTING (FORM / FM)
Editor → Enhance → Edit → Enhancement Operations → Show Implicit Enhancement Options → cursor on the marker line → Create Implementation → Code. Your code sees the FORM/FM's parameters and global data of the program at that point.
━━━━━━━━━━━━━━━━━━━━
▶ 3. IMPLEMENTING (CLASS METHODS)
SE24/SE80 → Enhance → Insert pre-method / post-method / overwrite-method.
- Pre: runs before; gets importing parameters.
- Post: runs after; can change exporting/changing/returning parameters.
- Overwrite: replaces the whole method — you own it completely.
Access to private attributes goes through CORE_OBJECT (only public components unless the enhancement class gets special access in newer releases).
━━━━━━━━━━━━━━━━━━━━
▶ 4. RISKS
- Internal code and variable names may change in support packages → syntax errors or wrong behaviour.
- Invisible to functional teams; hard to find when debugging (look for ENHANCEMENT blocks).
- Runs in every path using that FORM/FM — including background, BAPIs and other transactions.
- Performance: code in frequently called routines runs millions of times.
━━━━━━━━━━━━━━━━━━━━
▶ 5. APPROVAL CHECKLIST
- No BAdI, exit, BTE or explicit point fits? (documented search)
- Code is minimal and calls a class?
- Guarded by conditions (program, transaction, org unit)?
- Tested in all processing paths?
- Registered with owner and regression test for upgrades?
━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP
- In a sandbox, add an implicit enhancement at the end of a Z function module copy and log its call.
- Add a post-method to a Z class method and change its returning value.
- Write the checklist answers for a real implicit enhancement in your system.
✅ CHECKPOINT: you can implement implicit enhancements and decide when they are justified.
Code example
* ===== Implicit enhancement at the END of a function module =====* FUNCTION some_sap_fm.* ... SAP code ...*"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$*$**$*$-Start: (1)---------------------------------------------------$*$*ENHANCEMENT 1 zei_fm_end_default. "active version* Guard: only for our process and org unit IF sy-tcode = 'VA01' OR sy-tcode = 'VA02'. zcl_order_defaults=>after_sap_fm( CHANGING cs_data = es_result ). " es_result: FM parameter ENDIF.ENDENHANCEMENT.*$*$-End: (1)---------------------------------------------------$*$** ENDFUNCTION. * ===== Post-method for a global class method (created in SE24 Enhance mode) =====* CLASS lcl_zei_price_post DEFINITION.* PUBLIC SECTION.* CLASS-DATA obj TYPE REF TO lcl_zei_price_post.* DATA core_object TYPE REF TO zcl_price_calc. " the enhanced object* METHODS ipo_zei_price_post~calculate " post-exit* IMPORTING iv_matnr TYPE matnr* CHANGING rv_price TYPE netwr.* ENDCLASS.* ...* METHOD ipo_zei_price_post~calculate.* IF iv_matnr CP 'ZSAMPLE*'.* rv_price = 0. " samples are free* ENDIF.* ENDMETHOD. * ===== Register entry (documentation, not code) =====* Implementation: ZEI_FM_END_DEFAULT* Option: end of FM <name> Reason: no BAdI/exit for this default (search documented)* Owner: SD team Tests: VA01 online, BAPI_SALESORDER_CREATEFROMDAT2, IDoc ORDERS* Upgrade check: SPAU_ENH + regression test TC_SD_017Real project scenario
A project added an implicit enhancement at the end of a pricing-related function module to round prices for one customer group. After a support package, SAP renamed an internal variable used in the enhancement; the program got a syntax error and order entry stopped in production for 40 minutes until the enhancement was deactivated.
The team moved the rounding to a pricing routine (VOFM) intended for such logic, and introduced an approval checklist and regression tests for all remaining implicit enhancements.
Common mistakes
- Using internal SAP variables that may change.
- Overwrite methods replacing complete SAP logic.
- No guard conditions — code runs in unrelated transactions.
- No documentation, so nobody finds the logic when debugging.
- Skipping regression tests after support packages.
Best practices
- Search and document alternatives first.
- Keep code minimal, guarded and delegated to classes.
- Prefer post-exits over overwrite exits.
- Register every implicit enhancement with owner and tests.
- Include them in upgrade and support package test plans.
Interview angle
Questions: "What are implicit enhancements and when do you use them?", "Pre/post/overwrite methods?", "Risks?"
Strong answer: implicit options at start/end of FORMs/FMs/methods, end of includes, extra parameters; for classes pre-, post- and overwrite-exits via CORE_OBJECT; they depend on SAP internals, run in all paths, are hidden and may break in upgrades; use only when no BAdI/exit/explicit point exists, keep minimal and guarded, document and regression-test.
Practice this lesson
Quick check
1. An implicit enhancement compiles after an upgrade but a SAP correction no longer takes effect. Most likely cause?
2. Which is more stable on upgrade?
3. SPAU_ENH is used after upgrades to:
Interview questions
1. You have implemented 5 customer exits in production for order processing. Now a major upgrade is scheduled. How does the upgrade affect your CMOD enhancements? What precautions should you take?
Answer it in your own words first, then compare.
2. An implicit pricing enhancement still compiled after an upgrade, but a standard pricing correction no longer worked correctly. Why can this happen, and what is your approach?
Answer it in your own words first, then compare.
Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.
More lessons in this topic
- Enhancements Part 1: SAP Enhancement Techniques Overview
- Enhancements Part 10: Enhancements in S/4HANA and Clean Core
- Enhancements Part 2: The Enhancement Framework Overview
- Enhancements Part 3: Implicit vs Explicit Enhancement Points
- Enhancements Part 4: Finding Enhancements Using Debugging
- Enhancements Part 5: Implementing Explicit Enhancement Points and Sections
- Enhancements Part 6: Enhancement Spots and Implementations
- Enhancements Part 8: Switch-Controlled Enhancements (Switch Framework)