You are on page 1of 40

SAP NetWeaver How-To Guide

Using MDM 7.1 Key-Mappings in a PI Landscape

Applicable Releases: SAP NetWeaver MDM 7.1 SAP NetWeaver Process Integration 7.00 SAP NetWeaver Process Integration 7.1x

Topic Area: Information Management Capability: Master Data Management

Version 1.0 May 2009

© Copyright 2009 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, 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. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. 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, if any. Nothing herein should be construed as constituting an additional warranty. These materials are provided “as is” without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. 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. SAP NetWeaver “How-to” Guides are intended to simplify the product implementation. While specific product features and procedures typically are explained in a practical business context, it is not implied that those features and procedures are the only approach in solving a specific business problem using SAP NetWeaver. Should you wish to receive additional information, clarification or support, please refer to SAP Consulting. 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. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent. Disclaimer Some components of this product are based on Java™. Any code change in these components may cause unpredictable and severe malfunctions and is therefore expressively prohibited, as is any decompilation of these components. Any Java™ Source Code delivered with this product is only to be used by SAP’s Support Services and may not be modified or altered in any way.

Document History
Document Version 1.00 Description First official release of this guide

Typographic Conventions
Type Style Example Text Description Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Cross-references to other documentation Example text Emphasized words or phrases in body text, graphic titles, and table titles File and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools. User entry texts. These are words or characters that you enter in the system exactly as they appear in the documentation. Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system. Keys on the keyboard, for example, F2 or ENTER.

Icons
Icon Description Caution Note or Important Example Recommendation or Tip

Example text

Example text

<Example text>

EXAMPLE TEXT

.................................................... 5 4...............................................................................3..... 32 D ............ 12 Enterprise Services Repository ............................ 29 B – Java code for DOMUtil class.......................................... 34 ............................................................................................................................................................................................................... 6 5..........................................................1 Web Services ..................... Background Information....1 Configuration in the Backend ECC System............................................................. 28 APPENDIX ......................................... 3 Drawback ....... 2 Scenario Description .................................. 3 Prerequisites ..................................1 5....................................... 7 5............................................ 4.......6 4.................................3........................................Java code for getGlobalContainerValue..........................................1 2..............................................................................................................5 Prerequisites ........... Advantages ................. 5 Activities....... 5 Integration.......3 3......3....................................................................1.................................................3 5......7 Use ...................................................................3 5.... 7 SAP NetWeaver 7...........2 5...1................................................................................................3 Introduction ..............3 4.......................................... 11 Testing your Scenario........... 7 Inbound Processing ...........................................................2 2.... 2 Pros & Cons of the Scenario .................... 21 Configuration in the MDM system .........5 4.............................................................................................................................................................................................2.............................1 5... 13 Integration Directory....................................................................................................................1 5...............................................................................................................2 5............................. 29 A – Creating Technical and Business systems in PI .................................................................................................................... 5 Features.................................. 4 SAP NetWeaver MDM 7...............3.............................. 26 Monitoring your Scenario................................................................2 4................ 2............................................................................... 3 2........... 7 5................................................3................4 4.........................................................................................................................................................................................3...1 web-services generator ................................... 5 Prerequisites................................... 7 Partner Profile ......................4 5............ 6 High Availability and fail-over aspects.......................... 8 Configuration in the PI System .....................Table of Contents 1....................................................................................... 2 2..........................................1 2...1 4... 1 Business Scenario................... Configuration Steps in Detail ........................................................................3 5............. 3 Alternatives .......... 31 C – Java code for GetKeyMap user-defined function............................2 5............................................. 5 Programming and Configuration.... 8 System Landscape Directory ...................................................................................1......................................................................2 2......................................................................

1 Key-Mappings in a PI Landscape 1. Background Information This guide explains how to set up MDM . Such a scenario is particularly useful for supporting system upgrade processes where a preliminary de-duplication and cleansing of master data is required.Using MDM 7. May 2009 1 .PI landscape for leveraging the SAP NetWeaver MDM keymapping functionality for supporting direct data distribution between client systems. In the example described in this guide we show how the links between Sales Orders and Customer master data can be correctly updated and distributed with the help of SAP NetWeaver MDM and SAP NetWeaver PI.

