Skip to Content
Author's profile photo Sander van Willigen

Implementing Extraction Enhancement using SAPI BAdI – Encapsulation via Enhancement Spot

Extraction enhancement can be defined as supplementing additional fields to an extract structure. One part is to extend (enhance) the extract structure with one or more fields. The other part is the program logic to fill these additional fields. It can be applied in any SAP source system. Although technically possible, you will rarely or never use it in the SAP BW system itself.

The best practice for applying the program logic is using the Business Add-In (BAdI) technology, i.e. implementing BAdI RSU5_SAPI_BADI. It is based on ABAP Objects programming techniques such as classes and interfaces. The “older” enhancement technology, i.e. Enhancement RSAP0001, is obsolete and should not be used anymore in new implementations.

One of the main advantages of the BAdI is that you can create more than one implementation. It is now possible to create DataSource specific implementations which are much easier to handle and support.

To make it even more comprehensive, you can create a single “generic” BAdI implementation in combination with an Enhancement Spot. Dynamically the respective DataSource specific BAdI implementation is determined and called. This avoids unnecessary calls for irrelevant BAdI implementations. It also complements the standard SAP BAdI by offering filter functionality: the exit is only processed for a particular DataSource.

The purpose of this document is to describe how to realize such a generic solution, using the Enhancement Spot technology and ABAP Object Oriented programming.

Please have a look here to download the attachments.

Step 1: Create Interfaces

SAP Menu: Tools > ABAP Workbench > Development > Class Builder

T/code: SE24

Create the following 2 interfaces as shown in the screenshots:

  • YIF_SAPI_BADI_DATA – BW SAPI BAdI Interface for General Data Transfer;
  • YIF_SAPI_BADI_HIER – BW SAPI BAdI Interface for Hierarchy Data Transfer.


Figure 1: Example of Interface Method

For Interface YIF_SAPI_BADI_DATA, the Parameters can be copied from the corresponding IF_EX_RSU5_SAPI_BADI method, i.e. DATA_TRANSFORM.


Figure 2: Interface for General Data Transfer – Parameters

For Interface YIF_SAPI_BADI_HIER, the Parameters can be copied from the corresponding IF_EX_RSU5_SAPI_BADI method, i.e. HIER_TRANSFORM.


Figure 3: Interface for Hierarchy Data Transfer – Parameters


Don’t forget to include the Tag Interface for BAdIs IF_BADI_INTERFACE.


Figure 4: Tag Interface for BAdIs

Step 2: Create Enhancement Spot

SAP Menu: Tools > ABAP Workbench > Utilities > Business Add-Ins > Business Add-Ins > Definition

T/code: SE18

Create the following Enhancement Spot as shown in the screenshot:

  • YBW_SAPI_BADI – BW SAPI BAdI Framework for Extraction Enhancement.


Figure 5: Enhancement Spot


On the overview screen of the Enhancement Spot you are able to create one or more BAdI Definitions. Create the following BAdIs definitions as shown in the screenshots:

  • YBW_SAPI_BADI_DATA – BW SAPI BAdI for General Data Transfer;
  • YBW_SAPI_BADI_HIER – BW SAPI BAdI for Hierarchy Data Transfer.

The settings of both BAdI Definitions are basically the same and will be explained by showing the screenshots for BAdI Definition YBW_SAPI_BADI_DATA.


Figure 6: BAdI Definition – Overview

Note: Although not shown on the screenshot, deactivate Multiple Use, activate Limited Filter Use and choose Reusing Instantiation instead of Newly Creating Instantiation.


Figure 7: BAdI Definition – Interface


Figure 8: BAdI Definition – Filter (1)


Figure 9: BAdI Definitions – Filter (2)

Step 3: Implement Standard SAP BAdI

SAP Menu: Tools > ABAP Workbench > Utilities > Business Add-Ins > Business Add-Ins > Implementation

T/code: SE19

Create the following implementation of standard SAP BAdI RSU5_SAPI_BADI as shown in the screenshots:

  • YRSU5_SAPI_BADI – SAPI BAdI Framework for Extraction Enhancement.


Figure 10: BAdI Implementation (1)


Figure 11: BAdI Implementation (2)

The source code of the Implementing Class YCL_IM_RSU5_SAPI_BADI has to be maintained. It can be copied from the attached file YCL_IM_RSU5_SAPI_BADI_v1.txt using the Source Code-Based mode of the Class Builder (t/code SE24).

Step 4: Create BAdI Implementations

SAP Menu: Tools > ABAP Workbench > Utilities > Business Add-Ins > Business Add-Ins > Implementation

T/code: SE19

This is a recurring action for every new extraction enhancement. Every enhancement gets its own implementing class. Here you can program the actual enhancement independently of any other enhancement.

Create a new implementation of Enhancement Spot  as shown in the screenshots.


Figure 12: Create Enhancement Implementation (1)


Figure 13: Create Enhancement Implementation (2)

Choose the appropriate BAdI Definition according to your needs: BAdI YBW_SAPI_BADI_DATA in general or YBW_SAPI_BADI_HIER for hierarchy DataSources.


Figure 14: Create Enhancement Implementation (3)


Figure 15: Enhancement Implementation – Overview


Figure 16: Enhancement Implementation – Implementing Class

The Filter must be populated with the DataSource name.


Figure 17: Enhancement Implementation – Filter

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Raman Korrapati
      Raman Korrapati

      Nice  presentation and Easy to understand about BADI enhancement.

      Thanks for your efforts and sharing with us Sander.



      Author's profile photo abilash n
      abilash n

      Nicely presented document. Thanks for sharing this.

      Author's profile photo amine lamkaissi
      amine lamkaissi

      Hi Sander,

      Thanks for this very helpful document.


      Author's profile photo Former Member
      Former Member

      Nice  presentation and Easy to understand, Thanks for sharing this

      Author's profile photo Former Member
      Former Member

      Great document!

      Got a question for you Sander since you have found a really good way of isolate the enhancement code for each datasource making transports and code changes a lot easier, but is there any way to figure it out from which SAP BW system the call is taking place?

      We have 2 SAP BW systems connected to same SAP source system but the enhancement code for the same datasource should be different depending on which system is extracting the data.

      Author's profile photo Michael Appleby
      Michael Appleby
      Sander van Willigen

      Please add the attachment mentioned either as a link or as an attached document, preferably as a link to a repository.

      Regards, Mike (Moderator)
      SAP Technology RIG

      Author's profile photo Sander van Willigen
      Sander van Willigen
      Blog Post Author


      The attachments were lost during migration and cannot be added anymore in the blog.
      Please have a look at Q&A to download the attachments.

      Best regards,

      Author's profile photo Carol Vega
      Carol Vega

      Tremendous document!

      Nice presentation and Easy to understand.


      Encapsulation is an Object Oriented Programming (OOP) concept that binds together data and functions that manipulate the data, and keeps both safe from outside interference and misuse. Data encapsulation led to the important OOP concept of data hiding. Encapsulation is a mechanism of bundling the data and the functions that use them, and data abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the user.


      Very helpful document.



      Author's profile photo Former Member
      Former Member

      is there any option to trigger the BAdI implementation.

      I have created an Enhancement Spot for: AI_CRM_IM_ENH_BW_EXTRACT
      and it never gets triggered even though its all activated (Enhancement Spot too)