ERPClimb logoERPClimb
BAdI
ABAP Developmentbeginner 8 min read

BAdI Part 2: Finding and Implementing a BAdI Step by Step

Preview · a free account unlocks the full lesson

Key takeaway

Implement a BAdI end to end: locate it (SPRO, SE18, debugger), create the implementation in SE19 for classic and new BAdIs, write the method using its parameters, raise messages the way the application expects, activate, test and transport.

In this lessonShow sections

Visual overview

BAdI Part 2: Finding and Implementing a BAdI Step by Step — learning sheetFlow: SE18: open BADI_MATERIAL_CHECK and read method CHECK_DATA → SE19: create ZIM_MAT_CHECK; implement a check that material group is mandatory for material type ZFER → Activate and test in MM01/MM02. Key ideas: FIND IT; CREATE THE IMPLEMENTATION (SE19); WRITE THE METHOD; ACTIVATE AND TEST. Watch out: An implementation that is created but not activated does nothing — and an active, faulty one can stop the whole transaction.ERPClimb.com / ABAP / LESSON 2/10 / LEARNING SHEETBAdI Part 2: Finding and Implementing a BAdI Step by Step1 · HOW IT FLOWS1SE18open BADI_MATERIAL_CHECK and readmethod CHECK_DATA2SE19create ZIM_MAT_CHECK; implement acheck that material group is…3Activate and test inMM01/MM022 · KEY IDEAS EXPLAINEDFind ItSPRO: many areas have "Business Add-Ins(BAdIs)" nodes with documentation (e.g. MM →Purchasing → BAdIs).SE18 → F4 by application component or package;SE84 → Enhancements → Business Add-Ins.Create The Implementation (SE19)Classic BAdI: Create Implementation → classic BAdIname → implementation name ZIM_… → class ZCL_IM_…is proposed.New BAdI: Create Implementation → enhancement spot→ enhancement implementation ZEI_… → BAdIimplementation ZBI_… → implementing class ZCL_……Write The MethodDouble-click the method → code. Use only themethod's parameters and what their objectsprovide.Activate And TestActivate the class and the implementation(classic: the Activate button in SE19).Set a breakpoint, run the transaction, check theparameters.3 · REMEMBER · WATCH OUTRememberFind BAdIs via SPRO ("Business Add-Ins" nodes), SE18/SE84 bypackage, or the debugger (Part 6).SE19: enter the BAdI (classic) or enhancement spot (new), create animplementation, SE19 generates the class with empty methods.Report errors the way the BAdI expects: CHANGING flags, exceptionsdeclared in the interface, or application message macros.!Watch outAn implementation that is createdbut not activated does nothing — andan active, faulty one can stop thewhole transaction.4 · IN A REAL PROJECTA material master rule required a material group for finished goods. The developer found BADI_MATERIAL_CHECKvia SPRO documentation, created ZIM_MAT_CHECK, and raised APPLICATION_ERROR with a Z message. The check workedin MM01 but mass changes via MASS and the material upload program also stopped on missing groups — intended…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Part 1 explained a BAdI's structure; now we build one from start to finish, from finding it through to activating and testing it.

Finding the right BAdI starts with SPRO, where many areas have "Business Add-Ins (BAdIs)" nodes with their own documentation — for example under MM → Purchasing → BAdIs. SE18 can also be searched with F4 by application component or by package, and SE84 has an Enhancements → Business Add-Ins node.

Find BAdIs via SPRO ("Business Add-Ins" nodes), SE18/SE84 by package, or the debugger. If you already know roughly where in the code the extension point should be, setting a breakpoint at CL_EXITHANDLER=>GET_INSTANCE or at the GET BADI statement, as covered in Part 6, will catch it as the program runs.

Whichever way you find it, read its documentation and check its "Multiple use" and filter settings before implementing it.

Creating the implementation happens in SE19. SE19: enter the BAdI (classic) or enhancement spot (new), create an implementation, SE19 generates the class with empty methods. For a classic BAdI, choose Create Implementation, enter the classic BAdI's name, give the implementation a name such as ZIM_…, and SE19 proposes an implementing class named ZCL_IM_….

For a new-style BAdI, choose Create Implementation, enter the enhancement spot, give the enhancement implementation a name such as ZEI_…, the BAdI implementation a name such as ZBI_…, and the implementing class a name such as ZCL_…; if the BAdI is filter-dependent, set the filter values at this point too. Assign a package and transport request as usual.

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.