ERPClimb logoERPClimb
BAdI
ABAP Developmentintermediate 7 min read

BAdI Part 4: Classic BAdI vs New BAdI

Preview · a free account unlocks the full lesson

Key takeaway

Compare classic BAdIs (SE18 definition, CL EXITHANDLER, interface IF EX …) with new kernel BAdIs (enhancement spots, GET BADI / CALL BADI, IF BADI INTERFACE): performance, filters, fallback classes, instance handling, migration and how to recognise each in SE18/SE19.

In this lessonShow sections

Visual overview

BAdI Part 4: Classic BAdI vs New BAdI — learning sheetFlow: SE18: display classic BAdI ME_PROCESS_PO_CUST and note interface and adapter class → SE18: display a new BAdI in an enhancement spot (e.g. your own ZBADI from Part 3) → Compare the calling code in both cases in the debugger. Key ideas: CLASSIC BADI; NEW BADI (ENHANCEMENT FRAMEWORK); MIGRATED CLASSIC BADIS; RECOGNISING THEM. Watch out: Many SAP classic BAdIs have been migrated: the classic name still exists but is called via a new BAdI — check SE18 before debugging the wrong one.ERPClimb.com / ABAP / LESSON 4/10 / LEARNING SHEETBAdI Part 4: Classic BAdI vs New BAdI1 · HOW IT FLOWS1SE18display classic BAdIME_PROCESS_PO_CUST and note…2SE18display a new BAdI in anenhancement spot (e.g. your own…3Compare the calling codein both cases in thedebugger2 · KEY IDEAS EXPLAINEDClassic BAdIDefinition: SE18 (classic view), interfaceIF_EX_<badi>, adapter classCL_EX_<badi> generated by SAP.Call: cl_exithandler=>get_instance( CHANGINGinstance = l_badi ) → l_badi->method( ).New BAdI (Enhancement Framework)Definition inside an enhancement spot (SE18/SE20),BAdI name as a type: DATA l_badi TYPE REF TObadi_name.Call: GET BADI l_badi FILTERS … . CALL BADIl_badi->method … .Migrated Classic BAdIsSAP converted many classic BAdIs: SE18 shows"Migrated" and the enhancement spot.Existing classic implementations keep working. New…Recognising ThemIn code: CL_EXITHANDLER → classic; GET BADI → new.In SE18: classic shows interface IF_EX_…; newshows enhancement spot and BAdI definition.3 · REMEMBER · WATCH OUTRememberClassic BAdIs (before NetWeaver 7.0) are called throughCL_EXITHANDLER=>GET_INSTANCE; new BAdIs through the ABAP statements…New BAdIs belong to enhancement spots, are handled by the kernel(faster) and support fallback classes and more flexible filters.Both are implemented as classes in SE19; you implement whatever SAPcalls — you cannot choose the type.!Watch outMany SAP classic BAdIs have beenmigrated: the classic name stillexists but is called via a new BAdI— check SE18 before debugging thewrong one.4 · IN A REAL PROJECTA developer spent hours debugging why a classic BAdI implementation for material documents did not run afteran upgrade. SE18 showed the BAdI as migrated to an enhancement spot, and the new code path called GET BADIwith a filter the old implementation did not have. After creating the implementation in the migrated spot with…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Parts 1 through 3 of this series used both kinds of BAdI without dwelling on the difference; this lesson makes that difference explicit, because support work involves both. Classic BAdIs, predating NetWeaver 7.0, are called through CL_EXITHANDLER=>GET_INSTANCE, while new BAdIs are called through the ABAP statements GET BADI and CALL BADI.

A classic BAdI is defined in SE18's classic view, with an interface named IF_EX_<badi> and an adapter class CL_EX_<badi> generated by SAP. It's called with cl_exithandler=>get_instance( CHANGING instance = l_badi ). followed by l_badi->method( ).. It's implemented in SE19's classic mode as a class named ZCL_IM_<impl>. It supports only one filter type (for example LAND1), with the filter value passed in as the method parameter FLT_VAL, and it's activated with a button in SE19, with the adapter checking active implementations at runtime — which carries some overhead.

A new BAdI, part of the Enhancement Framework, is defined inside an enhancement spot (in SE18 or SE20), and used with the BAdI name as a type: DATA l_badi TYPE REF TO badi_name.. It's called with GET BADI l_badi FILTERS … . followed by CALL BADI l_badi->method … ..

It's implemented as an enhancement implementation containing a BAdI implementation, itself a class combining IF_BADI_INTERFACE with the BAdI's own interface. It supports several filter characteristics with real comparisons (=, <>, CP, and so on) defined per implementation, with no FLT_VAL parameter needed, and it supports a fallback class, different instance creation modes (new instance or reuse), and context-dependent BAdIs.

Because it's handled by the kernel, it carries significantly less runtime overhead than the classic style.

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.