Some things to know about the import and multiple main tables.
Import of Lookup Main Fields
Nevertheless it is possible to import data for fields that are actually lookup fields to either the same or a different main table of the repository. The following paragraphs show how this can be achieved. The screenshots shown on this Wiki page are all based upon the SAP MDM Vendor repository (check the related SAP Note for details about the repository!).
Multiple Main Tables and Lookup Main Fields
First, your repository should at least contain a single lookup main field, either being linked to the same or a different main table. The Vendor repository contains two main tables for Vendors and Banks as well as several lookup main fields refering to both tables. The Wiki uses the lookup main field from the Vendors main table tuple Bank Details into the second main table Banks as reference.
Enabled Remote Key Mapping
Second, it is mandatory that the main table you want to use as lookup table is enabled for Remote Key Mapping. If this is not the case, you cannot import the lookup main field values in MDM Import Manager. Currently the remote key is the only value that is usable in MDM Import Manager for identifying the record that should be used as lookup.
Third, it is mandatory that the record that should be used as lookup value already exists in the MDM Repository. In MDM Import Manager, you will see only those records in the Destination Values pane. As stated above, it is not possible to import the desired record into the second main table in the same import run. This is even valid, if the lookup main field refers to the same lookup table. You cannot import the record that should be used as lookup value in the same import run that imports the parent record. You have to import the data in two different import runs!
Coming back to the Vendor repository, there are a few Banks available if you use the Sample Data that is delivered with the Business Content Package. As soon as you have initialized your repository, the Banks main table will look like this:
The selected record Second Bank of the United States already has a remote key - all other records have remote keys, too.
Setting up the Import Map
In MDM Import Manager, you need to create an Import Map for the Main Table that contains the lookup main field. Following the Vendor example, the Import Map _CREMDM04 imports records from the CREMDM04 IDoc into the Vendors main table. Use the sample data file _Vendors_from_ERP.xml if you want to follow the screenshots.
Next to several more field mappings the Import Map feeds the Bank Details tuple, too. The source values are part of the E1LFBKM IDoc segment. Navigate to mentioned segment/field mapping and have a look at the related value mapping:
The Destination Values pane shows the existing Banks of the Vendor repository. The mapping indicates that one of the Vendor records to be imported is using the Second Bank of the United States as its bank.
Value Mapping & Displayed Values
Usually it should not be necessary to perform the value mapping manually as it is based upon remote keys and thus should be done automatically by MDM Import Manager. If the mapping is not done, use the Automap button. MDM Import Manager is able to identify and map the records by comparing the incoming source values with the existing remote keys of the destination values. It is mandatory, of course, that the source values are the actual remote keys of the existing records.
Although the actual mapping is done based upon the remote keys, the screenshot above shows that MDM Import Manager does not display the remote keys in the destination values pane but the display fields of the destination main table instead. This behavior is by design. (Note from the author: there seems to be a bug in my current MDM version. The figures that you can see in the beginning of the destination values should be the related bank's country...).
If you do not see your desired destination value, respectively if you cannot map a source value to a desired destination value, you should ensure that your destination value already exisits in the MDM repository. Additionally make sure that the record has the correct key mapping information related to its source value.
Result of the Import
As soon as you have successfully imported your records, switch to MDM Data Manager and locate the record using the Second Bank of the United States. To speed up our search, it is Vendor number 6, Paper Inc. Locate the Bank Details tuple and jump into its details by double-clicking it. You'll see the following result:
- Import into two main tables with a single import map does not work.
- Import of lookup main fields works if you fulfill the requirements:
- the repository uses lookup main fields
- the target main table is remote key enabled
- the records that should be the lookup values already exist in the main table
- the source values are the actual remote keys of the already existing records