Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter

Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter
Applies to:
SAP CRM 5.0 on Web AS 700 (SAP_ABA 700, SAP_BASIS 700, BBPCRM 500)

Summary
This article is based on a customer specific requirement which I have undertaken on a project. It describes a scenario where CRM Business Partner Master Data and Relationship Data is distributed to an External NonSAP System called Centrix. The interface setup was done through a combination of CRM XIF adapter setup, BADI enhancement (for populating custom fields) and IDoc Technology to distribute the data. This article explains how the interface was configured in SAP CRM step by step. Author(s): Aditya S Palekar Company: SAP Global Delivery Centre, India Created on: 08 January 2007

Author Bio
Aditya Palekar is an SAP Development Consultant working for SAP Global Delivery Centre at Bangalore, India. He has 5 years of ABAP programming experience which includes programming on SAP ECC. He has undertaken projects for customers based in India, UK and USA and has played the role of a developer and development lead

SAP DEVELOPER NETWORK | sdn.sap.com © 2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 1

Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter

Table of Contents
Applies to: ........................................................................................................................................ 1 Summary.......................................................................................................................................... 1 Author Bio ........................................................................................................................................ 1 Preface............................................................................................................................................. 3 Project Requirement ........................................................................................................................ 4 The Approach .................................................................................................................................. 4 Technical System Landscape.......................................................................................................... 5 SAP CRM 5.0 ........................................................................................................................... 6 Magma...................................................................................................................................... 6 Centrix ...................................................................................................................................... 6 Configuration of the Interface Scenario ........................................................................................... 7 Extension to the CRM XIF Complex Structure ............................................................................ 7 Generation of Custom Message Type from the ALE Interface .................................................... 8 BADI Enhancement Implementation for the Outbound Messages .............................................. 9 Filtering the Business Partners per Business Partner Category .............................................. 9 Populating Custom Fields for the BP Relationship in the outbound message....................... 11 ALE Setup .................................................................................................................................. 15 Logical System setup ............................................................................................................. 15 RFC Destination setup ........................................................................................................... 15 ALE Port ................................................................................................................................. 17 ALE Partner Profile................................................................................................................. 17 Customer Distribution Model .................................................................................................. 19 External Interface Adapter (XIF) Setup...................................................................................... 20 Create new Site ...................................................................................................................... 20 Create new Subscription(s) .................................................................................................... 20 Assign Site ID to Interface Type ............................................................................................. 21 Running the Interface .................................................................................................................... 21 Debugging the BADI Enhancement while running the Interface ................................................... 24 Related Content............................................................................................................................. 27 Copyright........................................................................................................................................ 28

SAP DEVELOPER NETWORK | sdn.sap.com © 2006 SAP AG

BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com 2

It describes a scenario where we had to interface CRM Business Partner Master Data and Relationship Data to an external system called Centrix.sap. Centrix is based on a SQL Server Database platform and required the master data from CRM to perform subsequent processes such as Billing to the customer. map them to the structures in Centrix and update the tables through SQL Insert commands. but this specific case uses a combination of XIF. Magma contained ODBC drivers to connect to the Centrix database and perform SQL Insert operations. ALE/IDoc all working together. UK. It focuses mainly on delivering the master data from SAP CRM to Magma and setup required from SAP specific to the requirement Now I am aware that there is standard documentation on CRM XIF function modules. So BADI enhancements had to be implemented to populate these custom structures. Separate database tables were setup on Centrix system to store the records coming from SAP CRM via Magma.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Preface This article is based on a customer specific requirement which I have undertaken on a project. BADI enhancement. we had to introduce custom structures with additional fields as the standard IDoc in CRM did not contain all the data we needed. For transferring the Relationship data from SAP CRM.com 3 . The challenge here was to interface SAP CRM and Centrix without a powerful middleware such as SAP XI. For the interfacing between SAP CRM and Centrix we used a system called Magma from Cindercone Solutions Ltd. After thoroughly evaluating the technical capabilities we found that we can use Magma to listen to incoming IDocs from SAP CRM via HTTP. Separate setup was required on Magma to listen to the incoming requests from SAP CRM. The customer eventually decided to implement XI but that was several months later in the Project. This document does not discuss the details about the technical setup of Magma and Centrix. I found this mix of technology to be quite interesting and I am writing this article which would benefit other developers on similar requirements in the future as they would know more about the capabilities of the CRM XIF interface through this example SAP DEVELOPER NETWORK | sdn.sap.

