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!