2. This key mapping information is very valuable and is requested in many application scenarios regarding master data objects: global spend analysis. May 2009 2 . The main purpose of the scenario is to show how SAP NetWeaver PI via Key-mapping can leverage SAP NetWeaver MDM’s web service capabilities key-mapping features. it is necessary to take a simple business scenario where a purchase order data is sent to the PI system asynchronously to create a sales order in a backend ECC system. It helps to build the key mapping between same or similar objects from different systems.1 Key-Mappings in a PI Landscape 2. Business Scenario 2. But there are other IT scenarios that enable you to benefit from this consolidation work done in MDM: mapping during data exchange in cross systems business scenarios. global sales reports etc. invokes a web service on the MDM Server to get the details of the customer.Using MDM 7.2 Scenario Description To better understand the whole process flow. The mapping program before transforming the data from order data to Orders IDoc. The data is sent to the PI system via http or file adapter for further processing.1 Introduction SAP MDM is the ideal solution to build a central repository for master data and their related customizing from heterogeneous landscape. such as unit of measures. basic material etc. The following graphic describes the important application components and their communication with the PI system for a typical three system landscape.

2. where accurate Customer data is a strong requirement. That has advantages and draw-backs 2. and conceive mechanisms for avoiding synchronization issues between the MDM system and PI. This would be particularly interesting for the case of Sales Orders. That drives a larger investment in designing a fail-over scenario that satisfies the maximum downtime accepted by the business requirements.Using MDM 7. 2.3.1 Key-Mappings in a PI Landscape 2.. Since PI is synchronously connected to PI any changes corresponding to cleansing and deduplication activities are immediately available during the Mapping. If not you should consider replicating the key mappings in SAP NetWeaver PI. May 2009 3 . Please refer to the MDM Solution Operation Guide for more details.1 • • Advantages SAP NetWeaver MDM can be used as a central place for managing the master data keys.2 • Drawback A failure in MDM would immediately impact the overall performance of the PI processes that depend on MDM key mappings.3. This avoids the possibility of having data objects being mapped to duplicates. or master data that should be removed from the landscape. and are directly influenced by the MDM component.3 Alternatives Before implementing the solution described in this guide you should investigate either or not the MDM fail-over concept fulfills your requirements.3 Pros & Cons of the Scenario In this scenario MDM plays the role of broker for master data keys.3. The data distribution processes orchestrated by SAP NetWeaver PI depend fully MDM key mappings.

Using MDM 7. Prerequisites • • • Good Knowledge of the MDM and Web Services Good Knowledge of SAP NetWeaver PI Good knowledge of ERP or ECC systems. Relevant SAP Notes 1278123 652736 704303 679994 1261268 1261268 1283909 MDM Web Services – NetWeaver Supportability Configuration file generation for MDM Key Mapping Framework Key mapping error due to incorrect key mapping properties file Key mapping of link objects implemented MDM solution and server cluster compatibility SAP NetWeaver MDM in a cluster under Microsoft Windows SAP NetWeaver MDM in a cluster under UNIX based OS May 2009 4 .1 Key-Mappings in a PI Landscape 3.

1 Use The MDM Web services can be used to: • Manage Master Data Objects Existence check of a central master object before local creation Retrieve details and create a local replicate Create or update master data objects on MDM • Manage Unique Identifiers of Master Data Objects Remote system registers local object as replicate of global object Key mapping during message exchange on SAP NetWeaver XI 4. however Customer data has to be previously consolidated. Retrieve. CRUD (Create. read). The transactional data (Sales Orders) is never stored in the MDM server.sap-ag. 4.1 offers a WebDynpro based project management framework that allows configuring and deploying CRUD support over web services. For this guide we will assume that this process has been already performed. SOAP. read.4 Prerequisites In this guide we will describe how to use the Customer Key mappings stored in SAP NetWeaver MDM 7. To create and retrieve key mapping information for MDM records 2.2 Integration Web services are web-based interfaces that can be integrated into business scenarios of a company based on open and commonly accepted standards. 1.1 for supporting the distribution of transactional data.5 Features MDM Web services provide the following Web service categories: . WSDL and UDDI open standards.Using MDM 7. SAP NetWeaver MDM 7. They are based on the Simple Object Access Protocol (SOAP) and Web Services Description Language (WSDL) standards. More details on installation and usage of these WebDynpro components can be found in: https://service. update) and access to central key mapping (create.. 4. and that the respective key-mappings are available in the system. Update and Delete) Web services May 2009 5 . Web services for MDM are open interfaces to the MDM Server.de/~sapidb/011000358700001718732008E 4.3 Programming and Configuration SAP NetWeaver MDM 7. They provide data management capabilities (create. MDM Web Services provide synchronous access to MDM for the consumer of the Web services.1 Key-Mappings in a PI Landscape 4. They describe a standardized way of integrating Web-based applications using the XML..1 Web Services 4.

