Skip to Content
Author's profile photo Former Member

Accessing UKMS from message mappings (single value implementation) – Part 1

Accessing UKMS by using graphical RFC lookup. Single value implementation.

Introduction

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.

Prerequisites

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:

image

All required objects (DTs and MTs) are created in ESR. The MT_SAPMaterial is used in outbound message:

image

The inbound message is based on the MT_NONSAPMaterial:

image

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

Solution

UKMS provides the following RFC-enabled function modules for accessing the most important methods:

image

To read existing mappings UKM_GET_KEY_MAPPINGS can be used.

1. Import UKM_GET_KEY_MAPPINGS in your SWCV.

image

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.

image

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.

image

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.

image

5. Create the constants containing values for RFC input parameters (s. Prerequisites) and map Material_ID to Material_Code via RFC Lookup.

image

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.

image

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.

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Marçal Oliveras
      Marçal Oliveras
      Hi Rudolf, thanks for your weblog, I know that this blog is not for describe what is UKMS but I read the help.sap.com link and I still don't get it.

      Why UKMS? Which is the utility and the advantages? If you for example use the RFC 'RFC_READ_TABLE' you don't get a similar result?

      I'm sure that UKMS is usefull but I don't see it yet.

      Author's profile photo Shabarish Vijayakumar
      Shabarish Vijayakumar
      it would be great if you explains what UKMS is towards the start of the blog so that the reader can get an idea of what he is getting into 🙂
      Author's profile photo Marçal Oliveras
      Marçal Oliveras
      Hi, I found a document about UKMS. It's not easy to understand how it works entirely but it can be usefull in some projects.

      Read the link:
      http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b0d09911-ebb2-2b10-959d-8bd91f556178

      Author's profile photo Former Member
      Former Member
      Hi Marshal,

      blog is updated now with some general information regarding what is UKMS and what it is good for (s. "Introduction").

      Regarding advantages and drawbacks you can refer to this presentation ->
      http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b0d09911-ebb2-2b10-959d-8bd91f556178

      Also this one provides an overview about UKMS on PI -> http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/50120693-f1a9-2c10-cd8c-91967e6b7dc3

      Hope this will provide you with some basic information to get deeper inside.

      Regards
      Rudolf