Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member264403
Discoverer
1.1) Why is Key Mapping Even Required?

In an Enterprise, every object like Product, Customer, Cost center has an Identifier associated to it. For e.g. A Business Partner can be uniquely identified by its partner number. Now this same object can have different name or representatives on several systems or in several components. Due to this it is necessary to be able to store the relationship between these objects and their identifiers.

In an ERP system this information needs to be stored to avoid data duplication. Consider this scenario.

This is what a typical Customer landscape might look like



 

In this case the ID of Business Partner / Customer / Supplier generated on MDG system might be different from the one which is generated on Ariba / Hybris / S/4HANA OP or CE system. To ensure that data duplication does not occur, it is necessary that the hub system (MDG based S/HANA OP in this scenario) has the information about the IDs in the linked systems. This information is provided by the Key Mapping Framework.

 

2.1) Key Mapping Terminology:

Before we dig deeper into the Key Mapping framework, here is the list of terms which are frequently used.

































Term Description
(Object) Identifier Generaldescription:
An Identifier is the non-ambiguous identification of an object within a schema. The identification can be done via single or multiple terms.Description in the context of the Key Mapping Framework:
An identifier in the key mapping framework is built out of the following three parameters:·       


  • Business System

  • Object Identifier Type

  • Object ID in external formatEach object in key mapping has 1 to n identifier, e.g. Business Partner:

  • Business Partner ID

  • Business Partner UUID

  • External ID


KM Key Mapping
Mapping Group A mapping group consists out of at least 2 objects.
Object In the context of the Key Mapping Framework, an object is built out of 1 to n Identifier and can be mapped with multiple other objects.
Business Object Type (BO Type) /Object Type (OTC) The object type is a code value which identifies a business object, not a specific instance, within the Key Mapping Framework.  For eg : Business Partner , Product , Cost Center.
Object Identifier Type (OITC) / Object ID Type

In some parameters of the Key Mapping Framework, OITC is also named as ‘Identifier Defining Scheme Code’.

An object identifier type code differentiates an identifier of a business object from other identifier of the same business object.

For example, the business partner has UUID and a human readable business partner ID as object identifier types. So, Object type Business Partner BO type has two OITC: UUID and Business Partner Id.


This is how the above information will look on the SAP WebDynpro UI:




 

 3.1) Maintaining Key Mapping Customizing in S4/MDG OP System:

In an On-Premise SAP System, the key mapping customizing can be reached directly with transaction IDMIMG.



The entire key mapping customizing can be separated into runtime and design time activities. By default, the for standard SAP Objects like Business partner, Product etc. the required Key Mapping configuration is pre- delivered. The customizing explained here is required only if you want to create Key Mapping for new objects or alter any pre- delivered customizing.

3.2) Runtime customizing activities:

The runtime customizing settings controls the behavior or provides additional features within the key mapping framework.

  • Customize Business Objects for Key Mapping: This customizing activity is used in case the Key Mapping data is not available in the local system and the same needs to be accessed from a Central Registry (remote Business System) maintained by the customer via an RFC call.



  • Define Technical Settings for Business Systems (Optional): Within the customizing activity ‘Define technical Settings for Business Systems’ it is possible to define parameters on the following three levels:



  1. Define settings for business systems

  2. Define settings on business system, business object level.

  3. Define settings on business system, business object, communication channel level.


Design time activities:

  • Define Business Objects: In this customizing activity you define the business object type code, which stands for an identifier for a specific business object.

  • Define Object Identifiers: Within this customizing activity object identifier type codes are defined and assigned to a specific business object type code.

  • Assign Key Structures to Object Identifiers: In this Customizing Activity, you assign the Key Structure to the OITC based on which the Key Mapping will be stored.

  • Define Object Nodes: In this Customizing Activity you define object node types be used in the context of key mapping.

  • Assign Business Objects to Main Contexts: In this customizing, you assign the Main Context or the Mapping Context where the persistence of the specific BO Type should happen.

  • Define mapping contexts: In this customizing activity, you can define mapping contexts across clients for the Unified Key Mapping Service (UKMS). The system automatically creates database tables dependent on a mapping context. The UKMS uses these to store data, object keys and key mappings.


For e.g.: tables for storing Business Partner Key Mapping (having Main Context ‘BNSS’) are :

UKMDB_AGCBNSS0                             UKM: Key Agency

UKMDB_KEYBNSS0                              UKM: Key

UKMDB_MGDBNSS0                             UKM: Negative Mapping Groups

UKMDB_MGPBNSS0                             UKM: Positive Mapping Groups

UKMDB_SCHBNSS0                              UKM: Key Schema

UKMDB_V78BNSS0                               UKM: Value Table

In order to search for any tables of any other Business Objects, find the Main Context assigned to the BO Type using Point 5 above and search in se11 UKM*<MAIN_CONTEXT>* .

For standard usage of key mapping none of the above listed activities are necessary.

3.3) S4/MDG Transaction for Key Mapping

The key mapping framework provides some transactions which are listed in below table. Details about the functionality which is started with the transactions can be found in the individual mentioned sections of this document.
























Transaction Description
MDG_KM_MAINTAIN Starts the Web Dynpro UI for key mapping maintenance.
MDG_ADJUST_IDM Starts the SAP GUI UI for the adjustment of key mapping after a client copy.
MDG_ANALYSE_IDM Starts the SAP GUI UI for the key mapping search.
IDMIMG Direct call of the key mapping customizing.


 

3.4) Key Mapping API

The key mapping framework provides the interface IF_MDG_ID_MATCHING_API_BS for accessing key mapping. An instance of the interface will be created by calling method GET_INSTANCE of class CL_MDG_ID_MATCHING_API_BS.

All methods of the interface and their purpose can be seen in the below table:
















































Interface method Description
ADD_MATCHING Creates key mapping between two or more objects or enhance existing key mapping by adding additional objects.
ADD_OBJECT_DATA Enhances existing objects with additional identifiers or creates new objects
CHANGE_IDENTIFIER Changes identifier data of an existing object
CLEANUP_BUFFER Cleans up the UKMS buffer
DELETE_MATCHING Deletes key mapping between objects and on request the objects of the mapping group.
DELETE_OBJECT_DATA Deletes identifier of an object or the complete object
GET_MATCHING Reads positive key mapping
GET_OBJECT_DATA Reads an object with all its identifiers
QUERY_OBJECTS Provides certain query functionality for key mapping
SAVE Save all buffered changes and enhancements to the key mapping persistency


 

 

 
7 Comments