It is therefore fundamental to investigate if the SAP NetWeaver MDM failover concept fulfills your business requirements and KPIs.6 Activities ..1 is used here as a central broker for Master Data key mapping across systems. Deploy the web-services in the J2EE engine that will make the web-services available for PI. main table. qualifiers.. For more details please refer to the MDM Solution Operation Guide on SAP Service Marketplace (SMP logon required).1 web-services management tool 2. 4. Create a project in the SAP NetWeaver MDM 7. 1. and Tuples) 4.7 High Availability and fail-over aspects SAP NetWeaver MDM 7.1 Key-Mappings in a PI Landscape 3. May 2009 6 . lookups. Define a specific web-service for reading the Customer key mappings in MDM 3. Exposes MDM's rich functionality in searching for records and maintaining data in records (for example.Using MDM 7.

. This procedure is normally performed by the MM and SD configuration areas according to their specific requirements. Prerequisites 1. 2. MDM and PI Systems for message processing. The necessary configuration needs to be done in the SAP Materials Management (MM). If no errors occur.1. 5.2 Partner Profile You need to maintain the partner profile using transaction WE20 for the incoming Idoc messages with the following parameters: • • • • • • Partner Type: Partner Role: Message Type: Process Code: Syntax Check KU AG ORDERS ORDE Checked Trigger Immediately Checked 5. This guide assumes that this configuration has already been done in your ECC system.1. The material number maintained in your system must be specified in the IDoc in a segment of type E1EDP19 with the qualifier 002.3 Inbound Processing The IDoc interface posts the IDoc in the database and triggers inbound processing.1 Key-Mappings in a PI Landscape 5.1. 5. Configuration Steps in Detail This section covers the complete configuration steps that are required in Backend ECC.1 Configuration in the Backend ECC System Your backend ECC system need to be configured in order to receive the Order data via IDoc from the SAP NetWeaver PI system.Using MDM 7.1 . The system can determine the Customer from this entry. and Financial and Controlling (FI/CO) modules. Sales and Distribution (SD). In this section we only discuss how to configure the inbound processing to receive the Order data via an IDoc. the system updates the standard order automatically May 2009 7 . 5. The Segment E1EDKA1 with partner function AG (sold-to party) must exist in the incoming ORDERS05 IDoc..

May 2009 8 .1 Key-Mappings in a PI Landscape 5.1 web-services generator 1. The first step is to create a new project in the web-services generator tool. SAP NetWeaver 7. highlight the Project CustomerWS and click Edit..1 server and Customer repository from where the metadata will be extracted.2. The application can be accessed from the url: http://<dev_server>:<port>/logon/logonServlet?redirectURL=%2Fwebdynpro%2Fdispatcher%2F sap. enter the MDM Server name and MDM Server password (if any).. This allows you to select the SAP NetWeaver MDM 7. There are no particular pre-requisites for the development workstation.1 .com%2Ftc%7Emdm%7Ews%7Egenerator%7Eui%2FWSGenerator%3FSAPtestId%3D0 This link may differ depending on your local configuration. This is a WebDynpro application that should be deployed in the development system. In the MDM Web Services Generator wizard. In the Logon to MDM Repository section.Using MDM 7.2 Configuration in the MDM system 5. For the purpose of this guide we created the project CustomerWS: 2. In the Logon to MDM Server section. enter the Repository name CustomerRepos with the login User name and Password and click Next.

the wizard allows you to select the tables for which the web services should be made available.Using MDM 7. and choose the search and retrieve operations as shown below: May 2009 9 . In the next step.1 Key-Mappings in a PI Landscape 3. For the purpose of this guide we select the Customers table.

In order to optimize performance select only the Customer MDM Id field. Save the project and click Generate to generate the web service.Using MDM 7. select the Transport Protocol. 5. In the next screen. the wizard allows you to configure the fields that should be exposed by the web-service. In the next step.1 Key-Mappings in a PI Landscape 4. In the example we used HTTP. however https protocol could be used as well. 6. The Key mapping fields do not need to be selected as they will be automatically generated by the tool. May 2009 10 . The generated web-service can now be deployed to the Web AS and make it available for the consumer applications such as SAP Netweaver PI to consume it.

1 The link to the corresponding url can be found under http://<server>:<port> May 2009 11 . Logon to the SAP NetWeaver PI via SAPGUI with your username and password. This includes defining the Software components and Business systems in the System Landscape Directory (SLD). This will launch the Integration Builder homepage in a separate window as shown below. 2.. configuring the design objects in the ES Repository. This web service can be tested now using the Web Service navigator in SAP NetWeaver 1 as shown below: 5..1 Key-Mappings in a PI Landscape 7.Using MDM 7.3 Configuration in the PI System The section covers configuration steps required in the PI system to configure the Key Mapping Scenario. and defining the configuration and routing objects in the Integration Directory of SAP NetWeaver PI. 1. . From the main menu select “Start Integration Builder” (Transaction SXMB_IFR).

