When working with standard extractors delivered as part of SAP BW business content, you may have had to execute several requests to enhance standard functionality in these extractors. You have probably used SAP user exit RSAP0001, but a Business Add-In (BAdI) may work better. See why and how to use BAdIs.
Key Concept
As part of its business content, SAP delivers several standard extractors in SAP source systems. These extractors, when implemented as part of the process of installing DataSources from business content, enable you to extract data from your desired application. Often, users need to enhance these standard extractors to meet the specific needs of their business or the application area. The process is well documented. To quickly recap: In the source system, you activate your DataSource, analyze it, and find that you need to enhance it. You edit the DataSource via transaction RSA6 where you add (using an append structure) the fields you feel are missing from SAP’s standard extract structure. You populate these fields using SAP user exit RSAP0001.
Since R/3 Release 4.6C, SAP has recommended using Business Add-Ins (BAdIs) rather than user exits as a more efficient way to enhance SAP standard content. Despite this fact, most experienced SAP professionals still employ user exits in even the latest releases (R/3 Enterprise and mySAP ERP). In addition, SAP sometimes suggests user exits even when corresponding BAdIs exist, especially to enhance standard SAP extractors.
For example, consider the conventional way of populating newly added fields in the extract structure by adding the required code in SAP user exit RSAP0001. A BAdI has been available to do the same thing since the release of Basis 6.20 and PI_BASIS_2004_1 plug-in. The technical name of this BAdI is RSU5_SAPI_BADI. Unfortunately, despite several advantages that it provides over user exit RSAP0001, the latter is still very popular even among implementations that are on or above Basis 6.20 and plug-in PI_BASIS_2004_1.
Based on my experience, SAP professionals are unfamiliar with and therefore under-use the BAdI RSU5_SAPI_BADI. In this article, I’ll briefly talk about the concept of a BAdI and its advantages and drawbacks. Then I’ll provide a detailed overview of how to use BAdI RSU5_SAPI_BADI and walk you through the steps of implementing this BAdI to enhance existing extractor functionality.
Differences Between a BAdI and a User Exit
If you are comfortable with user exits, you might wonder whether using BAdIs provides any potential payoffs over user exits. A few important benefits might convince you to give BAdIs a try:
- A BAdI can have several active implementations. When you set the Multiple use flag in the BAdI definition screen in SE18, several developers can independently work on different implementations of the same BAdI. You can have multiple active implementations of the same BAdI with each implementation containing logic for a different country.
- In the case of BAdI RSU5_SAPI_BADI, developer A can enhance DataSource X, developer B can enhance DataSource Y, and so on. You can also independently test each enhancement. This is an advantage over a user exit, especially RSAP0001, which has four components: function modules EXIT_SAPLRSAP_001 (transaction data), EXIT_SAPLRSAP_002 (master data), EXIT_SAPLRSAP_003(text data) and EXIT_SAPLRSAP_004 (hierarchies). If you add code to populate new fields in a transactional DataSource, you are probably doing so inside include ZXRSAU01 of function module EXIT_SAPLRSAP_001.
- At any given time, only one developer can code within this include. I have worked on and come across projects in which clients wanted major enhancements on several DataSources and asked several developers to work concurrently on this include. If you were to use BAdI RSU5_SAPI_BADI, you would not face this problem.
- Because you can potentially create several independent implementations of a BAdI, you can prevent object and transport locks and inconsistencies by having individual developers working on separate implementations. Let’s assume that there is no need to develop a user exit in parallel. Developer A enhances one or more DataSources, developer B enhances a different set of DataSources, and so on. This is still not an ideal situation because different developers have to code the same user exit (function modules and includes). This can easily lead to code inconsistencies and object locks. The latter problem leads to transport or change request errors. For example, if developer A has a lock on the user exit object, the system creates developer B’s task under developer A’s change request. Developer A is therefore unable to release the change request until B releases his task.
- BAdIs allow you to filter based on a certain criterion. Most commonly, you want to filter an enhancement based on how it applies to a specific country or industry sector (IS). User exits can realize filtering of this sort by using conditional statements but it requires additional code checks. The logic to realize filtering can be complex and the code can become unwieldy, possibly increasing processing time when you use that exit. In contrast, you can create separate BAdI implementations based on unique filter values (for example countries or the IS). At runtime, the system invokes the relevant implementation based on the active filter.
Tip!
Using a BAdI has a known downside. When you make a BAdI multiple-use (by checking the Multiple use flag in the BAdI definition in transaction SE18), you can run into problems with the execution sequence of the active implementations. You cannot have implementation 1 execute before or after implementation 2. The danger inherent in this technical shortcoming is that if a method in your BAdI contains changing parameters, implementation 1 may overwrite the results returned by implementation 2 and vice versa. This situation is possible with BAdI RSU5_SAPI_BADI because it is a multiple-use BAdI and has methods with changing parameters.
How to Find a BAdI
To find a BAdI, run transaction SE18 (BAdI definition). In the Definition name field, type RSU5_SAPI_BADI
. You should see the screen shown in Figure 1.

Figure 1
Attributes screen for BAdI RSU5_SAPI_BADI
Note that the Multiple use box is checked, which means it could have several active implementations. The Filter-Dependbox is not checked, which makes sense because this is a general purpose BAdI. It is not country or IS specific. Click on the Interface tab and you see the screen shown in Figure 2.

Figure 2
Interface view of BAdI definition screen
This BAdI has two methods:
- DATA_TRANSFORM enhances master (text and attributes) and transactional DataSources. You use it to populate fields you that you added to standard SAP extract structures.
- HIER_TRANSFORM enhances hierarchy DataSources.
The concept of methods is closely tied to the concept of objects and classes in object-oriented (OO) programming and OO ABAP in particular. Methods are routines that determine the behavior of a class. They have an interface containing sending and receiving parameters analogous to the interface of a function module. Unlike the user exit for DataSource enhancements RSAP0001 for which you use three function modules, here you have two methods.
Let’s look at the interface of the DATA_TRANSFORM method to understand its parameters. Double-click on DATA_TRANSFORM and then click on the Parameters button. You should see the screen in Figure 3.

