Part 7: Migrating MDM Configuration

This is part seven of the SearchSAP.com Crash Course A QuickStart Guide to SAP MDM 5.5.

MDM projects that implement a custom data model, or extensions to the standard models, will need to include a site-specific strategy to document and migrate changes.

  1. The data model for a repository can be exported from the console as a complete schema and selected changes then imported into a target repository. This feature, delivered with SP4, is the only way to reliably transport incremental changes to your MDM data model.

  2. Validation Expressions and MDM security configuration are two areas of custom configuration that cannot be migrated from the console. These will need to be manually re-applied to the target repository.

  3. Maps saved via the Import Manager and via the Syndicator can be saved to the file system and migrated with relative ease into the target repository. This requires the source and target tables be absolutely identical.

  4. MDM does not currently provide a physical report that documents the meta model -- the metadata for the model, validation expressions, security, port configuration, etc. The Java API however completely exposes the meta model, with the exception of expressions. The following specification can get you started on building your own MDM meta model report.

MDM API Objects

CatalogData
Search
CMTableInfoArray
CMTableType
CMFieldInfoArray
CMFieldType
ResultSetDefinition
A2iResultSet

Outline

Connect to MDM Catalog using the Server + Port + Login + Password
--
List Tables and Fields:
Open output File1 (.csv)
Get All Catalog Tables
If Lookup, Main or Expressions Table Types
For each Table, Get Fields
For each Field, Get Type and Information
Format and Write Each Field's properties (comma delimited)
Close output File1
--
List Expressions and properties:
Open output File2 (.csv)
Define a Result Set for the MDM Validations Table
Get all fields for the MDM Validations Table
Add all fields to the Result Set Definition
Define a Search on the MDM Validations Table
Execute the Search with no parameters and retrieve the Result Set
For each record in the Result Set
Get the fields in the record
Format and Write the Field Values (comma delimited)
Close output File2
--
Disconnect from MDM Catalog

Sample Code for Table/Field report

/* Display MDM Tables, Table Types and Fields
*/
String delimiter = ",";

private void displayAllCatalogTables(CMTableInfoArray tableInfos) 
throws StringException, IOException
{
   String fileName = filepath + "My_MDM_Tables" + ".csv";
   BufferedWriter outputFile = new BufferedWriter(new FileWriter(fileName, true));
   // Report Header Line
   outputFile.write(
   "Table Name" + delimiter + 
   "Table Type" + delimiter + 
   "MDM Field Name" + delimiter + 
   "Field Position" + delimiter + 
   "Field Type" + delimiter + 
   "Width" + delimiter + 
   "Required" + delimiter + 
   "Qualifier" + delimiter + 
   "Multi-Valued" + delimiter + 
   "Multilingual" + delimiter +  
   "Display Field" + delimiter + 
   "Searchable" + delimiter + 
   "Calculated" + delimiter + 
   "Calculation" + delimiter +  
   "Boolean: True/False/Default Values" + delimiter + 
   "Lookup Table" + delimiter + 
   "Writable Once" );

 A2iIntArray displayFieldIDs = new A2iIntArray();
 for (int i = 0; i < tableInfos.GetSize(); i++) {
 CMTableInfo tableInfo = (CMTableInfo) tableInfos.GetAt(i);
 // Only display selected table types
 if (CMTableType.FlatTable == tableInfo.GetType()
 || CMTableType.MainTable == tableInfo.GetType()
 || CMTableType.QualFlatTable == tableInfo.GetType()
 || CMTableType.HierTable == tableInfo.GetType()
 || CMTableType.HierAttrTable == tableInfo.GetType()
 || CMTableType.ExpressionsTable == tableInfo.GetType()) {
  tableInfo.GetDisplayFieldIDs(displayFieldIDs);
  outputFile.write(displayTableStructure(tableInfo.GetName(), displayFieldIDs, tableInfo));
 }
  }
  outputFile.close();
}

/* Display all of the fields in the table, and their MDM data types
*/
private String displayTableStructure
  (String oneTable, A2iIntArray displayFieldIDs, CMTableInfo tableInfo) 