sap.com 4 SAP DEVELOPER NETWORK | sdn. These roles are: o o o o • • Sold-To Party Ship-To Party Payer Bill-To Party Business Partners in CRM would be linked together by means of Business Partner relationships When a new BP relationship is added or an existing BP relationship is deleted from a Business Partner.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Project Requirement • • Business Partners created or changed in CRM should be distributed to an external system Centrix Business Partners in specific BP roles would be created / changed in SAP CRM and must be distributed to the external system.sap.com © 2006 SAP AG . the relationships need to be distributed to the external system so the linkage is maintained there as well For each relationship that is created / deleted. the other logically linked business partners should be sent out in the same message The interface between SAP CRM and the external system should be in Real-Time • • The Approach Refer to the diagram below: - SAP CRM contains a component called the External Interface Adapter (XIF) which allows you to interface between SAP CRM and external systems The interaction between the different layers is as follows: • • CRM Server: Business Partner master data / relationship data is created or changed CRM Middleware: A messaging BDoc (mBDoc) is generated: BUSINESS PROCESS EXPERT COMMUNITY | bpx.

com 5 .sap.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter o o • BDoc message of type BUPA_MAIN is generated whenever Business Partner Master Data is created or changed BDoc message of type BUPA_REL is generated whenever a Business Partner Relationship is created or modified Manipulate the data in outbound as well as inbound messages Populate data in custom structures in outbound and inbound messages Reject / Filter out messages that do not match your criteria Manipulations made to the outbound message are reflected in the IDoc / SOAP-XML stream SOAP/XML ALE/Idoc The message is dispatched as a SOAP-XML Message The message is mapped to an IDoc and dispatched External Interface (XIF) Adapter: Contains BADI enhancements which can be used for: o o o o • Delivery of the message: This could happen in one of 2 ways: o o In our example we shall dispatch the outbound message using the ALE/IDoc approach Technical System Landscape The systems in the landscape are: • • • SAP CRM 5.sap.0 Magma Centrix SAP DEVELOPER NETWORK | sdn.

com 6 .sap.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter SAP CRM 5.sap.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx. we shall perform all configuration/setup in Client 200 and test in Client 210 Magma • • • Listens to incoming HTTP requests from SAP CRM Maps the incoming IDoc (in XML format over HTTP protocol) to the target structures in Centrix Updates the Centrix database tables through SQL INSERT statements Centrix • • This is the receiving system in the entire integration Receives the Business Partner Master and Relationship data from Magma (which in turn comes from SAP CRM) Please Note: • • From an SAP CRM view point.0 • • • This is the source of all Business Partner Master Data and Business Partner Relationship data Business Partner Master and Relationship Data is sent to Magma as an IDoc in XML format over HTTP protocol Three clients were provided in our SAP CRM development system as follows: 200 210 220 Master Config Client Sandpit Client Unit Testing Client Please Note: For our requirement. Magma is the receiving system So all XIF and ALE configuration in SAP CRM is done with respect to Magma SAP DEVELOPER NETWORK | sdn.

sap.com 7 . the extension is not at the ALE Layer which means we are not using IDoc extension We are extending the structure centrally at the XIF layer and controlling the custom fields there so they will be reflected in the subsequent outbound message (whether we choose IDoc or SOAP method for distribution) In this section.sap. we will see how to populate the custom structure fields through a BADI enhancement which is called within the XIF framework before it passes to the ALE Layer Structure for Custom Fields in the interface Create a Structure ZDB1_CENTRIX_INTERFACE CRM to Centrix Interface Structure as follows: - Set the Enhancement Category to Can be enhanced (Character Type) SAP DEVELOPER NETWORK | sdn.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Configuration of the Interface Scenario Extensions to the CRM XIF Complex Structure for Business Partner Relationship Please Note: Although the master and relationship data is distributed using IDoc.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx. we will add an Append Structure to the structure CRMXIF_PARTNER_REL_COMPLEX (for Business Partner Relationships) We will then create a custom IDoc message type for the Business Partner Relationship Interface which will contain the fields from the standard structure and the custom fields from the append structure Later in this article.