Figure 3
Parameters of method DATA_TRANSFORM of BAdI RSU5_SAPI_BADI
Now, compare this interface with that of the function module EXIT_SAPLRSAP_001, which is the conventionally used transaction data component of user exit RSAP0001 (Figure 4).

Figure 4
Parameters of function module to enhance transaction DataSources with user exit RSAP0001
Hardly any differences exist between the BAdI method and those in the function module. Both accept (import) the DataSource (I_DATASOURCE) and the update mode (I_UPDMODE). Both return the dataset in internal table C_T_DATA. The interface for the BAdI remains similar to that of the user exit. Once you assimilate the similarities, you can easily migrate from user exit RSAP0001 to BAdI RSU5_SAPI_BADI. It is primarily to ensure this seamless migration from user exit to a BAdI that SAP tried to impose significant similarities in the two approaches.
You may have a sample implementation guide for this BAdI depending on what release you are on. If you run Basis 6.20 and have plug-in PI_BASIS 2004_1 or higher, you should have this BAdI definition and at least one sample SAP implementation. When I look for active implementations in our system (we run Basis 6.20 and have plug-in PI_BASIS 2004_1), I find two. Since at this time you do not know the names of existing implementations, click on Implementation in the menu in Figure 2 and select Overview. If you have a sample implementation, you should see the pop-up screen in Figure 5.

Figure 5
List of existing BAdI implementations for RSU5_SAPI_BADI
You can see the two currently active implementations: FC_CRM_BUAG_BW and GMBW_IMP_RSU5_SAPI. (Now that you know the names of the active implementations, you can simply run transaction SE19 and type in the name of the implementation.) Double-click on the name of either of the implementations and you are taken to the display screen of this implementation. If you are in the Interface tab of this implementation, you see the names of the two methods of this BAdI (DATA_TRANSFORM and HIER_TRANSFORM). Double-click on the DATA_TRANSFORMmethod to go to the code for this method.
Create Your Own Implementation
I will now show you the steps involved in creating an actual implementation. Go back to the screen shown in Figure 5. Click on the create icon, or if you are on a release that does not have any active implementations, simply select Create from the Implementation menu item. You arrive at the screen shown in Figure 6.

Figure 6
Create a new BAdI implementation
Give your implementation a meaningful (technical) name. I named it ZMASTER_IMP1
because I plan to put all enhancements to standard master data DataSources in this implementation (Figure 7). You should give it a name that describes the implementation in some measure. Press Enter to go to the next screen where you enter a short text for your implementation. I will call it Anurag's test implementation for master data extractors
. Use meaningful text.

Figure 7
Save the attributes of a new implementation
When you attempt to save, the system asks you to specify the development class/package that this object should go under. Talk to your development lead or other team members to find out what is the right package for you. For the purposes of this example, I’ll save it as a local object. After successfully saving, click on the Interface tab and you see the screen shown in Figure 8.

Figure 8
Interface tab shows methods and other implementation details
Since BAdIs are based on an OO paradigm (and implemented using OO ABAP), the system provides an interface (technical name IF_EX_RSU5_SAPI_BADI). This serves as the framework that you use to implement your enhancement logic. The other OO-related piece is the technical name of the generated class (ZCL_IM_MASTER_IMP1). This is the class that the system generates when you save your implementation. It is this class that implements the interface IF_EX_RSU5_SAPI_BADI, which means that it automatically inherits the method (or stub). If you are curious, double-click on the name of this class to go to Class Builder where you can find all the information about your class.
At this stage, you have already appended the desired fields to the standard SAP extract structure. Using the RSA6 transaction, you opened up the application nodes until you arrived at the desired DataSource, and enhanced the corresponding extract structure as described earlier in the article. (For more information, see the article by Nathan Genez in the March 2003 issue of BW Expert, “Enhancing DataSources in Standard Business Content to Suit Your Needs.”)
Now, double-click on method DATA_TRANSFORM to go to the Class Builder screen that contains the empty method (Figure 9). Insert your enhancement logic. (I inserted comments in the editor screen, so you can use it as a template for your implementation). At this point, you can put yourself back into the world of user exit RSAP0001. The code that you put in is the same that you would have put into the corresponding function module of the user exit.

Figure 9
Enhancement logic with author’s comments for method DATA_TRANSFORM
Once you’ve put in your logic and checked the syntax, activate your method. Note that activating your method does not activate the BAdI implementation. Therefore, you go back to the previous screen and activate to ensure that your implementation is active. You should now be ready to test your enhancement (and your BAdI implementation) by running the extractor checker in transaction RSA3. If you need a detailed overview of this tool/transaction, refer to my article “Identify Data Errors Early with the Extractor Checker.”
Anurag Barua
Anurag Barua is an independent SAP advisor. He has 23 years of experience in conceiving, designing, managing, and implementing complex software solutions, including more than 17 years of experience with SAP applications. He has been associated with several SAP implementations in various capacities. His core SAP competencies include FI and Controlling FI/CO, logistics, SAP BW, SAP BusinessObjects, Enterprise Performance Management, SAP Solution Manager, Governance, Risk, and Compliance (GRC), and project management. He is a frequent speaker at SAPinsider conferences and contributes to several publications. He holds a BS in computer science and an MBA in finance. He is a PMI-certified PMP, a Certified Scrum Master (CSM), and is ITIL V3F certified.
You may contact the author at Anurag.barua@gmail.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.