ERPClimb logoERPClimb
BAdI
ABAP Developmentintermediate 8 min read

BAdI Part 6: Debugging BAdIs in Real Projects

Preview · a free account unlocks the full lesson

Key takeaway

Debug BAdI problems systematically: is the BAdI called at all, which implementations are active and match the filter, is my method reached, what data arrives — using breakpoints in CL EXITHANDLER, GET BADI / CALL BADI, the implementation class, and the debugger's enhancement tools.

In this lessonShow sections

Visual overview

BAdI Part 6: Debugging BAdIs in Real Projects — learning sheetFlow: Deactivate your training implementation in a sandbox and debug: observe the BAdI reference without your class → Activate it with a wrong filter value; observe again → Correct the filter and verify with a breakpoint in the method. Key ideas: IS THE BADI CALLED?; WHICH IMPLEMENTATIONS?; IS MY METHOD REACHED?; IS THE DATA RIGHT?. Watch out: External (user) breakpoints are needed when the BAdI runs in RFC/HTTP calls (e.g. Fiori, OData); background jobs need JDBG or SM50 debugging.ERPClimb.com / ABAP / LESSON 6/10 / LEARNING SHEETBAdI Part 6: Debugging BAdIs in Real Projects1 · HOW IT FLOWS1Deactivate your trainingimplementation in asandbox and debug…2Activate it with a wrongfilter value; observeagain3Correct the filter andverify with a breakpointin the method2 · KEY IDEAS EXPLAINEDIs The BAdI Called?Set a statement breakpoint on GET BADI/CALL BADIor a method breakpoint onCL_EXITHANDLER=>GET_INSTANCE and run the…If never reached: wrong transaction step, wrongBAdI, or the code path (e.g. BAPI vs dialog)doesn't call it.Which Implementations?New BAdI: after GET BADI, inspect the BAdIreference in the debugger — it lists theimplementation classes found for the filter.Classic: step into the adapter's method to seewhich implementations are called.Is My Method Reached?Breakpoint in your implementing class method. Ifnot reached though the BAdI is called: filtermismatch, inactive implementation, or a single-use…Check filter values: company code '1000' vs '1000' or wrong characteristic.Is The Data Right?Inspect import parameters and objects (e.g.IM_HEADER->GET_DATA( )).Check whether CHANGING values are overwritten byanother implementation later (watchpoint).3 · REMEMBER · WATCH OUTRememberDebug in four steps: is the BAdI called? which implementations arefound? is my method executed? is the data what I expect?Breakpoints: statement GET BADI / CALL BADI (new), methodCL_EXITHANDLER=>GET_INSTANCE (classic), and your implementation…Most "BAdI not working" cases are: implementation inactive,filter value not matching, wrong BAdI or code path, or another…!Watch outExternal (user) breakpoints areneeded when the BAdI runs inRFC/HTTP calls (e.g. Fiori, OData);background jobs need JDBG or SM50debugging.4 · IN A REAL PROJECTA BAdI validation worked in VA01 but not when orders came from the Fiori app. The developer's sessionbreakpoint never stopped. With an external breakpoint for the Fiori user, the debugger showed the BAdI wascalled, but the filter value (sales org) was blank because the app filled it later in the process. The team…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Parts 1 through 5 built BAdI implementations; in support work, the recurring question is usually "why doesn't my BAdI run?" The debugging approach breaks down into four steps: is the BAdI even called; which implementations get found for it; does my specific method actually execute; and if it does, is the data what I expect it to be?

Useful breakpoints include a statement breakpoint on GET BADI or CALL BADI for new-style BAdIs, a method breakpoint on CL_EXITHANDLER=>GET_INSTANCE for classic BAdIs, and a breakpoint directly in your own implementation method.

Most "BAdI not working" cases trace back to one of a few causes: the implementation is inactive, a filter value doesn't match, the wrong BAdI or code path is actually involved, or another implementation is overriding yours.

One thing to plan for: when the BAdI runs inside an RFC or HTTP call, such as from Fiori or OData, you need an external (user) breakpoint rather than a session one, and background jobs need JDBG or SM50-based debugging instead.

To check whether the BAdI is called at all, set a statement breakpoint on GET BADI/CALL BADI, or a method breakpoint on CL_EXITHANDLER=>GET_INSTANCE, and run the transaction. If it's never reached, the likely explanation is that you're in the wrong transaction step, looking at the wrong BAdI, or that the code path you're exercising — a BAPI call instead of the dialog, for instance — simply doesn't call it.

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

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.