Skip to Content

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_01_Example_Interface_Method.jpg

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_02_Interface_General_Data_Transfer_Parameters.jpg

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_03_Interface_Hierarchy_Transfer_Parameters.jpg

Figure 3: Interface for Hierarchy Data Transfer – Parameters

 

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

Figure_04_Tag_Interface_for_BAdIs.jpg

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_05_Enhancement_Spot.jpg

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_06_BAdI_Definition_Overview.jpg

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_07_BAdI_Definition_Interface.jpg

Figure 7: BAdI Definition – Interface

Figure_08_BAdI_Definition_Filter_1.jpg

Figure 8: BAdI Definition – Filter (1)

Figure_09_BAdI_Definition_Filter_2.jpg

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.jpg

Figure 10: BAdI Implementation (1)

Figure_11_BAdI_Implementation_2.jpg

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_Enhancement_Implementation_1.jpg

Figure 12: Create Enhancement Implementation (1)

Figure_13_Enhancement_Implementation_2.jpg

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_Enhancement_Implementation_3.jpg

Figure 14: Create Enhancement Implementation (3)

Figure_15_Enhancement_Implementation_Overview.jpg

Figure 15: Enhancement Implementation – Overview

Figure_16_Enhancement_Implementation_Class.jpg

Figure 16: Enhancement Implementation – Implementing Class

The Filter must be populated with the DataSource name.

Figure_17_Enhancement_Implementation_Filter.jpg

Figure 17: Enhancement Implementation – Filter

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. CH Raman

    Nice  presentation and Easy to understand about BADI enhancement.

    Thanks for your efforts and sharing with us Sander.

    Thanks

    Raman

    (1) 
  2. Mariano Cacchiarelli

    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.

    (1) 
  3. 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.

     

     

    (1) 

Leave a Reply