BAdI Part 9: Performance and Database Access in BAdIs
Preview · a free account unlocks the full lesson
Keep BAdI implementations fast: how often methods are called (per item, per field change, per screen round trip), guard conditions, buffering with keyed tables per document, avoiding SELECT in loops and BAPI calls, instance creation modes, and measuring with ST05 and SAT.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 8 structured the BAdI code; this lesson makes sure that structure doesn't slow the transaction down.
BAdI methods can be called far more often than you'd expect — per item, per field change, on every Enter — so the first rule is to check guard conditions early, then use the data already available in the method's parameters, and only then, as a last resort, buffer any database reads by key.
Measure with ST05 (SQL trace) and SAT (runtime analysis) against realistically sized documents rather than guessing. One trap to watch for: buffers held in static attributes live for the entire session, so they need to be keyed and refreshed properly, or they'll eventually show stale or simply wrong data.
Start by understanding how often your BAdI is actually called. PROCESS_ITEM in ME_PROCESS_PO_CUST, for example, runs for every item on every change or check. Pricing and delivery BAdIs run per item, and again during copy, repricing, and output processing. Mass programs — MASS, uploads, VL10, billing runs — can call the same BAdI thousands of times in a single run. Use SAT, or a simple counter dropped in via the debugger, to find out the real number rather than assuming.
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
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.