Learn about a new method you and your BW team can use to report on information obtained when you add new partner functions to SAP CRM — the Business Document Business Add-In. This six-step process allows you to collect data in real time and enables you to load the data into SAP NetWeaver Business Intelligence to use for reporting. You can also use this process to add other customized fields to SAP CRM.
Key Concept
SAP CRM uses BW Adapter to extract data from SAP CRM and send it to SAP Business Information Warehouse and SAP NetWeaver Business Intelligence. You use BW Adapter when you have Synchronization Business Documents (sBDocs) and Messaging Business Documents (mBDocs). For sBDocs, BW Adapter extracts objects relevant to mobile clients. For mBDocs, BW Adapter extracts objects for CRM business transactions and CRM billing.
Say you add a new partner function in SAP CRM and you want to be able to report on it using SAP NetWeaver Business Intelligence (BI). You’ve checked transaction BWA5 and you know that the DataSource is handled by BW Adapter. You want to populate the enhanced fields in real time, which means that the enhanced fields are written to the delta at the time you save the transaction. In this case, you can use a Business Document (BDoc) Business Add-In (BAdI) to enhance the CRM DataSource. This is a new process — many CRM-BW implementations still use the traditional BAdI or user exit processes.
I’ll show you how to carry out this new process. First, you need to check if the partner function you want to use is available in the standard extractor in transaction RSA6. Then I’ll walk you through the six steps you need to take to add a new partner function to the SAP CRM sales order extractor and use the BDoc BAdI. I used SAP CRM 2005 for this process, but it also applies to SAP CRM 4.0. The process in this article involves the BI capabilities of SAP NetWeaver 2004s, but you can use this process with earlier versions, such as SAP Business Information Warehouse (BW) 3.5. Typically a BW back-end developer who has SAP CRM as the DataSource in the BW system performs these steps.
Business Scenario
In my example, I want to add the partner function PLANT Ship-To Party for Returns to the SAP CRM sales order. This tracks returned items so I can report on them using the BI capabilities of SAP NetWeaver 2004s. The standard extractor in this case, 0CRM_SALES_ORDER_I, does not include this partner function.
Figure 1 shows the business-to-consumer (B2C) Internet Sales screen after CRM partner function configuration is complete. In the process I describe, I’ll explain how SAP NetWeaver BI extracts this partner function.

Figure 1
The CRM Sales Order has a value 4444444444 for partner function PLANT Ship-To Party for Returns
Check Partner Function Availability
In this example, I checked the standard extractor using transaction code RSA6 first (Figure 2). In this screen you can see the list of all of the activated DataSources in the source system. Click on the DataSource 0CRM_SALES_ORDER_I to bring up the screen in Figure 3. As you can see, the partner function PLANT Ship-To Party for Returns is not included.

Figure 2
Click on the DataSource 0CRM_SALES_ORDER_I to view all of the fields in the extraction structure

Figure 3
Fields in the standard extractor for CRM Sales Order extractor CRMT_BW_SALES_ORDER_I
Now that I know that the partner function I need is not standard, I will show you step by step how to add it.
Add a New Partner Function
Follow these six steps to add the new partner function to the SAP CRM sales order:
Step 1. Create an append structure for the 0CRM_SALES_ORDER_I
Step 2. Check if the business content is active for the SAP CRM sales order DataSource
Step 3. Check the extraction structure and the BDoc mapping
Step 4. Create a new BAdI implementation to fill the enhanced field in the append structure
Step 5. Activate the new BAdI implementation
Step 6. Test the new BAdI implementation in the extractor checker
Step 1. Create an append structure for 0CRM_SALES_ORDER_I. In the append structure you add an enhanced field that contains the partner function. Double-click on the structure CRMT_BW_SALES_ORDER_I in Figure 3. The Display Append Structure screen appears. Select Goto>Append Structure to create a new or select an existing append structure. In my example, I selected the existing append structure ZBW_SALE_ITEM. Add the enhanced field as a new component in the append structure and call it something meaningful, such as ZZPLANT_PARTNER (Figure 4).

Figure 4
ZZPLANT_PARTNER added in the append structure
Step 2. Check if the business content is active for the SAP CRM sales order DataSource. Follow IMG menu path SBIW>Data Transfer to the SAP BIW>Settings for Application-Specific DataSources (CRM). In this example, I have a Messaging Business Document (mBDoc) because I am not dealing with mobile clients. For mBDocs, BW Adapter extracts objects for CRM business transactions and CRM billing use the BAdI CRM_BWA_MFLOW. BW Adapter calls the mBDoc BAdI CRM_BWA_MFLOW to enhance the partner function PLANT Ship-To Party for Returns.
In SAP CRM 2005, use transaction code BWA5 to check if the business content is active for your CRM DataSource — in my example, this is 0CRM_SALES_ORDER_I (Figure 5). In SAP CRM 2005, the business content should be active automatically. However, in releases prior to SAP CRM 2005, after using transaction code RSA5 to activate business content in SAP CRM, you must use transaction code BWA5 to activate the business content for the BW Adapter.