create a new product called “MDM_product” with the Unit Name “MDM_Unit”. refer to the Appendix section.3.3.1. In the next screen. This will bring up the SLD in a separate window.1 System Landscape Directory This section covers the creation of Software Component for housing the design objects. Select “Products” from the “Software Catalog”.1.2 Create Technical and Business Systems This guide assumes that the technical and business systems have already been defined for the backend ECC systems. we will define a Software Component that will house all the development objects necessary for the MDM Key mapping. . and creation of Technical and Business Systems necessary for communicating with the backend ECC system. select “System Landscape Directory”..1 Create Software Component In this section. May 2009 12 . Note For detailed steps on how to create the technical and business systems in the SLD of SAP NetWeaver PI. 3.Using MDM 7. In the Integration Builder Home Page. This will take you to a wizard for creating a new Product and Software Component Version. More Information: • SAP Help Portal: Software Component Versions 5. 1. 5.1 Key-Mappings in a PI Landscape 5. In the next screen. 2..3. add the software component version to this product and name it “MDM_KEYMAPPING” as shown in the below screen.

Enterprise Services Repository This section covers the steps required in the ES Repository for the MDM Key-mapping. Make sure to save the object. create the structure for the OrderRequest as specified below.. 4. In the next dialog-window. Save and Close. 6. 3. Select the SWCV “MDM_KEYMAPPING” from the list of software component versions and click “Import”. This will launch the java web start application. You can modify the structure to meet your specific needs.3. select “Data Type” from the Interface objects node and create a new Data Type “OrderRequest”. Note The structure shown below is a sample order data created for this scenario.. This will bring the SWCV in the right frame. In the next dialog-window. The new namespace should be visible under the SWCV node in the left frame.Using MDM 7.1 Key-Mappings in a PI Landscape 5. Click on the menu Object New. In the left frame. Switch to edit mode and add the namespace “http://sap. The newly created SWCV should appear in the left frame.com/mdm/pi/keymapping”. Login with your user ID and password. you need to enter the system details in the section “Connection data for Import from SAP System” of SWCV. 1. In the data type editor. In the left frame. From the Integration Builder home page. But if you need to import these objects into your SWCV.com/mdm/pi/keymapping” and select “New”. 2. Note The best practice is to import SAP Interfaces such as RFCs and IDocs into SAP BASIS or SAP APPL software components to avoid redundancy. right-click on the Namespace “http://sap. select “Enterprise Services Builder”.2 . select “Work Areas” and “Software Component Versions” and choose the radio button “Import from SLD”. Open the SWCV and then double-click on the version. 5. May 2009 13 .

For the section “data type used” you can go to the input help (F4) and choose your data type “OrderRequest” (created in the previous step) from the drop-down list. In the left frame. The interface should be outbound and asynchronous as shown in the screen below. right-click on the namespace “http://sap. Verify the data type and save the object. In the next dialog-window. select “Service Interface” from the Interface objects node and create a new Service Interface called “Orders_Out”.Using MDM 7. Switch to edit mode on the OrderRequest message type.1 Key-Mappings in a PI Landscape 7.com/mdm/pi/keymapping” and select “New”. 9. May 2009 14 . In the next dialog-window. Right-click on the namespace and select New. 8. select “Message Type” from the Interface objects node and create a new Message Type called “OrderRequest”.

Switch to the edit mode on the “Mdm_Cust” external definition. In the next dialog-window.com/mdm/pi/keymapping” and select New.2.com/mdm/pi/keymapping”. you will import the WSDL for the MDM Web service “SAP_MDM_CUSTOMER_01” into the external definition of the namespace “http://sap. right-click on the namespace”http://sap. May 2009 15 . In this step. In the left frame. Select the category as “wsdl” and import the WSDL file for the SAP_MDM_CUSTOMER_01 web service and save the object.1 Key-Mappings in a PI Landscape 10. This Web service will be used for looking up the customer data in the MDM database. The procedure for generating the web services in MDM is described in Section 5. select “External Definition” from the Interface objects node and create a new External Definition called “Mdm_Cust”.1.Using MDM 7.

