Enhancements
ABAP Developmentintermediate

Enhancements Part 4: Finding Enhancements Using Debugging

Key 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 available at that point.

Explanation

📌 KEY POINTS
✅ Start from the business step (e.g. saving a sales order) and find which enhancements the program calls at that moment.

✅ Debugger: breakpoint at statement CALL CUSTOMER-FUNCTION, GET BADI / CALL BADI, and method CL_EXITHANDLER=>GET_INSTANCE (classic BAdIs).

✅ Static search: package of the transaction → SMOD enhancements, SE18 BAdIs, SE84; SPRO documentation often names the BAdI.

⚠️ Finding a call is not enough — check that the data you need is available and changeable there, and that it runs at the right time.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Parts 1–3 explained the options. In real projects, the hard part is finding the right one.

━━━━━━━━━━━━━━━━━━━━
▶ 1. UNDERSTAND THE REQUIREMENT

  • Which transaction and step? (create/change, check, save, output)
  • Validate, default a value, or change data?
  • Online only or also for BAPIs/IDocs? (An exit in the dialog only may not run for interfaces.)

━━━━━━━━━━━━━━━━━━━━
▶ 2. DEBUGGER TECHNIQUES

  • /h, then in the new debugger: Breakpoints → Breakpoint at → Statement: CALL CUSTOMER-FUNCTION. Run the step; each stop shows a customer exit number.
  • Statement GET BADI and CALL BADI for new BAdIs; the variable type shows the BAdI name.
  • Method CL_EXITHANDLER=>GET_INSTANCE for classic BAdIs: variable EXIT_NAME shows the BAdI.
  • For BTEs (FI): breakpoint in function modules BF_FUNCTIONS_FIND / PC_FUNCTION_FIND.
  • Look at the call stack to see the program and FORM where you are.

━━━━━━━━━━━━━━━━━━━━
▶ 3. STATIC SEARCH

  • System → Status → program name → SE80 → package.
  • SMOD → Utilities → Find with that package: customer exits.
  • SE18 / SE84 → Enhancements → BAdIs by package or application component.
  • In the program: Ctrl+F for CALL CUSTOMER-FUNCTION, ENHANCEMENT-POINT, CALL BADI.
  • SPRO: many areas have "Business Add-Ins" nodes with documentation.

━━━━━━━━━━━━━━━━━━━━
▶ 4. VERIFY THE CANDIDATE

  • Set a breakpoint in the exit/BAdI and check timing and available data (import/export parameters, global SAP data).
  • Check existing implementations (SE19, CMOD) — maybe it is already used.
  • For user exits in SD, SAP documentation in the include lists the available tables.

━━━━━━━━━━━━━━━━━━━━
▶ 5. DOCUMENT

Record: requirement → chosen enhancement → reason → test cases (online, BAPI, IDoc).

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. Start VA02, /h before saving; set statement breakpoints for CALL CUSTOMER-FUNCTION and CALL BADI.
  2. Save and note each stop.
  3. Pick the best one for "validate PO number at save" and set a breakpoint inside it.

💡 Tip: activate the breakpoints as session breakpoints; in the debugger settings disable "system debugging" unless you need standard system code.

✅ CHECKPOINT: you can locate candidate enhancements with the debugger and choose one based on timing and data.

Code example

ABAP Code
* ===== 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.  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.    IF lv_line CS 'CALL CUSTOMER-FUNCTION' OR lv_line CS 'ENHANCEMENT-POINT'       OR lv_line CS 'CALL BADI'.      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).

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.

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.

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.

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

1. Which breakpoint in the debugger shows the names of classic BAdIs called by a transaction?

2. In the debugger, which statement breakpoint helps find customer exits called during saving?

3. Which ABAP syntax pair is used to obtain and invoke a new BAdI?

Interview questions

1. Your CMOD project created yesterday is not being invoked. What are the most common reasons, and how would you systematically troubleshoot this issue?

Answer it in your own words first, then compare.

2. Explain how a function-module exit works. How do you verify the exact purpose of an EXIT_* function module before implementing it?

Answer it in your own words first, then compare.

Practice more with Interview AI →

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

Interview questions on this topic

Related SAP topics