sap. The corresponding Business Object and relevant Message Types are displayed From the menu choose Interface Create Enter the parameters as shown below for Outbound Processing.External Interface • • • • Start Transaction BDFG Enter Function Module as CRMXIF_PARTNER_REL_SAVE and press Enter.sap.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Table Type to hold multiple records of the Structure Create a new Table Type ZDB1_CENTRIX_INTERFACE_T Table Type for CRM to Centrix Interface Structure with line type as ZDB1_CENTRIX_INTERFACE structure Append Structure for Create a new Append Structure ZDB1_CENTRIX_APPEND structure BURS_EI_RELATION_DATA as follows: Component ZZCENTRIXDATA Component Type ZDB1_CENTRIX_INTERFACE_T Centrix Interface Data Structure for the Set the Enhancement Category to Can be enhanced (Deep) Structure BURS_EI_RELATION_DATA is the data type for the component CENTRAL_DATA of the CRM Relationship complex structure CRMXIF_PARTNER_REL_COMPLEX It is under this level that we are attaching the append structure with the custom fields These fields will be reflected in the Hierarchical structure of IDoc Type as we will create a custom message type from this extended Complex Structure Generation of Custom Message Type from the ALE Interface • Create a new Function Group ZDB1_BUPARELALE and activate the same Function Group ZDB1_BUPARELALE Description BP Relationship .com 8 . Leave the Inbound Processing parameters unpopulated SAP DEVELOPER NETWORK | sdn.

All the non-released segments are highlighted in the check Set the Release for all the non-released Segment Types through Transaction WE31 BADI Enhancement Implementation for the Outbound Messages Filtering the Business Partners per Business Partner Category • Create a BADI implementation and activate the same as follows: BADI Definition BADI Implementation BADI Implementation Description SAP DEVELOPER NETWORK | sdn.sap. enter IDoc Type ZCRMXIF_BUPAREL_EXT01 and choose the menu option Development Object Check.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter • • • • Press the Continue button to proceed Once the Interface is generated.sap. choose the menu option Interface Check to see if all components have been created and activated successfully Go to Transaction WE30.com 9 .com © 2006 SAP AG CRMXIF_PARTNER_MAP ZDB1_CRMXIF_BPMAP BP Main Data External Enhancement (BUPA_MAIN) Interface BUSINESS PROCESS EXPERT COMMUNITY | bpx.

In this way we can filter the master data that is distributed The code below shows how we can validate and filter out the Business Partner data per Business Partner Category • METHOD if_ex_crmxif_partner_map~change_mapped_data_out.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter • Implement the method IF_EX_CRMXIF_PARTNER_MAP~CHANGE_MAPPED_DATA_OUT. if we delete a line from internal table CS_DATA_MAPPED which does not meet our criteria. MOVE sy-tabix TO lv_tabix. DATA lv_tabix TYPE sytabix.2006 * * * * * * * * * * * * * * * ************************************************************************ DATA ls_data_mapped LIKE LINE OF cs_data_mapped. In this method. we can prevent the IDoc from being generated subsequently.com 10 .sap.12.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx. * Proceed only if Business Partner belongs to BP Category '2' (Organisation) IF ls_data_mapped-central_data-common-data-bp_control-category <> c_bp_category_org. * Store the index of this internal table record in a variable CLEAR lv_tabix. *** MAIN PROCESSING ***** LOOP AT cs_data_mapped INTO ls_data_mapped.sap. SAP DEVELOPER NETWORK | sdn. ************************************************************************ * METHOD: IF_EX_CRMXIF_PARTNER_MAP~CHANGE_MAPPED_DATA_OUT * * TITLE: CRM Customer Master to Centrix Interface * * AUTHOR: Aditya Palekar (SAP GDC) * * DESCRIPTION: This method is called by the CRM XIF adapter framework * * * * * * * * when an outbound message is generated on Creating or Changing Business Partner main data This method contains a check to ensure that Business Partners of category '2' (Organisation) are sent to external system The method is triggered after the mBDoc of type BUPA_MAIN is created DATE: 20.

