HOW TO – Read & Write the MDG key mapping informations programmatically (aka UKMS)
Hello my nerdy friends
I am sure you were searching a lot on google about the possibility to read and write the MDG key mapping programmatically.
For example if you have to replace MDM with MDG you need to get the existing key mapping informations from MDM and write it in MDG as initial cutover, and I am sure you don’t want to do that manually one by one =)
And another example could be that your BI team need to read the key mapping informations from MDG for reporting purpose.
Yes, I know, there is only the official SAP documentation on the UKMS api:
But no real examples on how to use that (as usual :D).
Don’t worry mate I will help you.
Step 1 – Understanding
First of all let’s have a look to the standard MDG functionality to read and write the key mapping.
Allright, first of all you have to select the object for which you want to read the key mapping informations. In our example the Business partner (1). And for the object identifier we can select one of the possible values, in the example Business Partner Number (2). Enter a value.+
WE HAVE CREATED OUR SOURCE ENTRY (the search filter basically)
Now click on “Search Objects” and all the TARGET ENTRIES will be populated.
Also here you have, for each row, the object type (4) and the object identifier (3)
Step 2 – Decoding Parameters
Ok now keep in mind that OBJECT TYPE AND THE OBJECT IDENTIFIER ARE ENCODED WITH NUMERIC VALUES, and in order to use them programmatically you need a conversion table (that you can easily make in excel).
Ho to find the encoded values? Very simple question, have a look below:
Great!! We found our object identifier and the business object that is linked to them.
Step 3 – Identifying context
In addition you will need the mapping context (a string -> in our example is “BusinessPartner”) to identify the object type when you programmatically use the key mapping apis, to tell the system that you are doing it for Business partners, materials, etc.
And that’s it! Are you ready to do it?…
Step 4 – Writing ABAP and enjoying!
I hope you have good lenses…
place a debug after the get method to see the same values that we saw before using the webdynpro.
And go to the webdynpro to see the values that we added in abap to the key mapping informations for our BPs!
Thanks for sharing useful information!
We are using key mapping for BP between MDG Hub into MDG client with internal number range. So KM works perfectly fine.
But my question is as in MDG_KM_MAITAIN as we are unable to see Object ID Type Business Partner # for MDG Client (Here we are able to see only Business Partner UUID # for MDG Client)
Is any thing is missing or how to display created BP # for MDG Client System
Thanks for providing complete information at one place.
This is code is perfectly working for me in Manual Replication of Material.
But when we are calling same code in Auto Replication Group Reference is not getting updated which results in wrong results.