In this step. Right-click on the namespace and select New. choose the message type “External Message” and select “retrieveCustomersIn_doc” as the Request message and “retrieveCustomersOut_doc” as the Response message from the drop-down list. select your message type “OrderRequest” as source message. This can be achieved easily by locating the field in the target field structure and then drag and drop from the source field to the target field. Note <Enter text here> You need to import the ORDERS. Source field in OrderRequest Header Currency Header PONumber Header DocType Target field in ORDERS05 E1EDK01 CURCY E1EDK01 BELNR E1EDK01 BSART May 2009 16 . As target message. In the right frame below. In the next dialogwindow. right-click the namespace and select “New”.ORDERS05 IDoc from the SAP BASIS software component under the node “Imported Objects”.Using MDM 7. you will create the graphical mapping between the custom order data and the Orders05 Idoc. select the node “Mapping Objects” and create a new Message Mapping object and name it “Orders_ORDERS05_Lookup”. see SAP Help Portal: Importing IDocs and RFCs. The interface should be inbound and synchronous as shown in the screen below: 12. select the ORDERS. For more information on how to import IDocs. 13. In the graphical mapping editor. Please refer to the table below for the mapping rules and make sure to save the mapping.ORDERSO5 IDoc into the imported Objects section of the SAP BASIS software component prior to the mapping. Map the fields of the source document to the equivalent fields in the ORDERS05 IDoc.1 Key-Mappings in a PI Landscape 11. In the left frame. In the next dialog-window. select “Service Interface” from the Interface objects node and create a new Service Interface called “MdmService_Sync”.

Refer to the table below for more details on the mapping rules.1 Key-Mappings in a PI Landscape Header PartnerInfo PartnerRole Header PartnerInfo Name Header PartnerInfo Street Header PartnerInfo City Header PartnerInfo Zip Header PartnerInfo Country Header PartnerInfo Region Header PartnerInfo Name2 Header PartnerInfo Language Header PONumber Header PODate Header References Qualifier Header References RefNum Header References RefText Items ItemNumber Items Action Items Quantity Items UOM Items MaterialInfo Action Items MaterialInfo Material E1EDKA1 PARVW E1EDKA1 NAME1 E1EDKA1 STRAS E1EDKA1 ORT01 E1EDKA1 PSTLZ E1EDKA1 LAND1 E1EDKA1 REGIO E1EDKA1 BNAME E1EDKA1 SPRAS_ISO E1EDK02 BELNR E1EDK02 DATUM E1EDK17 QUALF E1EDK17 LKOND E1EDK17 LKTEXT E1EDP01 POSEX E1EDP01 ACTION E1EDP01 MENGE E1EDP01 MENEE E1EDP19 QUALF E1EDP19 IDTNR 14. Now we have to assign constants to certain fields and attributes in the IDoc. Constant 1 1 1 1 001 1 1 1 Target field in IDoc ORDERS05 IDOC BEGIN E1EDK01 SEGMENT E1EDKA1 SEGMENT E1EDK02 SEGMENT E1EDK02 QUALF E1EDK17 SEGMENT E1EDP01 SEGMENT E1EDP19 SEGMENT May 2009 17 .Using MDM 7.

You can use the mapping lookup API in the user-defined functions of the message mapping to make this call.1 Key-Mappings in a PI Landscape Mapping Lookups 15. In the Import Instructions tab add the imports as shown in the screen below. By using mapping lookup. As a first step you create the java class DOMUtil. mapping programs in SAP Netweaver PI can call functions from other application systems (MDM in this case) while a mapping program on the Integration Server is being executed. we use mapping lookups to lookup customer specific information in the MDM application by making a web service call at runtime while the message mapping being executed. click on the Archives Used tab and add the DOMUtil class from the imported archives. In the mapping editor of the message mapping Orders_ORDERS05_Lookup. Save the Object. In the Functions and Java areas section. Import this class into the imported archives node as shown in the screen below.Using MDM 7. b. In this step. a. Note Please refer to the Java code for the DOMUtil class in Appendix B. switch to the Functions tab Page. May 2009 18 .class with NetWeaver Developer Studio or any Java Workbench.

GetKeyMap – In this user-defined function. More details on how to code this user defined function can be found at the link: Implementing Lookups using SystemAccessor.Using MDM 7. May 2009 19 .1 Key-Mappings in a PI Landscape The following user-defined functions need to be created for your message mapping Orders_ORDERS05_Lookup to execute the mapping lookup using the mapping Lookup API. you will build the payload that the soap adapter expects and parse the result payload. More details on how to use the Lookup API in a message mapping and the steps that need to be performed in the Integration Directory can be found at the link: Using the Lookup API in a Message Mapping.

