SAP CRM Marketing allows you to build target groups so that you can send campaigns to large distribution lists. A deduplication method ensures that each business partner is contacted just once for any given campaign.
Key Concept
SAP CRM Marketing allows you to build target groups based on contacts’ marketing attributes or other criteria, such as their country or language. Depending on the criteria you use to create your target group and the number of duplicate records in your database, you may see duplicate records in your target group after you build it. Business Add-In CRM_MKT_BP_DETRMINE enables you to eliminate duplicate records based on rules that you define.
When you execute a marketing campaign in SAP CRM, you must first use the Segment Builder to create a target group. The target group is the list of contacts who will receive the campaign. You can build target groups using any filter criteria you choose. You may build a target group based on one or more marketing attributes, or you can create a target group based on the recipients’ country, language, age, or gender. You can use virtually any business partner field to include or exclude contacts from a target group.
When you build your target group, SAP CRM automatically eliminates duplicate records based on the business partner number. However, if your database contains multiple records for the same email address, telephone number, or street address, it is possible to create a target group that reaches the same recipient more than once. A single household might receive multiple copies of the same mailing.
Customers become annoyed when they receive the same offer multiple times (especially if they have already declined the offer the first time). Furthermore, multiple mailings to the same contact could also lead to discord and animosity between the marketing department, which generated the target group containing the duplicate records, and the call center organization, which has to deal with annoyed customers.
For example, imagine that you use a target group to generate an outbound telemarketing call list for the call center organization to execute. As customers start to receive multiple calls for the same promotion, not only do they get upset, but the call center performance starts to suffer as well. Average talk time increases as agents profusely apologize to customers and promise to resolve the issue. The organization also likely incurs additional costs because agents have to make special retention offers (e.g., coupons, discounts, free offers) to angry customers who threaten to contact government regulatory agencies — or worse yet, who threaten to take their business elsewhere.
To avoid these potential problems and to maximize the effectiveness of your campaign, you should eliminate duplicate records from your target group before executing your marketing campaign. Depending on the type of campaign being executed, you may want to use different criteria to determine duplicates. For an email campaign, you want to eliminate duplicate email addresses. For a mailing list, you may choose to eliminate duplicates based on first and last name, or by last name and street address. Each set of rules that you define is called a deduplication method in SAP CRM.
SAP CRM provides the Business Add-In (BAdI) CRM_MKT_BP_DETRMINE, which allows you to specify your own logic for each deduplication method. We will show you how to implement this BAdI to eliminate duplicate records from your target group. This process applies to SAP CRM 2005 and later.
Define the Deduplication Method
To define a deduplication method, you need to go into the IMG and follow menu path Customer Relationship Management > Marketing > Segment Builder > Define Deduplication Method. When you choose this option, the system prompts you to enter the method name and description for the method (Figure 1). In the Method column, enter a name that briefly describes the rule you are creating (we used EMAIL in this example). You refer to this name later when you implement the BAdI. The description is also visible in the Segment Builder when you apply a deduplication rule to your profile set or target group. At this point you must specify whether the rule applies to profile sets or profiles and target groups. You should check both of these options so that there are no restrictions on using the deduplication method.