DATA ls_data_mapped LIKE LINE OF cs_data_mapped. ENDLOOP.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx. ENDIF. * The fields populated here are passed on to the outbound IDoc which is * sent to Centrix. ENDMETHOD. *----------------------------------------------------------------------* DATA lv_tabix TYPE sytabix. lv_tabix = sy-tabix. *** MAIN PROCESSING ***** LOOP AT cs_data_mapped INTO ls_data_mapped.sap.com 11 . Save and Activate the Method Populating Custom Fields for the BP Relationship in the outbound message • Create a BADI implementation and activate the same as follows: BADI Definition BADI Implementation BADI Implementation Description CRMXIF_PARTNER_R_MAP ZDB1_CRMXIF_BPRELMAP BP Relationship External Enhancement (BUPA_REL) Interface • In the interface method IF_EX_CRMXIF_PARTNER_MAP~CHANGE_MAPPED_DATA_OUT.sap. CONTINUE. * Proceed only if any one of the following relations were assigned: SAP DEVELOPER NETWORK | sdn. * Store the index of this internal table record in a variable CLEAR lv_tabix. insert the following code: - *----------------------------------------------------------------------* * This method is used to populate the additional custom fields of the * Relationship Complex Structure while sending the data outbound from * SAP CRM.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter DELETE cs_data_mapped INDEX lv_tabix. DATA lv_relat_cat TYPE bu_reltyp. Check.

* Process only those relationships which have been newly created * or deleted during reassignment of relationships CHECK ls_data_mapped-header-object_task = c_task_insert OR ls_data_mapped-header-object_task = c_task_delete. ENDLOOP. " END OF PROCESSING ALL RELATIONSHIPS CREATED / DELETED SAP DEVELOPER NETWORK | sdn. " END OF PROCESSING FOR ALL RELATIONSHIP CATEGORIES * Update the Complex Structure Internal Table with the modified * Centrix Structure data MODIFY cs_data_mapped FROM ls_data_mapped INDEX lv_tabix TRANSPORTING central_data-zzcentrixdata. lv_relat_cat = ls_data_mapped-header-object_instance-relat_category. CONTINUE.sap. IF NOT ( lv_relat_cat = c_relcat_shipto OR OR lv_relat_cat = c_relcat_payer lv_relat_cat = c_relcat_billto ). ENDMETHOD.sap. DELETE cs_data_mapped INDEX lv_tabix. ENDCASE.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter * Ship-To Party (Relationship Category --> CRMH02) * Payer (Relationship Category --> CRMH03) * Bill-To Party (Relationship Category --> CRMH04) CLEAR lv_relat_cat.com 12 . ENDIF. CASE lv_relat_cat. *----------------------------------------------------------------------* * RELATIONSHIP CATEGORY 'CRMH02' (HAS A SHIP-TO PARTY/RECIPIENT) * EXISTS BETWEEN THE BUSINESS PARTNERS *----------------------------------------------------------------------* WHEN c_relcat_shipto. CALL METHOD zcl_im_db1_crmxif_bprelmap=>process_ship_to CHANGING cs_bp_rel_data = ls_data_mapped.

