Accessing UKMS from message mappings (single value implementation) – Part 1
Accessing UKMS by using graphical RFC lookup. Single value implementation.
In large landscapes with multiple SAP and non-SAP systems unfortunately the identical information is stored often in multiple places. Thus the key mapping (translation of unique identifiers) is used by enterprises for data integration. UKMS is SAP’s solution for accessing and maintaining key mappings on PI and is available up from SAP Netweaver 7.0 (2004s).
Since the main intention of this blog was not to describe what is UKMS but to outline how UKMS can be accessed during the mapping runtime and enrich your message content, refer please to the SAP library section Unified Key Mapping Service as well as to the following presentation on SDN to get the brief understanding of UKMS.
Basically there is more than one way to access UKMS from PI. UKMS provide ABAP OO interface, RFC-enabled function modules and Java API, which can be called directly or from XSLT mappings by using XSLT include. The current blog outlines two possible approaches. The Part 1 describes simple way of accessing UKMS by RFC lookup as a single value implementation and provides brief understanding of RFC request / response structures. Based on it we will implement in Accessing UKMS from message mappings (multiple values implementation) – Part 2 own UDF for accessing UKMS by using Java API and process multiple key mapping requests in single RFC call.
Suppose that we want map fictitious SAP material ID to the non-SAP material code during the mapping runtime. Appropriate RFC receiver communication channel has been configured in Integration Directory to access UKMS. UKMS is configured in the ABAP stack and the following key-value-pairs have been maintained in UKMS:
All required objects (DTs and MTs) are created in ESR. The MT_SAPMaterial is used in outbound message:
The inbound message is based on the MT_NONSAPMaterial:
Now let us begin with the exciting part of this blog.
Note: UKMS is part of SAP NetWeaver 2004s and later. The solution described below has been tested on PI 7.0 SP16, PI 7.1 SP6 and PI 7.1 SP7
UKMS provides the following RFC-enabled function modules for accessing the most important methods:
To read existing mappings UKM_GET_KEY_MAPPINGS can be used.
1. Import UKM_GET_KEY_MAPPINGS in your SWCV.
2. Create Message Mapping for MT_SAPMaterial and MT_NONSAPMaterial (s. Introduction).
3. Select the tab “Signature” and insert import parameter for receiver RFC channel, which is required to access UKMS functional module.
4. Map the messages just one to one. Point of interest for us here is the mapping of fields Material_ID to Material_Code, for which the UKMS lookup should be executed. Open the mapping for those fields, select “Conversions” in the list of available functions and add RFC lookup function to your mapping.
Initialize RFC lookup function by choosing imported functional module UKM_GET_KEY_MAPPING and select created import parameter of type RFC as communication channel. Have a look at request and response structures and select the following fields: for RFC request select MAIN_CONTEXT_ID as well as SCHEME_ID, SCHEME_AGENCY_ID and VALUE from SOURCE node and SCHEME_ID, SCHEME_AGENCY_ID from TARGET node. For RFC response select VALUE from TARGET node.
5. Create the constants containing values for RFC input parameters (s. Prerequisites) and map Material_ID to Material_Code via RFC Lookup.
6. That’s all! To test the mapping initialize your import parameter with the receiver RFC channel created in ID, create the test instance and execute the mapping.
Summary of the Part 1 and outlook on the Part 2
UKMS provides RFC-enabled functional module, which wrappes the relevant functionality for reading the key mappings maintained. By using the simple RFC lookup, provided as standard mapping function UKMS can be accessed from message mapping during the runtime.
This can satisfy your requirements if you are performing lookup for single value. But what to do if you need to access UKMS multiple times per message mapping? Suppose that you have to map dozens of fields based on unified key mappings. By setting the trace level to “Debug” or “All” and testing the mapping you will realize that for every single value separate RFC call is executed. Depending on the number of calls this can be very performance intensive… In the Accessing UKMS from message mappings (multiple values implementation) – Part 2 of this blog we will see a reusable Java-based approach for collecting all source values and accessing UKMS via single RFCcall.