Enhancements Part 4: Finding Enhancements Using Debugging
Lessons are open to try during our launch period. Some advanced content may move to Pro later. AI practice limits apply separately.
Find the right enhancement for a requirement: breakpoints at CALL CUSTOMER-FUNCTION, GET BADI / CALL BADI and CL EXITHANDLER= GET INSTANCE, searching the program for ENHANCEMENT-POINT, SMOD by package, SE84, SPRO notes and the where-used list — then verifying the data available at that point.
In this lessonShow sectionsHide sections
Visual overview
Expert visual walkthrough
Finding Enhancements Using Debugging
Enhancements · Chapter-specific technical teaching map
Integration path
Trigger transaction
Debug call stack
Find enhancement spot
Verify conditions
Tutor's chapter takeaway
Find the right enhancement for a requirement: breakpoints at CALL CUSTOMER-FUNCTION, GET BADI / CALL BADI and CL_EXITHANDLER=>GET_INSTANCE, searching the program for ENHANCEMENT-POINT, SMOD by package, SE84, SPRO notes and the where-used list — then verifying the data…
In a real project
A requirement asked to block delivery creation for customers with an open dispute. The developer found a user exit in the delivery dialog, but deliveries were also created in background by VL10 batch jobs and via IDocs. Using…
Watch out for
• Choosing the first exit found without checking timing and data. • Testing only the dialog path, not BAPIs/IDocs/background. • Missing existing implementations of the same BAdI or exit. • Leaving session breakpoints active…
The situation: a real project scenario
A requirement asked to block delivery creation for customers with an open dispute. The developer found a user exit in the delivery dialog, but deliveries were also created in background by VL10 batch jobs and via IDocs.
Using statement breakpoints in both the dialog and a VL10 run, the team confirmed that the chosen exit (in MV50AFZ1, USEREXIT_SAVE_DOCUMENT_PREPARE) ran in all paths. The test plan included dialog, background job and IDoc creation.
Explanation
Parts 1 through 3 explained the different enhancement options available in ABAP; in real projects, the hard part is usually not knowing the options but finding the specific one that fires at the moment you need.
Start from the business step itself — for instance, saving a sales order — and work out which enhancements the program calls at that exact moment. In the debugger, you can set a breakpoint at the statement CALL CUSTOMER-FUNCTION for classic user exits, at GET BADI or CALL BADI for new-style BAdIs, or at the method CL_EXITHANDLER=>GET_INSTANCE for classic BAdIs.
For static searching, look at the package of the transaction's program and check SMOD enhancements, SE18 BAdIs, and SE84, and keep in mind that SPRO documentation often names the relevant BAdI directly.
Finding a call site is only half the job, though — you still need to confirm that the data you need is actually available and changeable at that point, and that the call happens at the right time in the overall process.
Before searching, get clear on the requirement itself: which transaction and which step — create, change, check, save, or output — is involved, and is the goal to validate something, default a value, or actually change data? It also matters whether this needs to work only online or also through BAPIs and IDocs, since an exit that only fires in the dialog won't help if the same data also arrives through an interface.
For debugger techniques, use /h to get into the new debugger, then go to Breakpoints → Breakpoint at → Statement and enter CALL CUSTOMER-FUNCTION. Run the step you're interested in, and each time the debugger stops you'll see which customer exit number was called.
The statements GET BADI and CALL BADI serve the same purpose for new BAdIs, where the variable's type reveals the BAdI's name, while CL_EXITHANDLER=>GET_INSTANCE serves this role for classic BAdIs, with the EXIT_NAME variable showing which BAdI is involved. For Business Transaction Events in FI, set a breakpoint in the function modules BF_FUNCTIONS_FIND or PC_FUNCTION_FIND instead.
In all these cases, look at the call stack to understand exactly which program and FORM you've landed in.
For a more static search, check System → Status to get the program name, then look it up in SE80 to find its package. From there, SMOD's Utilities → Find function, searching by that package, will surface customer exits, while SE18 or SE84's Enhancements browsing by package or application component will surface BAdIs. Within the program itself, Ctrl+F for CALL CUSTOMER-FUNCTION, ENHANCEMENT-POINT, or CALL BADI will find enhancement call sites directly. SPRO is also worth checking, since many configuration areas include "Business Add-Ins" nodes with their own documentation.
Once you have a candidate, verify it: set a breakpoint inside the exit or BAdI and check both the timing and what data is actually available there, through its import and export parameters or global SAP data. Check SE19 or CMOD for existing implementations too, since the enhancement might already be in use for something else. For SD user exits specifically, SAP's documentation in the include often lists exactly which tables are available at that point.
Once you've settled on an enhancement, document it: record the original requirement, the enhancement you chose, your reasoning, and the test cases you ran — covering the online transaction as well as any BAPI or IDoc paths.
To practice: start VA02, issue /h before saving, and set statement breakpoints for both CALL CUSTOMER-FUNCTION and CALL BADI; save and note every stop that occurs; then pick the best candidate for "validate PO number at save" and set a breakpoint inside it.
One useful tip: activate these as session breakpoints, and in the debugger settings, turn off "system debugging" unless you specifically need to step through standard SAP system code. With this you should be able to locate candidate enhancements using the debugger and choose between them based on timing and available data.
Code example
* ===== Statements to set breakpoints on (Debugger: Breakpoint at -> Statement) =====* CALL CUSTOMER-FUNCTION -> customer exits (SMOD/CMOD)* GET BADI / CALL BADI -> new BAdIs* CALL METHOD cl_exithandler=>get_instance -> classic BAdIs (see EXIT_NAME) * ===== What you see in SAP code when the debugger stops =====* Customer exit:* CALL CUSTOMER-FUNCTION '002'* EXPORTING ...* -> function module EXIT_<program>_002, customer include ZX... * Classic BAdI:* CALL METHOD cl_exithandler=>get_instance* EXPORTING exit_name = 'BADI_NAME' " <- the BAdI to implement in SE19* CHANGING instance = l_exit. * New BAdI:* DATA l_badi TYPE REF TO badi_name. " <- BAdI name in the type* GET BADI l_badi.* CALL BADI l_badi->method ... * ===== Small helper report: find customer exits in a program =====REPORT zfind_exits.PARAMETERS p_prog TYPE progname DEFAULT 'SAPMV45A'. DATA: lt_source TYPE STANDARD TABLE OF string, lv_line TYPE string, lv_tabix TYPE sy-tabix. START-OF-SELECTION. READ REPORT p_prog INTO lt_source. " loads the program's source lines into an internal table IF sy-subrc <> 0. WRITE: / 'Program not found:', p_prog. RETURN. ENDIF. LOOP AT lt_source INTO lv_line. lv_tabix = sy-tabix. TRANSLATE lv_line TO UPPER CASE. " so the CS comparisons below match regardless of source case IF lv_line CS 'CALL CUSTOMER-FUNCTION' OR lv_line CS 'ENHANCEMENT-POINT' OR lv_line CS 'CALL BADI'. " the three textual markers an exit/enhancement call leaves behind WRITE: / lv_tabix, lv_line. ENDIF. ENDLOOP.* Note: only the main program source is scanned, not its includes.* For a full search use SE80 Find in all includes or the code scanner (CODE_SCANNER).Watch out
Common mistakes
- Choosing the first exit found without checking timing and data.
- Testing only the dialog path, not BAPIs/IDocs/background.
- Missing existing implementations of the same BAdI or exit.
- Leaving session breakpoints active in shared systems.
- Relying only on internet lists of exits instead of verifying in the system.
Do this
Best practices
- Start from the business step and verify in the debugger.
- Use statement breakpoints for exits and BAdIs.
- Check all processing paths (dialog, background, interfaces).
- Check existing implementations first.
- Document requirement, enhancement and tests.
In the interview
Interview angle
Questions: "How do you find a user exit or BAdI for a transaction?", "How do you find which BAdIs are called?"
Strong answer: debugger breakpoints at statements CALL CUSTOMER-FUNCTION, GET BADI/CALL BADI and method CL_EXITHANDLER=>GET_INSTANCE; static search via package → SMOD/SE18/SE84, SPRO BAdI nodes, searching the program; then verify timing, available data and all processing paths, and check existing implementations.
Practice this lesson
Quick check
0 of 3 questions attempted
Question 1 of 3
Which breakpoint in the debugger shows the names of classic BAdIs called by a transaction?
Question 2 of 3
In the debugger, which statement breakpoint helps find customer exits called during saving?
Question 3 of 3
Which ABAP syntax pair is used to obtain and invoke a new BAdI?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1Your CMOD project created yesterday is not being invoked. What are the most common reasons, and how would you systematically troubleshoot this issue?
2Explain how a function-module exit works. How do you verify the exact purpose of an EXIT_* function module before implementing it?
Try a related Code Lab
This published exercise covers the same SAP topic. Apply the ideas in a hands-on scenario, then return to review your answers.
Open: Add a delivery block via BAdI instead of modification →See it in code
Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.
Was this lesson helpful?
Keep exploring
Interview questions on this topic
Related SAP topics
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.