* Refresh the Centrix Data internal table REFRESH cs_bp_rel_data-central_data-zzcentrixdata. DATA lt_return TYPE bapiret2_t. * Initialise all relevant variables CLEAR lv_sold_to_party. DATA lv_bill_to_party TYPE bu_partner. REFRESH lt_return.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx. CLEAR lv_payer. DATA lv_payer TYPE bu_partner. CLEAR lv_bill_to_party. DATA lv_ship_to_party TYPE bu_partner.sap. lv_ship_to_party = cs_bp_rel_data-header-object_instance-partner2-partner_no. CLEAR lv_ship_to_party. * Sold-To Party Selected ************ CLEAR lv_sold_to_party. * Ship-To Party Selected ************ CLEAR lv_ship_to_party. CALL FUNCTION 'BAPI_BUPA_RELATIONSHIPS_GET' EXPORTING businesspartner = lv_sold_to_party SAP DEVELOPER NETWORK | sdn. DATA ls_centrix TYPE LINE OF zdb1_centrix_interface_t. DATA lt_relationships_sold TYPE TABLE OF bapibus1006_relations.com 13 . DATA lt_relationships_ship TYPE TABLE OF bapibus1006_relations.sap. DATA ls_relationship TYPE bapibus1006_relations.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter DATA lv_sold_to_party TYPE bu_partner. * Get all Relationships of Sold-To Party REFRESH lt_relationships_sold. lv_sold_to_party = cs_bp_rel_data-header-object_instance-partner1-partner_no.

sap. READ TABLE lt_relationships_ship WITH KEY partner1 = lv_ship_to_party relationshipcategory = c_relcat_billto INTO ls_relationship. * Payer Selected ************ lv_payer = ls_relationship-partner2. * Finding the Bill-To Party CLEAR ls_relationship.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter TABLES relationships return = lt_relationships_sold = lt_return. IF sy-subrc = 0. * Finding the Payer CLEAR ls_relationship. READ TABLE lt_relationships_ship WITH KEY partner1 = lv_ship_to_party relationshipcategory = c_relcat_payer INTO ls_relationship. BUSINESS PROCESS EXPERT COMMUNITY | bpx. all the relevant Business Partners have been determined * Include all the relevant BP Numbers into the Centrix * Interface Structure CLEAR ls_centrix. ENDIF. = lv_bill_to_party.com 14 .com © 2006 SAP AG = lv_payer. = lv_sold_to_party.sap. * If the Payer is attached to the Ship-to Party * ( **** SCENARIO 1: REGIONAL BILL & PAYMENT **** ) IF sy-subrc = 0. ENDIF. * Bill-To Party Selected ************ lv_bill_to_party = ls_relationship-partner2. * At this point. ls_centrix-zzsapcrm_pay_id ls_centrix-zzsapcrm_bill_id ls_centrix-zzsapcrm_soldto_id SAP DEVELOPER NETWORK | sdn.

sap. ALE Setup Logical System setup • • Start Transaction BD54 Enter a new Logical System as follows: Logical System EX1CENTRIX • Description External Interface to CENTRIX Also ensure that an entry for Logical System CD1CLNT200 exists. ENDMETHOD.sap.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter ls_centrix-zzsapcrm_del_id ls_centrix-zzmethod = lv_ship_to_party.com 15 .com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.8.29 650002 /Centrix-CRM-Customers * The path prefix denotes the exact location of the application which is listening to the IDoc from CRM SAP DEVELOPER NETWORK | sdn. = cs_bp_rel_data-header-object_task. The details to be entered for our RFC destination are: - Target Host Service Number Path Prefix* 128. the external system Magma has an application listening on a specified port. APPEND ls_centrix TO cs_bp_rel_data-central_data-zzcentrixdata. This logical system must be assigned to CRM Client 200 (see Transaction SCC4) RFC Destination setup • • • Start Transaction SM59 Create a new RFC Destination of Type ‘G’ (HTTP Connections to External Server) In our case.1.

com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.com 16 .sap.sap.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter SAP DEVELOPER NETWORK | sdn.

ZCRMXIF_BUPAREL_EXT and SYNCH SAP DEVELOPER NETWORK | sdn.sap.com 17 .com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter ALE Port • • • • Start Transaction WE21 Create a new ALE Port EX1MAGMA of type XML-HTTP Enter the RFC Destination EXT_MAGMA Choose the content type as Application/x-idoc ALE Partner Profile • • • Start Transaction WE20 Create a Partner Profile EX1CENTRIX of Type LS (Logical System) Enter the message types CRMXIF_PARTNER_SAVE_M.sap.