Figure 5
Transaction BWA5: The DataSources in CRM marked as Active for BW Adapter
Step 3. Check the extraction structure and the BDoc mapping. Use transaction code BWA1 (create or enhance new CRM-specific DataSources using the BW Adapter). Enter the CRM DataSource you want to check — in my example, this is 0CRM_SALES_ORDER_I
(Figure 6). Click on the Display button to see the extract structure and confirm that it matches your CRM DataSource (Figure 7).

Figure 6
Check the 0CRM_SALES_ORDER_I DataSource

Figure 7
The extract structure in this screen matches 0CRM_SALES_ORDER_I
Figure 7 shows that the BW Adapter knows about the additional field, but it does not yet know how to fill it. In the following steps you show BW Adapter how to fill these fields. The Mapping tab contains the mapping of BDoc fields to the extract structure fields, but you don’t need to take any action here.
Step 4. Create a new BAdI implementation to fill the enhanced field in the append structure. The Object-Oriented (OO) ABAP code in a BAdI is based on the concept of classes, methods, and inheritance, but you do not have to understand this fully to implement a BAdI. Simply think of methods as a function module with the same import and export parameters and follow the simple instructions below to implement the BDoc BAdI.
In transaction SE19 (BAdI implementations), in the Create Implementation section, select Classic BAdI and enter CRM_BWA_MFLOW as the BAdI Name (Figure 8). Click on the Create Impl. button and name the new implementation ZBI_EXT_ORDITM
.

Figure 8
Enter CRM_BWA_MFLOW as the BAdI Name to create a new implementation
After you create ZBI_EXT_ORDITM, click on the Interface tab to see the BAdI implementation with the Interface Name IF_EX_CRM_BWA_MFLOW (Figure 9). The system assigns the method ENHANCE_DATA_SOURCE, which contains the logic to populate the enhanced field.

Figure 9
BAdI implementation with interface name IF_EX_CRM_BWA_MFLOW and method ENHANCE_DATA_SOURCE
Double-click on ENHANCE_DATA_SOURCE and enter the coding for the method between the method
and endmethod
statements (Figure 10). You can download the code for this section by clicking this link.

Figure 10
Add the code in the BAdI method
Step 5. Activate the new BAdI implementation. In transaction SE19, click on Enhancement Implementation>Activate to activate ZBI_EXT_ORDITM. After you implement this BAdI, you can also display your implementation by using transaction code SBIW and following IMG menu path Data Transfer to the SAP Business Information Warehouse> Settings for Application-Specific DataSources (CRM)>Settings for BW Adapter>BAdI BW Adapter: Enhancement of DataSource in the Messaging Flow.
Step 6. Test the new BAdI implementation in the extractor checker. After you add the new implementation ZBI_EXT_ORDITM, run transaction RSA3. You’ll see the screen in Figure 11 (without the Debug Mode check box selected). Execute the extractor checker. If you filter the value to this sales order, you see the result shown in Figure 12 (ZZ_PLANT_PARTNER populated with partner number 4444444444).

Figure 11
Test the new BAdI implementation

Figure 12
The enhanced field shows the expected value 4444444444
If the value is not what you expected — in this example 4444444444 — select Debug Mode in Figure 11 and run the extractor checker again. Set the BAdI breakpoint for debugging at the first stop when you run transaction RSA3, as shown in Figure 13.

Figure 13
Set the breakpoint at the method you want to debug
Now that you have the enhanced field in the extract structure and have populated the value with the BDoc BAdI, it is ready for the BW team to extract to SAP NetWeaver BI. Follow the same process that you would for any other enhancements:
- Replicate the enhanced DataSource in SAP BW
- Add the enhanced InfoObject in the data container: DataStore Object or InfoCube
- Map the enhanced fields in the transformation or InfoSource
- Load the data
Liang Ma
Liang Ma is a specialist master in Deloitte’s SAP BI/BW practice, specializing in BI and data warehouse solutions in the SAP platform. She has more than 10 years of SAP experience including SAP NetWeaver BW, SAP BusinessObjects, and ABAP. Liang recently spoke at the SAP conferences SAP CRM 2011, SAP Reporting, Planning and Analytics 2010, SAP CRM 2009, SAP CRM 2010 and SAP Business Objects User 2009. In addition, she has also published articles in the following SAPexperts hubs: BI, CRM, and Financials.
Deloitte shall not be responsible for any loss sustained by any person who relies on this publication. As used in this document, “Deloitte” means Deloitte Consulting LLP, a subsidiary of Deloitte LLP. Please see www.deloitte.com/us/about for a detailed description of the legal structure of Deloitte LLP and its subsidiaries.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.