This mapping rule makes the web service call to the MDM server while the mapping program is being executed on the Integration Server at runtime.Using MDM 7. In the mapping editor. In the subsequent dialog. Once the lookup API is implemented in the user-defined function of the message mapping and have it configured in the integration directory (See the configuration steps 2 and 3 defined in the Integration Directory section below). To use these two user-defined functions. we can do the following mapping: In the mapping editor. May 2009 20 . 16. map the source fields Header PartnerInfo PartnerRole and Header PartnerInfo PartnerNumber to the target field E1EDK01 with the following mapping rule. Save and activate the message mapping Orders_ORDERS05_Lookup. Note Please refer to the Java code for these functions in Appendix C and Appendix D.1 Key-Mappings in a PI Landscape getGlobalContainerValue: This function is used to get the value from the resulting payload. you should be able to test the message mapping program using the Test tab of the Operation Mapping (defined in Step 16) of the Enterprise Services Repository. Enter the Java code in the subsequent dialog and save it. To create these new functions select “Create New Function” button at the bottom left corner of the message mapping editor. fill in the label of the function and the necessary parameters and then click on Create Function button. map the source fields Header PartnerInfo PartnerRole and Header PartnerInfo PartnerNumber to the target field E1EDKA1 PARTN with the following mapping rule.