throws StringException 
{
String oneFieldTypeString = "";
String returnVal = "";

int tableID = tableInfo.GetID();
CMFieldInfoArray fieldInfoArray = catalogData.GetFields( tableID );
boolean isDisplayField = false;
for (int i=0; i < fieldInfoArray.GetSize(); i++)
{
 CMFieldInfo fieldInfo = fieldInfoArray.GetCMFieldInfoAt(i);
 int fieldType = fieldInfo.GetType();
 // Table Name and Type
 String tableTypeString = "";
 switch(tableInfo.GetType())
 {
 case 0:
  tableTypeString = "Main";
  break;
 case 1:
  tableTypeString = "Lookup Flat";
  break;
 case 2:
  tableTypeString = "Validation Groups";
  break;
 case 4:
  tableTypeString = "Taxonomy";
  break;
 case 22:
  tableTypeString = "Qualified Flat";
  break;
 case 31:
  tableTypeString = "Expressions";
  break;
 default:
 }
 oneFieldTypeString = oneTable + delimiter + tableTypeString; 
 // Field Name
 oneFieldTypeString = oneFieldTypeString + delimiter + fieldInfo.GetName();
 // Field Position
 oneFieldTypeString = oneFieldTypeString + delimiter + Integer.toString
  (fieldInfo.GetPosition()+1);
 // Field Type
 oneFieldTypeString = oneFieldTypeString + delimiter + CMFieldType.GetName
  (fieldType);
   
 // Text Width
 String textWidth = "";
 if (fieldInfo.GetFixedTextWidth() != -1)
  textWidth = Integer.toString(fieldInfo.GetFixedTextWidth());
 oneFieldTypeString = oneFieldTypeString + delimiter + textWidth;
 // Required
 oneFieldTypeString = booleanToString(oneFieldTypeString, fieldInfo.m_isRequired);  
 //Qualifier
 oneFieldTypeString = booleanToString(oneFieldTypeString, fieldInfo.GetAssociationType() 
                      == FieldAssociationType.QualifierField);
 // Multi-Valued
 oneFieldTypeString = booleanToString(oneFieldTypeString, fieldInfo.IsMultiValue());
 // MultiLingual
 oneFieldTypeString = booleanToString(oneFieldTypeString, fieldInfo.IsMultiLingual()); 
 //Display Field
 isDisplayField = false;
 for (int j=0; j < displayFieldIDs.GetCount(); j++) {
  if (displayFieldIDs.GetAt(j) == fieldInfo.GetID()){
   isDisplayField = true;
   break;
  }
 }
 oneFieldTypeString = booleanToString(oneFieldTypeString, isDisplayField);
 // Searchable
 oneFieldTypeString = booleanToString(oneFieldTypeString, fieldInfo.IsSearchable());
 // Calculated
 oneFieldTypeString = booleanToString(oneFieldTypeString, fieldInfo.IsCalculated());
 // Calculation: TODO Extract expression when available in API
 if (fieldInfo.IsCalculated())
  oneFieldTypeString = oneFieldTypeString + delimiter + "<View in Console>"; 
 else
  oneFieldTypeString = oneFieldTypeString + delimiter + ""; 
 // Boolean: True Value, False Value, Default Value
 String trueValue = "";
 String falseValue = "";
 String defaultValue = "";
 String boolValues = "";
 if (fieldType == CMFieldType.BoolField)
 {
  trueValue = fieldInfo.GetTrueString();
  falseValue = fieldInfo.GetFalseString();
  if (fieldInfo.GetDefaultBoolValue())
   defaultValue = trueValue;
  else
   defaultValue = falseValue;
  boolValues = trueValue + "/" + falseValue + "/" + defaultValue;
 }
 oneFieldTypeString = oneFieldTypeString + delimiter + boolValues;
 // Lookup or Multi-Valued
 String lookupTableName = "";
 if (fieldInfo.IsLookup() || fieldInfo.IsMultiValue())
  lookupTableName = catalogData.GetTable(fieldInfo.GetLookupTableID()).GetName();
 oneFieldTypeString = oneFieldTypeString + delimiter + lookupTableName;
 // Writeable Once
 oneFieldTypeString = booleanToString(oneFieldTypeString, fieldInfo.IsModifyOnce());

 returnVal = returnVal + "n" + oneFieldTypeString;
 }
 return returnVal;
}

/* 
 * Return a Yes/No based on a Boolean
 */
private String booleanToString(String inputString, boolean isTrue) throws StringException {
 if (isTrue)
   return inputString + delimiter + "Yes";
 else
   return inputString + delimiter + "No";
}


A QuickStart Guide to SAP MDM 5.5

  Introduction
 Part 1: Select and Install MDM Components
 Part 2: MDM Components and Modules
 Part 3: MDM architecture: How components fit into the MDM eco-system
 Part 4: The OS/DB Product Availability Matrix for MDM 5.5 SP4
 Part 5: MDM for the Java Developer
 Part 6: Tips and Tools for the MDM Administrator
  Part 7: Migrating MDM Configuration
  Conclusion
This was first published in November 2006

Dig deeper on SAP MDM software

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

This Content Component encountered an error
Close