sap.sap.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter SAP DEVELOPER NETWORK | sdn.com 18 .

sap. Switch off the crosssystem checking when performing this check CD1CLNT200 EX1CENTRIX SAP DEVELOPER NETWORK | sdn.sap.com 19 .Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Please Note: Message Type SYNCH with IDoc Type SYNCHRON is added to the Partner Profile as well Customer Distribution Model • • Start Transaction BD64 Create a Distribution Model as follows: Sending System Receiving System Message Type(s): CRMXIF_PARTNER_SAVE_M ZCRMXIF_BUPAREL_EXT • Perform a Technical Consistency Check for the model in Transaction BDM5.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.

Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter External Interface Adapter (XIF) Setup Create new Site • • • • Start Transaction SMOEAC Administration Console Create a new site ZSITE01 of type External Interface for IDOCs as shown in the diagram below In the Site Attributes enter the ALE Partner profile EX1CENTRIX created earlier Hence we have linked the XIF site with the ALE partner profile Create new Subscription(s) In the same transaction SMOEAC you need to create 2 new subscriptions Subscription Publication Assign to Site ZSUB_BUPA_MAIN All Business Partners (MESG) ZSITE01 Subscription Publication Assign to Site ZSUB_BUPA_REL All Business Partner Relationships (MESG) ZSITE01 SAP DEVELOPER NETWORK | sdn.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.sap.com 20 .

com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Assign Site ID to Interface Type • • Start Transaction CRMXIF_C1 Enter 2 new entries in the table as shown in the diagram This table links the mBDoc Type to the respective External Interface (XIF) Function Module Running the Interface The steps mentioned below for running the interface assume that we are using the SAPGUI for user interaction.com 21 . Although the menus and navigation paths are different in the Web GUI.sap. We can also use the CRM Web GUI for running this interface.sap. we will still get the same results The Business Partner numbers mentioned here are specific to the system in which I have tested • • • Start Transaction BP Create a Business Partner in the Role Ship-To Party (in our case ZCRM02). Enter the relevant data and press Save Business Partner 13665 is created in the role ZCRM02 (Ship-To Party) SAP DEVELOPER NETWORK | sdn.

com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter An IDoc of message type CRMXIF_PARTNER_SAVE_M is generated with Status 03 (Data Passed to Port OK) Similarly.sap. 3 more Business Partners are created as follows: BP Number 13666 13667 13668 BP Role ZCRM03 ZCRM04 ZBUP02 BP Role Description Payer Bill-To Party Sold-To Party SAP DEVELOPER NETWORK | sdn.sap.com 22 .

sap.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Now select the Business Partner 13668 (sold-To Party) and create the following Business Partner relationships as shown in the diagram BP Number 13665 13666 13667 BP Relationship Category CRMH02 CRMH03 CRMH04 BP Relationship Description Category Has Ship-To Party/Recipient Has Payer Has Bill-To Party Save the Transaction An IDoc of message type ZCRMXIF_BUPAREL_EXT is generated The custom segment Z101DB1_CENTRIX_INTERFACE is visible in the IDoc with all the relevant Business Partners which are populated by the method CHANGE_MAPPED_DATA_OUT of BADI implementation ZDB1_CRMXIF_BPRELMAP SAP DEVELOPER NETWORK | sdn.com 23 .sap.

sap.com 24 .Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Debugging the BADI Enhancement while running the Interface In the method CHANGE_MAPPED_DATA_OUT of the BADI Implementation ZDB1_CRMXIF_BPMAP set a hard coded break point in the source code as follows: BREAK APALEKAR Save and activate the method SAP DEVELOPER NETWORK | sdn.sap.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.