1 Key-Mappings in a PI Landscape 17. Save the Business Component.3 . select the node “Mapping Objects” and create a new Operation Mapping object and name it “Orders2Idoc”. Login with your user ID and password. This will launch the java web start application. 2. In the left frame. select “Integration Builder”. right-click the namespace and select “New”.3. In this step. select the Receiver Tab and assign the inbound interface defined in the ES Repository. Click on the menu Object New. In the next dialog-window. 1. In the next screen. you will create an Operation mapping object. “MdmService_Sync” in your namespace (http://sap.. Integration Directory This section covers the steps required in the Integration Directory for the MDM Key-mapping. Note The objects defined in the steps 2 and 3 below are used to make a web service call to MDM Server from the message mapping using the mapping Lookup API. select Collaboration profiles Business Component and assign the name ‘MDMSoapService” to this component and click on Create.com/mdm/pi/keymapping). 5. In the create dialog-box. May 2009 21 . Activate all your change lists.ORDERS05 Mapping Program: Orders_ORDERS05_Lookup 18.. Assign the following the Service Interfaces and mappings to the newly created operation mapping: • • • Source Operation: Orders_Out Target Operation: ORDERS. From the Integration Builder home page. In the left frame.Using MDM 7.

you will create the communication channel to make a call to the MDM Web Service using the SOAP Adapter. In the Identifiers tab. Create a Sender Party: In the left frame. In the left frame. 4. In the next screen.Using MDM 7.1 Key-Mappings in a PI Landscape 3. Click on the menu Object New. enter the alternative identifier for the backend system as shown in the screen below: May 2009 22 . assign the name ‘MDM_Soap_Receiver” to this communication channel and click on Create. enter the values as shown in the screen below and Save. select Collaboration profile Party and assign the name ‘MDM_Sender” to this component and click Create. right-click on the Business Component MDMSoapService Communication Channel and click on New. In the create dialog-box. In the create dialog-box. The Target URL is the URL for the MDM web service. In this step.

enter the values as shown in the screen below and save. In the create dialog-box.Using MDM 7. select the Receiver Tab and assign the inbound interface defined in the ES Repository. uncheck the “Create Communication Channels automatically” check box. and click on Finish. select Collaboration profiles Business Component and assign the name ‘MDM_BS” to this component and click on Create. Create the Receiver Communication Channel: In this step. Save the Business Component. right-click on the Party MDM_Sender Communication Component and click New. select the Business system for the backend ECC system ECC_100 (created in APPENDIX D). you will create the communication channel to communicate with the backend ECC system using IDoc Adapter.com/mdm/pi/keymapping). In the next screen. In the left frame. 7. In the next pop-up dialog. Create the Sender Business Component: In the left frame. right-click on the Business System node and click on Assign Business Systems. SAP Release: Release of the SAP System May 2009 23 . In the next screen. 6. Create the Receiver Business System: In the left frame. • • • • RFC Destination: RFC Destination for the Backend ECC system created using Transaction Code SM59 Interface Version: Interface version of the IDOC Port: Port for the backend system created using Transaction code IDX1.1 Key-Mappings in a PI Landscape 5. “Orders_Out” in your namespace (http://sap. right-click on the Business System ECC_100 Communication Channel and click on New.

Create the Receiver Determination: In the left frame. choose the Contents tab and choose the ECC_100 as the communication component and Save. Click on the menu Object New. May 2009 24 .1 Key-Mappings in a PI Landscape 8.Using MDM 7.com/mdm/pi/keymapping In the next window. • • • • Communication Party: MDM_Sender Communication Component: MDM_BS Interface: Orders_Out Namespace: http://sap. In the create dialog-box. choose Communication Object Receiver Determination and assign the following values and click Create.

Create the Interface Determination: Open the Receiver Determination object created in step 8 (if it is not already open).ORDERS05 interface. Expand ECC_100 and highlight the ORDERS.ORDERS05 interface. Choose the following values for the remaining fields as shown in the screen below and Save. In the frame Objects of Selected Criterion. Choose the following values for the remaining fields as shown in the screen below and Save. right-click on the Receiver Agreement and click New specific.1 Key-Mappings in a PI Landscape 9. • Receiver Communication Channel: IDoc_receiver May 2009 25 . The Business it is not already open). This defaults some of the specific values for the Interface determination.ORDERS05 Namespace: urn:sap-com:document:sap:idoc:messages 10. • • • Operation Mapping: Orders2Idoc Name: ORDERS. The Business system ECC_100 should now show up in the Receivers List. In the frame Objects of Selected Criterion. This defaults some of the specific values for the Receiver Agreement. switch to Configuration overview and click Refresh ( ). Expand ECC_100 and highlight the ORDERS. rightclick on the interface determination and click New specific. switch to Configuration overview and click Refresh ( system ECC_100 should now show up in the Receivers List.Using MDM 7. Create the Receiver Agreement: Open the Receiver Determination object created in step 8 (if ).

1.4 Testing your Scenario .1 Key-Mappings in a PI Landscape 11. choose Component Monitoring and click on Display.. 2. 5. Active all the Objects in the change list. Login with your user ID and password. navigate to Domain<SID>(domain..Using MDM 7. choose Runtime Workbench. choose Test Message tab as shown below: May 2009 26 . From the Integration Builder home page.00. Then at the bottom of the screen.<host>) Integration Server and click Integration Engine<SID>. In the next screen. Within Components.

com/mdm/pi/keymapping User: Password: Payload: <Your Username> <Your Password> <Test Payload> Note You can generate the payload for this test using Test Tab of message mapping in ESR. You can copy these values from the Receiver Determination object of the MDM_Sender party in the Integration Directory. Enter the following values in the fields of the Test Message tab and click Send Message.Using MDM 7. • • • • • • • • Send Message to: Sender Party: Sender Component: Interface: http://<Host>:<Port Number>/sap/xi/engine?type=entry MDM_Sender MDM_BS Orders_Out Interface Namespace: http://sap. May 2009 27 .1 Key-Mappings in a PI Landscape 3.

In the next screen. 1. In the ABAP Stack of the SAP NetWeaver PI. your messages should appear with a checkered flag (message processed successfully) if it is processed successfully.Using MDM 7.. you can navigate to the details of the message as shown in the screen below: May 2009 28 . go to transaction SXMB_MONI and choose Monitor for Processed XML messages and click Execute ( ).5 Monitoring your Scenario .1 Key-Mappings in a PI Landscape 5. In the monitor screen. 3.. From this screen. You can filter using Sender Party as shown below: 2.

0” from the list of available products.. In the next screen. For the type of technical system. 1. select “Technical Systems” from Landscape section and click on “New Technical System”. In the next screen.. add the central servers and application servers to the technical system 4. select “ECC 5. 2.Using MDM 7. In the SLD Home Page (Click “Home” in the upper left corner). add the Client number and the Client Logical name.40” from the list of available software components and click on “Finish”. . select “AS ABAP” and enter the backend ECC system’s SID. Installation number and the Host Name. In the subsequent screen. 3. More Information: • SAP Help Portal: Working with Technical Systems May 2009 29 .1 Key-Mappings in a PI Landscape APPENDIX A – Creating Technical and Business systems in PI Creating Technical System This section explains the detailed steps required to define a Technical System for the backend ECC system. This will take you to a wizard for creating a new technical system. and select the software component “SAP BASIS 6. 5.

This will take you to a wizard for creating a new business system. In the SLD Home Page (Click “Home” in the upper left corner). select “Business System” from the Landscape section and click on “New Business System”. Select “ECC on ecchost” you created in the previous section as the technical system and click “Next” 4. specify the integration server and click on “Finish”. . 5.. In the next screen. you will define a Business System for the backend ECC system. For the type of technical system that the business system is associated with. select “AS ABAP” and click “Next” 3. select the role of the business system. In the next screen. More Information: • SAP Help Portal: Working with Business Systems May 2009 30 . enter “ECC_100” as the name of the Business system. In the next screen..Using MDM 7. 1. verify the products and software components that are installed for the business system.1 Key-Mappings in a PI Landscape Creating Business System In this section. In the following screen. 2.

Using MDM 7.item(i). return getSimpleElementText(namedElement). name). i++) { Node child = children. } } May 2009 31 . String name) { Element namedElement = getFirstElement(node.*.dom.sap.parse.w3c.toString(). NodeList children = node.item(0).1 Key-Mappings in a PI Landscape B – Java code for DOMUtil class package com. public class DOMUtil { public static Element getFirstElement(Element element.getLength(). } public static String getSimpleElementText(Element node. } public static String getSimpleElementText(Element node) { StringBuffer sb = new StringBuffer().getElementsByTagName(name). import org.getChildNodes(). } return sb.dom. if (nl. i < children. return (Element) nl.xi. String name) { NodeList nl = element.append(child. for (int i = 0.getLength() < 1) throw new RuntimeException( " Element: " + element + " does not contain: " + name).mapping.getNodeValue()). if (child instanceof Text) sb.

setParameter("CustomerData".close(). // Store in a Global Container GlobalContainer gc = container. Document document = builder.getDocumentElement().newInstance(). try{ // Determine a Communication channel. // Execute Lookup Payload result = accessor.lookup. NodeList customer = retrieveCustomersResponse.getElementsByTagName("pns:customers").getChannel("*".getGlobalContainer().mapping. } finally { try { if (accessor != null) accessor.} May 2009 32 . InputStream resStream = result. "MDMSoapService". Element retrieveCustomersResponse = document. } catch (Exception e) {return e. public String GetKeyMap(String Remkey.getXmlPayload(isRequest). Channel channel = LookupService. "MDM_Soap_Receiver").*. Container container) throws StreamTransformationException{ String request = “<Payload of the MDM_Cust Request web service.aii. } catch (Exception e) { return e. gc.getMessage().sap.getSystemAccessor(channel). SystemAccessor accessor = null. See sample below>” InputStream isRequest = new ByteArrayInputStream(request. This communication channel should already be configured in the Integration Directory.newDocumentBuilder().getContent(). // Create a payload according to the data type which the adapter expects Payload payload = LookupService. // Get a System Accessor for the Channel accessor = LookupService.1 Key-Mappings in a PI Landscape C – Java code for GetKeyMap user-defined function import com.getBytes()).call(payload). customer). } } return Remkey.Using MDM 7.parse(resStream). DocumentBuilder builder = factory.getMessage(). // Parse Response DocumentBuilderFactory factory = DocumentBuilderFactory.

beans">English [US]</ns2:dataLang> <ns2:repositoryName xmlns:ns2="urn:com.mdm.mdm.0" encoding="UTF-8"?> <ns0:retrieveCustomers xmlns:ns0="urn:SAP_MDM_CUSTOMER_01Vi"> <ns0:query> <ns1:criteria xmlns:ns1="urn:com.sap.sap.sap.core.ws.1 Key-Mappings in a PI Landscape Sample Payload for GetKeyMap <?xml version="1.beans"> <ns1:internalID/> <ns1:keyMapping> <ns1:remoteSystem>R3_ERP</ns1:remoteSystem> <ns1:remoteKey>This field is passed as a parameter to UDF</ns1:remoteKey> </ns1:keyMapping> </ns1:criteria> <ns1:resultDefinition xmlns:ns1="urn:com.core.beans">madd00002696a</ns2:serverName> </ns0:reposInfo> </ns0:retrieveCustomers> May 2009 33 .beans">SAP_CUSTOMER_012020</ns2:repositoryName> <ns2:serverName xmlns:ns2="urn:com.ws.sap.core.mdm.sap.Using MDM 7.mdm.mdm.beans"> <ns1:fieldListType>all</ns1:fieldListType> <ns1:retrieveKeyMapping>true</ns1:retrieveKeyMapping> <ns1:loadAttributes>false</ns1:loadAttributes> </ns1:resultDefinition> </ns0:query> <ns0:reposInfo> <ns2:dataLang xmlns:ns2="urn:com.

} May 2009 34 .1 Key-Mappings in a PI Landscape D . try{ GlobalContainer gc = container. Container container) throws StreamTransformationException{ String result = new String().item(i).getMessage(). for (int i = 0. i < custList.getGlobalContainer(). NodeList custList = (NodeList) gc. String valueName. } return result. i++) { result = DOMUtil.getParameter(objectName).getLength().valueName). } } catch (Exception e) { return e.getSimpleElementText((Element) custList.Using MDM 7.Java code for getGlobalContainerValue public String getGlobalContainerValue(String objectName.

com/irj/sdn/howtoguides .www.sdn.sap.