Figure 1
Define the deduplication method
Implement the BAdI
You can implement the BAdI for deduplication by following IMG menu path Customer Relationship Management > Marketing > Segment Builder > Business Add-Ins (BAdIs) > BAdI: Determination of Deduplication Method. When you choose this option and create your routine, you must specify a name for the implementation of definition CRM_MKT_BP_DETERMINE. This name must begin with a Z so that the implementing class name fits into the customer namespace.
The BAdI for deduplication has only one method named DETERMINATION_BY_ DEDUP_METHOD. This routine accepts one input parameter, IV_DEDUP_CODE, which corresponds to the EMAIL method that you defined in the previous section. The routine also has a changing parameter named CT_BP_LIST. When the system calls the BAdI, this table contains the list of business partners in the target group being generated. The system automatically removes duplicates based on the contents of the DEDUP_OBJECT field of the CT_BP_LIST table. By populating this field within the BAdI routine, you can force the system to recognize duplicate records and eliminate them.
Let’s take a closer look at an example that removes duplicates based on email address. You can download the sample code in its entirety at the end of this article. You may choose to use this code as a starting point for developing your own deduplication routine.
This routine first checks the value of IV_DEDUP_CODE to see which deduplication method is being invoked (Figure 2). You previously configured the method named EMAIL, so the code looks for that value. To configure additional deduplication methods, expand this routine to include additional WHEN statements that match the names of your other methods. If you implement several deduplication methods, you should place the ABAP code for each method in separate function modules that have the same signature as the BAdI. Each function module could then be called from within the corresponding WHEN statement. This approach might help to simplify the BAdI routine, making the code easier to maintain.
METHOD if_ex_crm_mkt_bp_determine~determination_by_dedup_method. CASE iv_dedup_code. WHEN 'EMAIL'.
|
| Figure 2 |
Code that determines which deduplication method the system is using |
The next section of code defines all the required internal tables, structures, and local variables. It then loops through the CT_BP_LIST table and populates the internal table named LT_PARTNER_GUID with each member’s GUID. Next, the routine calls function BUP_BP_DATA_SELECT_ALL. This is an extremely useful function, because it collects all the details related to a specified list of business partners. After the function is called in this routine, the internal table named LT_BUPA_DATA_ALL contains all the information stored for all partners, including their names, addresses, telephone numbers, fax numbers, and email addresses (Figure 3).
IF ct_bp_list IS NOT INITIAL. DATA: lt_partner_guid TYPE bu_partnerguid_t, ls_partner_guid TYPE bapibus1006_partnerguid, lt_bupa_data_all TYPE bu_data_all_t, ls_bupa_data TYPE bupa_data_all, lt_errortable TYPE msg_tab_type, ls_bp_list TYPE crmt_mkttg_member_relat, lv_count TYPE i. * Create list of all partner GUIDs LOOP AT ct_bp_list INTO ls_bp_list. MOVE ls_bp_list-bp_guid TO ls_partner_guid-partner_guid. APPEND ls_partner_guid TO lt_partner_guid. ENDLOOP. * Get details for each GUID CALL FUNCTION 'BUP_BP_DATA_SELECT_ALL' EXPORTING it_partner_guid = lt_partner_guid TABLES et_but000 = lt_bupa_data_all et_errortable = lt_errortable EXCEPTIONS no_values_entered = 1 no_data_found = 2 OTHERS = 3.
|
| Figure 3 |
Code that reads details for each business partner in the target group |
Now that you have the email address for each business partner, you need to copy this field into the DEDUP_OBJECT on table CT_BP_LIST so that the system removes the duplicates based on this value. First, sort each list by partner GUID so that the same line number on each table contains the same GUID. Next, loop through table CT_BP_LIST and populate the structure named LS_BP_LIST. The LV_COUNT value is incremented with each pass through the loop. The READ TABLE command accesses the row on LT_BUPA_DATA_ALL that corresponds to the record currently stored in LS_BP_LIST. The data from the matching record is placed in structure LS_BUPA_DATA.
The next line of code copies the email address (field SMTP_ADDR) from the LS_BUPA_DATA structure into the DEDUP_OBJECT of the LS_BP_LIST structure. You must also convert the email address to uppercase so that that the deduplication process is case insensitive. Finally, when the CP_BP_LIST structure is updated from the corresponding structure, the uppercase version of the email address is copied into its DEDUP_OBJECT field (Figure 4).
* Sort lists so that GUIDs are in the same relative positions SORT ct_bp_list BY bp_guid. SORT lt_bupa_data_all BY partner_guid. * Loop through CT_BP_LIST and populate DEDUP_OBJECT with email address lv_count = 0. LOOP AT ct_bp_list INTO ls_bp_list. ADD 1 TO lv_count. READ TABLE lt_bupa_data_all INTO ls_bupa_data INDEX lv_count. IF ls_bp_list-bp_guid EQ ls_bupa_data-partner_guid. MOVE ls_bupa_data-smtp_addr TO ls_bp_list-dedup_object. TRANSLATE ls_bp_list-dedup_object TO UPPER CASE. MODIFY ct_bp_list FROM ls_bp_list INDEX lv_count. ENDIF. ENDLOOP. FREE: lt_partner_guid, lt_bupa_data_all. ENDIF. WHEN OTHERS. ENDCASE. ENDMETHOD.
|
| Figure 4 |
Code that updates the DEDUP_OBJECT field with the partner’s email address |
This routine shows the most common technique used for eliminating duplicates, which involves populating the CT_BP_LIST-DEDUP_OBJECT field. You may also choose to remove duplicates by having your BAdI routine set the CT_BP_LIST-DEL_FLAG field for partners you want to delete. After the system calls your deduplication routine, any partners that have an “X” in this field are treated as duplicates and are removed from the list
Invoke the Deduplication Method
After you have configured a deduplication method and have developed a BAdI routine to support it, you can invoke the method from within the Segment Builder (transaction CRMD_MKTSETG). To apply the deduplication method to a single profile within your profile set, right-click the profile and select Properties. Select the Deduplication Method from the drop-down menu (Figure 5). When you apply the method to an individual profile, you can assign a priority between 0 and 9999 to define the deduplication order. Segments with a lower priority value have the greatest importance during deduplication.
Note
In SAP CRM 2007 and SAP CRM 7.0, Segment Builder is no longer available via SAPGUI. Instead, you must access Segment Builder in the CRM WebClient UI using the business role MARKETINGPRO. The navigation bar menu path is Marketing > Segments.

Figure 5
Apply the deduplication method to a single profile
You should apply the deduplication method to the target group that the system generates from the profile set. This approach removes duplications across the entire profile set and guarantees that duplicates do not appear in the resulting target group. To use the deduplication method in this way, go to the Properties dialog for the profile set, and specify the deduplication method for the target group (Figure 6).

Figure 6
Apply the deduplication method to the target group for an entire profile set
When you build the target group, the system executes the deduplication method and removes the duplicate records. The number of business partners in the target group reflects the results of the deduplication, and duplicates do not appear when you open the target group within Segment Builder.
William R. Pritchett
William (Bill) Pritchett has more than 25 years of IT industry experience and has worked at Dow Corning Corporation for the past 16 years. Over the past eight years he has focused on the company’s CRM systems and processes. His current responsibilities include expanding the capabilities of Dow Corning’s SAP CRM 7.0 system.
You may contact the author at bill.pritchett@dowcorning.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.

John Burton
John Burton is a director of product management at SAP and is responsible for the SAP CRM Interaction Center (including ERMS) and social CRM topic areas. John has 13 years of experience at SAP and has been involved with SAP CRM and the Interaction Center since 1999. He is also the author of Maximizing Your SAP CRM Interaction Center, available at the SAPinsider Store. John is an alumnus of the University of Michigan and Central Michigan University. John can be found on LinkedIn at www.linkedin.com/in/sapjohnburton.
You may contact the author at john.burton@sap.com.
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.