activate the debug mode by typing /h in the command field on the top left and then press Save to save the Business Partner record In the debug mode.com 25 .com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter • • • • • Start Transaction BP Enter the Business Partner details in the respective fields Before you save the transaction. continue to debug until you reach the point shown in the image below.sap. set a breakpoint on the method PROCESS_OUTBOUND of global class CL_SMW_MFLOW Once the debugger breaks inside the method PROCESS_OUTBOUND. Change the value of the parameter __DBGMODE to 'X' and then press the F8 (Continue) button to proceed SAP DEVELOPER NETWORK | sdn.

com 26 .sap.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter SAP DEVELOPER NETWORK | sdn.sap.

To be processed (Debug).Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter • Go to Transaction SMW01 and select all BDocs of type BUPA_MAIN.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx. From here you can debug the enhancement code Related Content • • For more details on CRM XIF Interface for Business Partners.sap.com 27 . • • • Select the BDoc and choose the option Reprocess mBDoc message You might get a confirmation dialog box. Choose ‘Yes’ The program pauses in debug mode inside the method CHANGE_MAPPED_DATA_OUT of the BADI implementation ZDB1_CRMXIF_BPMAP containing your code.sap. see documentation of function modules CRMXIF_PARTNER_COMPLEX and CRMXIF_PARTNER_REL_COMPLEX Refer to SAP Note 448742 for General Notes on CRM XIF Interfaces SAP DEVELOPER NETWORK | sdn. You will notice that the mBDoc message has status.

if any.sap. All other product and service names mentioned are the trademarks of their respective companies.com © 2006 SAP AG BUSINESS PROCESS EXPERT COMMUNITY | bpx. or consequential damages that may result from the use of these materials. and PowerPoint are registered trademarks of Microsoft Corporation. MaxDB is a trademark of MySQL AB. MVS/ESA.. All rights reserved. WebSphere. These materials are provided “as is” without a warranty of any kind. JavaScript is a registered trademark of Sun Microsystems. R/3. Inc. OSF/1. Windows. xSeries. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only. SAP. Parallel Sysplex. iSeries. VideoFrame. OS/390. DB2. OS/2. POWER. text. AS/400. indirect. and SAP Group shall not be liable for errors or omissions with respect to the materials. Inc. XHTML and W3C are trademarks or registered trademarks of W3C®. The information contained herein may be changed without prior notice. zSeries. S/390. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. HTML. IBM. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. Nothing herein should be construed as constituting an additional warranty. Data contained in this document serves informational purposes only. Sweden. and SAP shall not be liable for errors or damages caused by the usage of the Code. Netfinity. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. xApps. MetaFrame. SAP does not warrant the accuracy or completeness of the information. XML. Tivoli. Adobe. used under license for technology invented and implemented by Netscape.Distributing Business Partner Master Data from SAP CRM to an external system using the CRM XIF Adapter Copyright © Copyright 2006 SAP AG. and Motif are registered trademarks of the Open Group. Inc. SAP shall not be liable for damages of any kind including without limitation direct. graphics.com 28 . OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. the Adobe logo. mySAP. z/OS. Oracle is a registered trademark of Oracle Corporation. Citrix. pSeries. Massachusetts Institute of Technology. including but not limited to. POWER5. and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. SAP DEVELOPER NETWORK | sdn. OS/400. SAP does not warrant the correctness and completeness of the Code given herein. Informix. PostScript. the implied warranties of merchantability. and MultiWin are trademarks or registered trademarks of Citrix Systems. links or other items contained within these materials. AFP.sap. except if such damages were caused by SAP intentionally or grossly negligent. Microsoft. National product specifications may vary. DB2 Universal Database. X/Open. UNIX. mySAP. Intelligent Miner. World Wide Web Consortium. WinFrame. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. either express or implied. or non-infringement. xApp. SAP NetWeaver. special. i5/OS. Java is a registered trademark of Sun Microsystems. Any software coding and/or code lines/strings (“Code”) included in this documentation are only examples and are not intended to be used in a productive system environment. ICA.com. AIX. without representation or warranty of any kind. Outlook. and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. fitness for a particular purpose. Program Neighborhood. These materials are subject to change without notice. Acrobat.