Search In a MDM Repository

Following code snippet shows the step to search inside MDM repository. It searches the string inside field Vendors in the table Vendors under repository Vendor1 .

public class Connection {     private SimpleConnection simpleConnection;     private String serverName = " ";     private String repositoryName="Vendor1";     private String dbServerName = " ";     private DBMSType dbmsType = DBMSType.MS_SQL;     private RegionProperties dataRegion = new RegionProperties();     private String userSession;     private String repositorySession;     private String userName="Admin";     private String password="mdm";     private RepositorySchema schema;     private RepositoryIdentifier repositoryID;     public void getConnection() {         try {             if (simpleConnection == null) {                 simpleConnection =                     SimpleConnectionFactory.getInstance(serverName);             }         } catch (Exception e) {             //              }     }         public void closeConnection( )       {         //@@begin closeConnection()         try{             if(simpleConnection!=null){                 DestroySessionCommand destroySessionCommand=new DestroySessionCommand(simpleConnection);                 destroySessionCommand.setSession(userSession);                 destroySessionCommand.execute();                 userSession=null;                 simpleConnection.close();             }         }catch(Exception e){
//                    }         //@@end       }           public void getAuthenticatedUserSession( )       {         //@@begin getAuthenticatedUserSession()         /*             * Create and authenticate a new user session to an MDM repository             */            repositoryID=new RepositoryIdentifier(repositoryName,dbServerName,dbmsType);            CreateUserSessionCommand createUserSessionCommand=new CreateUserSessionCommand(simpleConnection);            createUserSessionCommand.setRepositoryIdentifier(repositoryID);            createUserSessionCommand.setDataRegion(dataRegion);            try {                createUserSessionCommand.execute();                    userSession=createUserSessionCommand.getUserSession();// Get the session identifier               /* Authenticate User Session */            TrustedUserSessionCommand trustedUserSessionCommand=new TrustedUserSessionCommand(simpleConnection);            trustedUserSessionCommand.setUserName(userName);                      trustedUserSessionCommand.setSession(userSession);            try {                trustedUserSessionCommand.execute();                userSession=trustedUserSessionCommand.getSession();            } catch (CommandException e1) {                /* Trusted Connection is not accepted */                AuthenticateUserSessionCommand authenticateUserSessionCommand=new AuthenticateUserSessionCommand(simpleConnection);                authenticateUserSessionCommand.setSession(userSession);                authenticateUserSessionCommand.setUserName(userName);                authenticateUserSessionCommand.setUserPassword(password);                authenticateUserSessionCommand.execute();                    }                   SetUnicodeNormalizationCommand unicodeNormalizationCommand=new SetUnicodeNormalizationCommand(simpleConnection);            unicodeNormalizationCommand.setSession(userSession);            unicodeNormalizationCommand.setNormalizationType(SetUnicodeNormalizationCommand.NORMALIZATION_COMPOSED);            unicodeNormalizationCommand.execute();            }catch (CommandException e2) {
//                         }       }           public void setRegionProperties( )       {         //@@begin setRegionProperties()         dataRegion.setRegionCode("engUSA");         // Set the locale on data region         dataRegion.setLocale(new Locale("en", "US"));         // Set the name of data region         dataRegion.setName("US");         //@@end       }     public void setRepositoryInfo( java.lang.String repositoryName, java.lang.String userID, java.lang.String password )      {        //@@begin setRepositoryInfo()        this.repositoryName=repositoryName;        this.userName=userID;        this.password=password;            //@@end      }           public void getAuthenticatedRepositorySession( )     {       //@@begin getAuthenticatedRepositorySession()           try{               CreateRepositorySessionCommand repositorySessionCommand=new CreateRepositorySessionCommand(simpleConnection);               repositorySessionCommand.setRepositoryIdentifier(repositoryID);               repositorySessionCommand.execute();               repositorySession=repositorySessionCommand.getRepositorySession();                       AuthenticateRepositorySessionCommand authenticatedRepositorySession=new AuthenticateRepositorySessionCommand(simpleConnection);               authenticatedRepositorySession.setSession(repositorySession);               authenticatedRepositorySession.setUserName(userName);               authenticatedRepositorySession.setUserPassword(password);               authenticatedRepositorySession.execute();                       GetRepositorySchemaCommand repositroySchemaCommand=new GetRepositorySchemaCommand(simpleConnection);               repositroySchemaCommand.setSession(repositorySession);               repositroySchemaCommand.execute();               schema=repositroySchemaCommand.getRepositorySchema();                           }catch(CommandException e){
//                        }catch(Exception e){
//                        }               //@@end     }         public com.sap.mdm.ids.FieldId getFieldID( java.lang.String tableName, java.lang.String fieldCode )       {         //@@begin getFieldID()             return schema.getField(tableName,fieldCode).getId();             //@@end       }           public com.sap.mdm.ids.TableId getTableID( java.lang.String tableName )       {         //@@begin getTableID()         return schema.getTable(tableName).getId();         //@@end       }           public void searchRepository() {             //@@begin searchRepository()             ResultDefinition resultDef =                 new ResultDefinition(schema.getTable("Vendors").getId());             resultDef.addSelectField(schema.getField("Vendors", "Name").getId());             //resultDef.addSelectField(new FieldId(15));             FieldSearchDimension searchDimension =                 new FieldSearchDimension(                     schema.getField("Vendors", "Name").getId());             TextSearchConstraint constraint =                 new TextSearchConstraint("ABC", TextSearchConstraint.CONTAINS);             Search search = new Search(schema.getTable("Vendors").getId());             //search.addSearchItem(searchDimension,constraint);             RetrieveLimitedRecordsCommand limitedRecordsCommand =                 new RetrieveLimitedRecordsCommand(simpleConnection);             limitedRecordsCommand.setSearch(search);             limitedRecordsCommand.setSession(userSession);             limitedRecordsCommand.setResultDefinition(resultDef);             try {                 limitedRecordsCommand.execute();             } catch (CommandException e) {                 //                          }             //return limitedRecordsCommand.getRecords();             RecordResultSet recordSet = limitedRecordsCommand.getRecords();             String recordAsString = null;             String fieldValue = null;             for (int i = 0; i < recordSet.getCount(); i++) {                 recordAsString = "";                 FieldId[] returnedFields = recordSet.getRecord(i).getFields();                 for (int j = 0; j < returnedFields.length; j++) {                     if (recordSet                         .getRecord(i)                         .getFieldValue(returnedFields[j])                         .isNull()) {                         fieldValue = " |";                     } else {                         fieldValue =                             recordSet.getRecord(i).getFieldValue(returnedFields[j])                                 + "|";                     }                                         recordAsString += fieldValue;                     System.out.println(recordAsString);                 }             }         }                 public static void main (String[] args)                 {             Connection test=new Connection();             test.getConnection();             test.setRegionProperties();             test.setRepositoryInfo("Vendor1","Admin","mdm");             test.getAuthenticatedUserSession();             test.getAuthenticatedRepositorySession();             test.searchRepository();             test.closeconnection();              }

}

Code to Get List of Validation in a Table

Following code snippet finds out the list of Validation from a Table.

package com.sap.infosys.mdm.validationcheck;

import com.sap.mdm.commands.AuthenticateUserSessionCommand;
import com.sap.mdm.commands.CommandException;
import com.sap.mdm.commands.CreateUserSessionCommand;
import com.sap.mdm.commands.DestroySessionCommand;
import com.sap.mdm.commands.GetRepositoryRegionListCommand;
import com.sap.mdm.data.RegionProperties;
import com.sap.mdm.ids.TableId;
import com.sap.mdm.net.ConnectionException;
import com.sap.mdm.net.ConnectionPool;
import com.sap.mdm.net.ConnectionPoolFactory;
import com.sap.mdm.server.DBMSType;
import com.sap.mdm.server.RepositoryIdentifier;
import com.sap.mdm.validation.ValidationProperties;
import com.sap.mdm.validation.ValidationPropertiesResult;
import com.sap.mdm.validation.commands.RetrieveValidationsCommand;


public class GetListOfValidations {     public static void main(String[] args) {         // create connection pool to a MDM server         String serverName = " ";         ConnectionPool connections = null;         try {             connections = ConnectionPoolFactory.getInstance(serverName);         } catch (ConnectionException e) {             e.printStackTrace();             return;         }         // specify the repository to use         // alternatively, a repository identifier can be obtain from the GetMountedRepositoryListCommand         String repositoryName = "Vendor1";         String dbmsName = " ";         RepositoryIdentifier reposId =             new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.MS_SQL);         // get list of available regions for the repository         GetRepositoryRegionListCommand regionListCommand =             new GetRepositoryRegionListCommand(connections);         regionListCommand.setRepositoryIdentifier(reposId);         try {             regionListCommand.execute();         } catch (CommandException e) {             e.printStackTrace();             return;         }         RegionProperties[] regions = regionListCommand.getRegions();         // create a user session         CreateUserSessionCommand sessionCommand =             new CreateUserSessionCommand(connections);         sessionCommand.setRepositoryIdentifier(reposId);         sessionCommand.setDataRegion(regions[0]); // use the first region         try {             sessionCommand.execute();         } catch (CommandException e) {             e.printStackTrace();             return;         }         String sessionId = sessionCommand.getUserSession();         // authenticate the user session         String userName = "Admin";         String userPassword = "mdm";         AuthenticateUserSessionCommand authCommand =             new AuthenticateUserSessionCommand(connections);         authCommand.setSession(sessionId);         authCommand.setUserName(userName);         authCommand.setUserPassword(userPassword);         try {             authCommand.execute();         } catch (CommandException e) {             e.printStackTrace();             return;         }         // the main table, hard-coded         TableId mainTableId = new TableId(1);         // Get the list of validations         RetrieveValidationsCommand objRtvVldCmd =             new RetrieveValidationsCommand(connections);         // set the user session         objRtvVldCmd.setSession(sessionId);         // get validation for the following tables.         objRtvVldCmd.setTableId(mainTableId);                 try {             objRtvVldCmd.execute();         } catch (CommandException e) {             e.printStackTrace();             return;         }         ValidationPropertiesResult objVldPropRslt =             objRtvVldCmd.getValidationPropertiesResult();         ValidationProperties[] validations = objVldPropRslt.getValidations();         //disply --> Validation ID | error/warning message | Validation Name         for (int i = 0; i < validations.length; i++) {             System.out.println(                 validations[i].getId()                     + " | "                     + validations[i].getMessage()                     + " | "                     + validations[i].getName());         }     }

}

A Class worth exploring for handling special characters in MDM

While development was going at full pace ,a small hurdle in form of special characters turned out to be a real speed breaker.The situtaion was that in MDM repository some field say Name contained  special chracters(Õ , û  ,Û)  in  other language like Hungarian,German ,French etc.Problem was I  logged into the Repository with english language with MDM JAVA API and  API was retrieving undesired value(O??,u??,U??) from the data manager .Although the Name string seems absolutely fine in the Data Manager.In short -value in MDM Data Manager for field name was Õ û  Û and output from API was O??u??U??

To my rescue came this class which is worth exploring when you have a situation like above

Class SetUnicodeNormalizationCommand

After you establish your connection to the server through API and Authenticate User Session ,you need to work with this class.

Connection to server would return an object of type ConnectionPool (call it connection)and UserSession authentication would return a string (call it session).Now write this piece of code

SetUnicodeNormalizationCommand cmd = new SetUnicodeNormalizationCommand(connection);

cmd.setSession(session);

cmd.setNormalizationType(SetUnicodeNormalizationCommand.NORMALIZATION_COMPOSED);

cmd.execute();

This class will keep the special characters retrieval intact.

SRM-MDM Catalog version compatibility

Purpose

The main objective of this page is to explain the compatibility between SRM-MDM Catalog, Java API and MDM Server.

Overview

The application SRM-MDM Catalog is dependent on other two main applications or components, which are MDM Server and MDM Java API. The compatibility of these applications is informed in the SRM-MDM Release Notes available in SAP Service Marketplace (Software Download Center):

https://service.sap.com/swdc

This document will present how to check the versions of each of these applications and it will also explain how to correct the compatibility in case there is a version mismatch.

Identifying the versions of your applications

You can get this information by accessing the J2EE component info page (http://<J2EE_SERVER>:<PORT>/sap/monitoring/ComponentInfo).

The Component name of SRM-MDM is SRM_MDM_CAT and the Component name of MDM Java API is MDM_JAVA_API.

In order to get the information of your MDM Server, please follow the steps below:

1) Open the SRM MDM utilities:

http://<J2EE_SERVER>:<PORT>/webdynpro/dispatcher/sap.com/tc~mdm~srmcat~uiutil/Utilities

2) Choose "Connection Test"

3) Provide the host name or IP of your MDM server (MDM server)

4) Click on "Start Testing" button

Checking the compatibility of your applications

Find the latest release note according to your SRM-MDM Support Package (SP) and open this note.

You will find in the note the SRM-MDM Catalog SP and Patch as well as the MDM Server SP. The version of MDM Java API should be the same as MDM Server since they are distributed together, as part of the same release.

See the image below for more information:

If the version of these three components is not compatible then it is probable that you will face issues during the usage of SRM-MDM Catalog.

Example of compatible versions:

SAP Note 1505367 mention SRM-MDM Catalog 3.0 SP08 Patch 01 is compatible with MDM Server 7.1 SP05.

Your component versions:

SRM_MDM_CAT:3.0 SP8 (1000.3.0.8.123.123456789)

MDM_JAVA_API: 710 SP5 (1000.710.0.5.123.123456789)

MDM Server: MDM Server 7.1 SP5 (Check)

Example of incompatible versions:

SAP Note 1642907 mention SRM-MDM Catalog 3.0 SP11 Patch 01 is compatible with MDM Server 7.1 SP07.

Your component versions:

SRM_MDM_CAT:3.0 SP11 (1000.3.0.8.123.123456789)

MDM_JAVA_API: 710 SP4 (1000.710.0.4.123.123456789)

MDM Server: MDM Server 7.1 SP4 (Check)

Solving the incompatibility of your applications

In case you have a version mismatch you should update your applications according to the latest release note for SRM-MDM. In case you don’t want to update your MDM Server than use the latest release note according to your SRM-MDM SP. Note that some errors are corrected in higher releases so it is not guaranteed that your issue will be solved by updating to the latest release of your SP. 

In order to update your application components go to Software Download Center, click on "Support Packages and Patches" (top menu) and then click on "Search for Support Packages and Patches" (left menu). Search for "SAP MDM CATALOG" and click on oyr SRM-MDM version. For more information please check note 1476694.

Related Content

Related Documents

Related Notes

SAP Note: 1650896 - SRM-MDM “Login Failed” error

SAP Note: 1476694 - Change in SRM-MDM Catalog 3.0 components in SMP

SAP Note: 1663002 - SRM-MDM Catalog "Repository Locked"

Code to Get List of Validation in a Table

Following code snippet finds out the list of Validation from a Table.

package com.sap.infosys.mdm.validationcheck;

import com.sap.mdm.commands.AuthenticateUserSessionCommand;
import com.sap.mdm.commands.CommandException;
import com.sap.mdm.commands.CreateUserSessionCommand;
import com.sap.mdm.commands.DestroySessionCommand;
import com.sap.mdm.commands.GetRepositoryRegionListCommand;
import com.sap.mdm.data.RegionProperties;
import com.sap.mdm.ids.TableId;
import com.sap.mdm.net.ConnectionException;
import com.sap.mdm.net.ConnectionPool;
import com.sap.mdm.net.ConnectionPoolFactory;
import com.sap.mdm.server.DBMSType;
import com.sap.mdm.server.RepositoryIdentifier;
import com.sap.mdm.validation.ValidationProperties;
import com.sap.mdm.validation.ValidationPropertiesResult;
import com.sap.mdm.validation.commands.RetrieveValidationsCommand;


public class GetListOfValidations {     public static void main(String[] args) {         // create connection pool to a MDM server         String serverName = " ";         ConnectionPool connections = null;         try {             connections = ConnectionPoolFactory.getInstance(serverName);         } catch (ConnectionException e) {             e.printStackTrace();             return;         }         // specify the repository to use         // alternatively, a repository identifier can be obtain from the GetMountedRepositoryListCommand         String repositoryName = "Vendor1";         String dbmsName = " ";         RepositoryIdentifier reposId =             new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.MS_SQL);         // get list of available regions for the repository         GetRepositoryRegionListCommand regionListCommand =             new GetRepositoryRegionListCommand(connections);         regionListCommand.setRepositoryIdentifier(reposId);         try {             regionListCommand.execute();         } catch (CommandException e) {             e.printStackTrace();             return;         }         RegionProperties[] regions = regionListCommand.getRegions();         // create a user session         CreateUserSessionCommand sessionCommand =             new CreateUserSessionCommand(connections);         sessionCommand.setRepositoryIdentifier(reposId);         sessionCommand.setDataRegion(regions[0]); // use the first region         try {             sessionCommand.execute();         } catch (CommandException e) {             e.printStackTrace();             return;         }         String sessionId = sessionCommand.getUserSession();         // authenticate the user session         String userName = "Admin";         String userPassword = "mdm";         AuthenticateUserSessionCommand authCommand =             new AuthenticateUserSessionCommand(connections);         authCommand.setSession(sessionId);         authCommand.setUserName(userName);         authCommand.setUserPassword(userPassword);         try {             authCommand.execute();         } catch (CommandException e) {             e.printStackTrace();             return;         }         // the main table, hard-coded         TableId mainTableId = new TableId(1);         // Get the list of validations         RetrieveValidationsCommand objRtvVldCmd =             new RetrieveValidationsCommand(connections);         // set the user session         objRtvVldCmd.setSession(sessionId);         // get validation for the following tables.         objRtvVldCmd.setTableId(mainTableId);                 try {             objRtvVldCmd.execute();         } catch (CommandException e) {             e.printStackTrace();             return;         }         ValidationPropertiesResult objVldPropRslt =             objRtvVldCmd.getValidationPropertiesResult();         ValidationProperties[] validations = objVldPropRslt.getValidations();         //disply --> Validation ID | error/warning message | Validation Name         for (int i = 0; i < validations.length; i++) {             System.out.println(                 validations[i].getId()                     + " | "                     + validations[i].getMessage()                     + " | "                     + validations[i].getName());         }     }

CreateRecordCommand Vs CreateRecordsCommand

Given the shortcomings of Import Manager of rejecting a complete input excel spreadsheet, in case of even a single spurious record and lack of comprehensive error reporting to track reasons for file rejection or all errors. All these and more combined together, gave me a reason to develop a prototype, which overcomes shortcomings of using Import Manager to import data into MDM repository using Excel spreadsheets

In this blog I will discuss two important API classes, CreateRecordCommand and CreateRecordsCommand , and in following blogs will detail the complete design using which you can have your own customised Import Manager, capable of Importing data from excel spreadsheet into MDM repository with comprehensive error reporting.

Browsing through the MDM Java API documentation I found two classes for creating records in the repository:

  • CreateRecordCommand &
  • CreateRecordsCommand

While the first command is used to create individual records in the repository, the following CreateRecordsCommand is used for mass record creation.

It is a single Record Object which is a required parameter for CreateRecordCommand, we need to set an array of Record objects (records for mass creation) for CreateRecordsCommand.

Using CreateRecordCommand you can get 'recordId' of the newly created record but using CreateRecordsCommand the API provides us various methods to retrieve

  • FailedRecordMessages
  • Succeeded Record recordIds
  • Failed and Succeeded Record Arrays, containing corresponding indexes in the records array initially passed into CreateRecordsCommand
  • Array of all records passed into CreateRecordsCommand

Please use the link of MDM Java API javadoc link http://help.sap.com/javadocs/MDM/SP06P2/index.html to find out specific methods for CreateRecordsCommand, which can be used to retrieve specific information in order to generate better reports with exception/error messages.

Signing off for now....... till my next page in this series.

Search In a MDM Repository

Following code snippet shows the step to search inside MDM repository. It searches the string inside field Vendors in the table Vendors under repository Vendor1 .

public class Connection {     private SimpleConnection simpleConnection;     private String serverName = " ";     private String repositoryName="Vendor1";     private String dbServerName = " ";     private DBMSType dbmsType = DBMSType.MS_SQL;     private RegionProperties dataRegion = new RegionProperties();     private String userSession;     private String repositorySession;     private String userName="Admin";     private String password="mdm";     private RepositorySchema schema;     private RepositoryIdentifier repositoryID;     public void getConnection() {         try {             if (simpleConnection == null) {                 simpleConnection =                     SimpleConnectionFactory.getInstance(serverName);             }         } catch (Exception e) {             //              }     }         public void closeConnection( )       {         //@@begin closeConnection()         try{             if(simpleConnection!=null){                 DestroySessionCommand destroySessionCommand=new DestroySessionCommand(simpleConnection);                 destroySessionCommand.setSession(userSession);                 destroySessionCommand.execute();                 userSession=null;                 simpleConnection.close();             }         }catch(Exception e){
//                    }         //@@end       }           public void getAuthenticatedUserSession( )       {         //@@begin getAuthenticatedUserSession()         /*             * Create and authenticate a new user session to an MDM repository             */            repositoryID=new RepositoryIdentifier(repositoryName,dbServerName,dbmsType);            CreateUserSessionCommand createUserSessionCommand=new CreateUserSessionCommand(simpleConnection);            createUserSessionCommand.setRepositoryIdentifier(repositoryID);            createUserSessionCommand.setDataRegion(dataRegion);            try {                createUserSessionCommand.execute();                    userSession=createUserSessionCommand.getUserSession();// Get the session identifier               /* Authenticate User Session */            TrustedUserSessionCommand trustedUserSessionCommand=new TrustedUserSessionCommand(simpleConnection);            trustedUserSessionCommand.setUserName(userName);                      trustedUserSessionCommand.setSession(userSession);            try {                trustedUserSessionCommand.execute();                userSession=trustedUserSessionCommand.getSession();            } catch (CommandException e1) {                /* Trusted Connection is not accepted */                AuthenticateUserSessionCommand authenticateUserSessionCommand=new AuthenticateUserSessionCommand(simpleConnection);                authenticateUserSessionCommand.setSession(userSession);                authenticateUserSessionCommand.setUserName(userName);                authenticateUserSessionCommand.setUserPassword(password);                authenticateUserSessionCommand.execute();                    }                   SetUnicodeNormalizationCommand unicodeNormalizationCommand=new SetUnicodeNormalizationCommand(simpleConnection);            unicodeNormalizationCommand.setSession(userSession);            unicodeNormalizationCommand.setNormalizationType(SetUnicodeNormalizationCommand.NORMALIZATION_COMPOSED);            unicodeNormalizationCommand.execute();            }catch (CommandException e2) {
//                         }       }           public void setRegionProperties( )       {         //@@begin setRegionProperties()         dataRegion.setRegionCode("engUSA");         // Set the locale on data region         dataRegion.setLocale(new Locale("en", "US"));         // Set the name of data region         dataRegion.setName("US");         //@@end       }     public void setRepositoryInfo( java.lang.String repositoryName, java.lang.String userID, java.lang.String password )      {        //@@begin setRepositoryInfo()        this.repositoryName=repositoryName;        this.userName=userID;        this.password=password;            //@@end      }           public void getAuthenticatedRepositorySession( )     {       //@@begin getAuthenticatedRepositorySession()           try{               CreateRepositorySessionCommand repositorySessionCommand=new CreateRepositorySessionCommand(simpleConnection);               repositorySessionCommand.setRepositoryIdentifier(repositoryID);               repositorySessionCommand.execute();               repositorySession=repositorySessionCommand.getRepositorySession();                       AuthenticateRepositorySessionCommand authenticatedRepositorySession=new AuthenticateRepositorySessionCommand(simpleConnection);               authenticatedRepositorySession.setSession(repositorySession);               authenticatedRepositorySession.setUserName(userName);               authenticatedRepositorySession.setUserPassword(password);               authenticatedRepositorySession.execute();                       GetRepositorySchemaCommand repositroySchemaCommand=new GetRepositorySchemaCommand(simpleConnection);               repositroySchemaCommand.setSession(repositorySession);               repositroySchemaCommand.execute();               schema=repositroySchemaCommand.getRepositorySchema();                           }catch(CommandException e){
//                        }catch(Exception e){
//                        }               //@@end     }         public com.sap.mdm.ids.FieldId getFieldID( java.lang.String tableName, java.lang.String fieldCode )       {         //@@begin getFieldID()             return schema.getField(tableName,fieldCode).getId();             //@@end       }           public com.sap.mdm.ids.TableId getTableID( java.lang.String tableName )       {         //@@begin getTableID()         return schema.getTable(tableName).getId();         //@@end       }           public void searchRepository() {             //@@begin searchRepository()             ResultDefinition resultDef =                 new ResultDefinition(schema.getTable("Vendors").getId());             resultDef.addSelectField(schema.getField("Vendors", "Name").getId());             //resultDef.addSelectField(new FieldId(15));             FieldSearchDimension searchDimension =                 new FieldSearchDimension(                     schema.getField("Vendors", "Name").getId());             TextSearchConstraint constraint =                 new TextSearchConstraint("ABC", TextSearchConstraint.CONTAINS);             Search search = new Search(schema.getTable("Vendors").getId());             //search.addSearchItem(searchDimension,constraint);             RetrieveLimitedRecordsCommand limitedRecordsCommand =                 new RetrieveLimitedRecordsCommand(simpleConnection);             limitedRecordsCommand.setSearch(search);             limitedRecordsCommand.setSession(userSession);             limitedRecordsCommand.setResultDefinition(resultDef);             try {                 limitedRecordsCommand.execute();             } catch (CommandException e) {                 //                          }             //return limitedRecordsCommand.getRecords();             RecordResultSet recordSet = limitedRecordsCommand.getRecords();             String recordAsString = null;             String fieldValue = null;             for (int i = 0; i < recordSet.getCount(); i++) {                 recordAsString = "";                 FieldId[] returnedFields = recordSet.getRecord(i).getFields();                 for (int j = 0; j < returnedFields.length; j++) {                     if (recordSet                         .getRecord(i)                         .getFieldValue(returnedFields[j])                         .isNull()) {                         fieldValue = " |";                     } else {                         fieldValue =                             recordSet.getRecord(i).getFieldValue(returnedFields[j])                                 + "|";                     }                                         recordAsString += fieldValue;                     System.out.println(recordAsString);                 }             }         }                 public static void main (String[] args)                 {             Connection test=new Connection();             test.getConnection();             test.setRegionProperties();             test.setRepositoryInfo("Vendor1","Admin","mdm");             test.getAuthenticatedUserSession();             test.getAuthenticatedRepositorySession();             test.searchRepository();             test.closeconnection();              }

}

A Class worth exploring for handling special characters in MDM

While development was going at full pace ,a small hurdle in form of special characters turned out to be a real speed breaker.The situtaion was that in MDM repository some field say Name contained  special chracters(Õ , û  ,Û)  in  other language like Hungarian,German ,French etc.Problem was I  logged into the Repository with english language with MDM JAVA API and  API was retrieving undesired value(O??,u??,U??) from the data manager .Although the Name string seems absolutely fine in the Data Manager.In short -value in MDM Data Manager for field name was Õ û  Û and output from API was O??u??U??

To my rescue came this class which is worth exploring when you have a situation like above

Class SetUnicodeNormalizationCommand

After you establish your connection to the server through API and Authenticate User Session ,you need to work with this class.

Connection to server would return an object of type ConnectionPool (call it connection)and UserSession authentication would return a string (call it session).Now write this piece of code

SetUnicodeNormalizationCommand cmd = new SetUnicodeNormalizationCommand(connection);

cmd.setSession(session);

cmd.setNormalizationType(SetUnicodeNormalizationCommand.NORMALIZATION_COMPOSED);

cmd.execute();

This class will keep the special characters retrieval intact.

How do you implement a MDM Connection Help Class?

  • In the exmaple Master Data Data Read class we used another class, ZCL_MDM_CONN_POOL_ROOT, to establish the connection to MDM.  This is just a reusable utility class that caches the API connection and contains logic to map the SAP logon langauge to the MDM Language.
  • The complete source code of this class can be downloaded here.
  • Class Properties:
  • Class Private Types:
  • Class Attributes:
  • Class Methods:
  • GET_MDM_CONNECTION
    METHOD get_mdm_connection.
    *@78\QImporting@ LANGUAGE TYPE SYLANGU DEFAULT SY-LANGU
    *@78\QImporting@ UNAME TYPE SYUNAME DEFAULT SY-UNAME
    *@78\QImporting@ REPOSITORY TYPE MDM_LOG_OBJECT_NAME
    *@78\QImporting@ USE_CONNECTION_POOL TYPE BOOLEAN DEFAULT ABAP_TRUE
    *@7B\QReturning@ VALUE( API ) TYPE REF TO CL_MDM_GENERIC_API
    *@03\QException@ CX_MDM_MAIN_EXCEPTION

    IF use_connection_pool = abap_true.
    DATA wa_api LIKE LINE OF api_cache.
    READ TABLE api_cache INTO wa_api
    WITH KEY language = language
    uname = uname
    repository = repository.
    IF sy-subrc = 0.
    ****Cached Connection Record is found, make sure the API reference is bound
    IF wa_api-api IS BOUND.
    api = wa_api-api.
    GET TIME STAMP FIELD wa_api-last_access.
    MODIFY TABLE api_cache FROM wa_api.
    ELSE.
    ****Not bound - Delete the Connection Record and Create a New Instance
    DELETE api_cache WHERE language = language
    AND uname = uname
    AND repository = repository.
    api = zcl_mdm_conn_pool_root=>create_mdm_connection(
    language = language
    uname = uname
    repository = repository
    use_connection_pool = use_connection_pool ).
    ENDIF.
    ELSE.
    ****No Cached Record - Create a New Instance
    api = zcl_mdm_conn_pool_root=>create_mdm_connection(
    language = language
    uname = uname
    repository = repository
    use_connection_pool = use_connection_pool ).
    ENDIF.
    ELSE.
    ****By Pass the Connection Pool and create a one-off Instance
    api = zcl_mdm_conn_pool_root=>create_mdm_connection(
    language = language
    uname = uname
    repository = repository
    use_connection_pool = use_connection_pool ).
    ENDIF.

    ENDMETHOD.



  • CREATE_MDM_CONNECTION
    METHOD create_mdm_connection.
    *@78\QImporting@ LANGUAGE TYPE SYLANGU DEFAULT SY-LANGU
    *@78\QImporting@ UNAME TYPE SYUNAME DEFAULT SY-UNAME
    *@78\QImporting@ REPOSITORY TYPE MDM_LOG_OBJECT_NAME
    *@78\QImporting@ USE_CONNECTION_POOL TYPE BOOLEAN DEFAULT ABAP_TRUE
    *@7B\QReturning@ VALUE( API ) TYPE REF TO CL_MDM_GENERIC_API
    *@03\QException@ CX_MDM_MAIN_EXCEPTION

    DATA mdm_language TYPE mdm_cdt_language_code.
    mdm_language = zcl_mdm_conn_pool_root=>expand_mdm_language( language ).

    **** Instantiate the API with our repository key from the dialog
    CREATE OBJECT api
    EXPORTING
    iv_log_object_name = repository.
    ****Connect to the Repository
    api->mo_accessor->connect( mdm_language ).

    IF use_connection_pool = abap_true.
    DATA wa_api LIKE LINE OF api_cache.
    wa_api-api = api.
    wa_api-language = language.
    wa_api-uname = uname.
    wa_api-repository = repository.
    GET TIME STAMP FIELD wa_api-last_access.
    INSERT wa_api INTO TABLE api_cache.
    ENDIF.

    ENDMETHOD.



  • EXPAND_MDM_LANGUAGE
    METHOD expand_mdm_language.
    *@78\QImporting@ LANGUAGE TYPE SYLANGU DEFAULT SY-LANGU Language Key of Current Text Environment
    *@7B\QReturning@ VALUE( MDM_LANGUAGE ) TYPE MDM_CDT_LANGUAGE_CODE MDM: CDT language code

    CASE language.
    WHEN c_english.
    mdm_language-language = 'eng'.
    mdm_language-country = 'US'.
    mdm_language-region = 'USA'.
    when c_german.
    mdm_language-language = 'ger'.
    mdm_language-country = 'DE'.
    * mdm_language-region = 'USA'.
    WHEN OTHERS.
    ****Use the repository Default
    CLEAR mdm_language.
    ENDCASE.

    ENDMETHOD.


How do you implement the processing for Master Data Read Class Parameters?

  • In the example Master Data Read Class that we have been looking at, the processing is generic.  In other words there is no statement in the application coding that specifies the MDM Repository, Table or Field name.  The values are supplied via parameters so that this same class can be used for more than one Master Data Characteristic.
  • You can see the area where you can supply these parameters in the following screen shot. It is the field labeled Master Data Read Class Parameters:
  • Although this is a single field, it can hold more than one value.  This is done by associating a data dictionary structure with the parameter inside the coding o the Master Data Read Class.  For the purposes of MDM Integration, you probably want a structure something like the one used this example implementation:
  • This way when you click on the pencil icon next the parameter field, a dialog pops up with the individual field selections as defined by your structure.  This even supports value input help for the individual fields.
  • So, how can this functionality be built into the Master Data Read Class?  It requires the implementation of another interface in your class - IF_RSMD_RS_GENERIC.  The sample Master Data Read Class, which can be downloaded here, contains an implementation of this interface for the purposes of processing the MDM Repository, Table and Field as parameters.
  • In the Method GET_STRUCTURE_NAME, you must specify the name of the data dictionary sturcture you are going to use:
    method if_rsmd_rs_generic~get_structure_name.
    e_struct_name = 'ZRSMD_RS_S_MDM'.
    endmethod.



  • But the most important processing are the GET and SET Methods. This is where you must supply the logic to map the data from the single parameter string into the individual fiels of your structure and vise versa:
    method if_rsmd_rs_generic~get_parameter.
    field-symbols: <l_s_struc> type zrsmd_rs_s_mdm.
    assign e_r_struc->* to <l_s_struc>.
    <l_s_struc> = o_s_gendomain.
    endmethod.

    method if_rsmd_rs_generic~set_parameter.
    field-symbols: <l_s_struc> type zrsmd_rs_s_mdm.
    assign i_r_struc->* to <l_s_struc>.
    o_s_gendomain = <l_s_struc>.
    endmethod.

    method if_rsmd_rs_generic~get_parameterstring.
    data: l_parameterstring type rsmdrclpa.

    *===Create the paramater string from the generic table structure===
    l_parameterstring+0(32) = o_s_gendomain-object_name.
    l_parameterstring+32(34) = o_s_gendomain-table .
    l_parameterstring+66(34) = o_s_gendomain-query_field.

    *===Export the parameter string====
    e_parameterstring = l_parameterstring.
    endmethod.

    method if_rsmd_rs_generic~set_parameterstring.
    data: l_parameterstring type rsmdrclpa.

    l_parameterstring = i_parameterstring.
    *===Create the structure from the parameterstring===
    o_s_gendomain-object_name = l_parameterstring+0(32).
    o_s_gendomain-table = l_parameterstring+32(34).
    o_s_gendomain-query_field = l_parameterstring+66(34).
    endmethod.


How do you implement the Master Data Read Class?

  • Master Data Read Classes have one basic requirement - They must implement the IF_RSMD_RS_ACCESS interface.
  • There are several examples of how implement a Master Data Read Class provided by SAP - like CL_RSMD_RS_GENERIC_DOMAIN and CL_RSMD_RS_GENERIC_TABLE.  For creating your own custom Master Data Read Class, it probably makes sense to start by copying from one these existing classes and only adjusting for your specific processing.
  • The complete source code (in SAPlink format) for an example implementation of a Master Data Read Class that uses MDM and the MDM ABAP APIs can be downloaded from here.
  • Of all the methods in the sample class the most important from the standpoint of the MDM integration is the GET_TEXT method. The example implementation supports the retrieval of STRING or INTEGER based supporting values for a given key from MDM:
METHOD if_rsmd_rs_access~get_text.

DATA: object_name TYPE mdm_log_object_name,
table TYPE mdm_table_code,
query_field TYPE mdm_field_code,
l_s_chavlinfo TYPE rsdm_s_chavlinfo,
l_not_assigned TYPE rs_txtlg,
l_initial_val TYPE rsd_chavl.

object_name = o_s_gendomain-object_name.
table = o_s_gendomain-table.
query_field = o_s_gendomain-query_field.


DATA lt_result_set_definition TYPE mdm_field_list_table.
DATA ls_result_set_definition LIKE LINE OF lt_result_set_definition.
DATA lt_result_set TYPE mdm_result_set_table.
DATA ls_result_set LIKE LINE OF lt_result_set.
DATA lt_result_set2 TYPE mdm_result_set_table.
DATA ls_result_set2 LIKE LINE OF lt_result_set2.
DATA ls_remote_key_filter TYPE mdm_client_system_key_query.
DATA api TYPE REF TO cl_mdm_generic_api.
DATA language TYPE mdm_cdt_language_code.
DATA keys TYPE mdm_keys.
DATA exception TYPE REF TO cx_mdm_main_exception.
FIELD-SYMBOLS <field_value> TYPE ANY.
FIELD-SYMBOLS: <wa_field> TYPE mdm_cdt_text,
<wa_string> TYPE string,
<wa_integer> TYPE mdm_gdt_integervalue,
<wa_taxonomy> TYPE mdm_taxonomy_entry,
<wa_int> TYPE mdm_gdt_integervalue.
TYPE-POOLS: mdmif.

TRY.

DATA wa_cache LIKE LINE OF me->data_cache.
READ TABLE data_cache INTO wa_cache
WITH KEY object_name = object_name
table = table
query_field = query_field.
IF sy-subrc = 0.
keys = wa_cache-keys.
lt_result_set = wa_cache-lt_result_set.
ELSE.

api = zcl_mdm_conn_pool_root=>get_mdm_connection( repository = object_name ).

DATA: result_set TYPE mdm_search_result_table.
CALL METHOD api->mo_core_service->query
EXPORTING
iv_object_type_code = table
* iv_hits_max = 1
IMPORTING
et_result_set = result_set.

****The results of a query only return the record keys - no details
****We then have to use a call to the method RETRIEVE to read
****the record details.
DATA: result TYPE mdm_search_result.
READ TABLE result_set INDEX 1 INTO result.
IF sy-subrc = 0.
keys = result-record_ids.
ENDIF.

CHECK keys IS NOT INITIAL.
****We only need the output field we are interested read from MDM
****By using the result_set_definition parameter, we can control this
****and only retrieve that single column
ls_result_set_definition-field_name = query_field.
APPEND ls_result_set_definition TO lt_result_set_definition.
CALL METHOD api->mo_core_service->retrieve
EXPORTING
iv_object_type_code = table
it_result_set_definition = lt_result_set_definition
it_keys = keys
IMPORTING
et_result_set = lt_result_set.

CLEAR wa_cache.
wa_cache-object_name = object_name.
wa_cache-table = table.
wa_cache-query_field = query_field.
wa_cache-keys = keys.
wa_cache-lt_result_set = lt_result_set.
APPEND wa_cache TO data_cache.
ENDIF.

*===Get the Initial Value Text===
CALL METHOD _textpool_read
EXPORTING
i_repid = 'SAPLRSDM'
i_key = '001'
IMPORTING
e_text = l_not_assigned.

FIELD-SYMBOLS: <wa_result> LIKE LINE OF lt_result_set.
FIELD-SYMBOLS: <wa_pair> TYPE mdm_name_value_pair,
<wa_key> LIKE LINE OF keys.

*===Append the text values in c_t_chavlinfo===
DATA: tabix TYPE sy-tabix.
DATA l_integer TYPE mdm_gdt_integervalue.
FIELD-SYMBOLS: <l_s_chavlinfo> TYPE rsdm_s_chavlinfo.
LOOP AT c_t_chavlinfo ASSIGNING <l_s_chavlinfo>
WHERE i_read_mode = rsdm_c_read_mode-text.
CLEAR <l_s_chavlinfo>-c_rc.
IF <l_s_chavlinfo>-c_chavl IS INITIAL
OR <l_s_chavlinfo>-c_chavl EQ rsd_c_initial
OR <l_s_chavlinfo>-c_chavl < 1.
<l_s_chavlinfo>-e_chatexts-txtsh = l_not_assigned.
<l_s_chavlinfo>-e_chatexts-txtmd = l_not_assigned.
<l_s_chavlinfo>-e_chatexts-txtlg = l_not_assigned.
ELSE.
l_integer = <l_s_chavlinfo>-c_chavl.
READ TABLE keys ASSIGNING <wa_key> FROM l_integer.
tabix = sy-tabix.
READ TABLE lt_result_set ASSIGNING <wa_result> INDEX tabix.
IF sy-subrc = 0.
READ TABLE <wa_result>-name_value_pairs ASSIGNING <wa_pair>
WITH KEY code = query_field.
IF sy-subrc = 0.
****The data for the column could be one of various data types
****The value itself is returned as TYPE REF TO DATA and must
****be cast into a more specific data type before it can be processed.
CASE <wa_pair>-type.
WHEN 'STRING'.
ASSIGN <wa_pair>-value->* TO <wa_string>.
WRITE <wa_key> TO l_s_chavlinfo-c_chavl LEFT-JUSTIFIED.
<l_s_chavlinfo>-e_chatexts-txtsh = <wa_string>.
<l_s_chavlinfo>-e_chatexts-txtmd = <wa_string>.
<l_s_chavlinfo>-e_chatexts-txtlg = <wa_string>.
WHEN 'INTEGER'.
ASSIGN <wa_pair>-value->* TO <wa_integer>.
WRITE <wa_key> TO l_s_chavlinfo-c_chavl LEFT-JUSTIFIED.
<l_s_chavlinfo>-e_chatexts-txtsh = <wa_integer>.
<l_s_chavlinfo>-e_chatexts-txtmd = <wa_integer>.
<l_s_chavlinfo>-e_chatexts-txtlg = <wa_integer>.
ENDCASE.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDTRY.
ENDMETHOD.

Connectivity - BI-MDM Integration

BI/MDM Frequently Asked Questions

General Questions
  • What types of BI/MDM Integration Scenarios are possible?
    There are two main types of BI/MDM Integration Scenarios that are currently being rolled out to customers. The first scenario starts with existing data in BI and uses that as the starting point to generate and populate an MDM Repostiory. The second type is integration during the BI data staging.
  • How does the Data Staging scenario work?
    There are actually two types of the data staging scenario. In each scenario, customers can use existing functionality with BI to access details from MDM to supplement the data that is being loaded into BI. An example might be a feed from an ERP system to a BI system. In this feed there might just be a master data key, like customer number. However using access to MDM, details about this customer, like their sales region, can be read and stored in the BI system or used at runtime inside BI queries.
  • What technology is necessary for the Data Staging Scenario?
    The data staging scenario utilizes the MDM ABAP API to be able to read directly from MDM (in realtime) using ABAP coding. A good overview of the MDM ABAP API in general is a requirement for starting this scenario. Also anyone interested in implementing this scenario should study this video. The video shows the basics of setting up the MDM ABAP API all the way through implementing one of the data staging scenarios.
  • How do you use the MDM API during a Data Load?
    For this situation you need to create an ABAP routine as the transformation rule type.

    During the editing of the Rule Type, you can choose Routine. You then can custom code an ABAP Routine that reads data from MDM using the MDM ABAP API.
  • How do you use the MDM API for building a Remote Master Data Characteristic?
    This scenario is a little less "free form" than the data loading routine. Here you use the existing BI functionality for master data characteristics and simply supply a custom implementation for the characteristic.
    As you maintain the characteristic, from the Master data/texts tab, you can choose a Master Data Read Class. For this you create and then use a class special suited to reading the master data values from MDM.

Connectivity - BI-MDM Integration

BI/MDM Frequently Asked Questions

General Questions
  • What types of BI/MDM Integration Scenarios are possible?
    There are two main types of BI/MDM Integration Scenarios that are currently being rolled out to customers. The first scenario starts with existing data in BI and uses that as the starting point to generate and populate an MDM Repostiory. The second type is integration during the BI data staging.
  • How does the Data Staging scenario work?
    There are actually two types of the data staging scenario. In each scenario, customers can use existing functionality with BI to access details from MDM to supplement the data that is being loaded into BI. An example might be a feed from an ERP system to a BI system. In this feed there might just be a master data key, like customer number. However using access to MDM, details about this customer, like their sales region, can be read and stored in the BI system or used at runtime inside BI queries.
  • What technology is necessary for the Data Staging Scenario?
    The data staging scenario utilizes the MDM ABAP API to be able to read directly from MDM (in realtime) using ABAP coding. A good overview of the MDM ABAP API in general is a requirement for starting this scenario. Also anyone interested in implementing this scenario should study this video. The video shows the basics of setting up the MDM ABAP API all the way through implementing one of the data staging scenarios.
  • How do you use the MDM API during a Data Load?
    For this situation you need to create an ABAP routine as the transformation rule type.

    During the editing of the Rule Type, you can choose Routine. You then can custom code an ABAP Routine that reads data from MDM using the MDM ABAP API.
  • How do you use the MDM API for building a Remote Master Data Characteristic?
    This scenario is a little less "free form" than the data loading routine. Here you use the existing BI functionality for master data characteristics and simply supply a custom implementation for the characteristic.
    As you maintain the characteristic, from the Master data/texts tab, you can choose a Master Data Read Class. For this you create and then use a class special suited to reading the master data values from MDM.

What is the MDM ABAP API?

What is the MDM ABAP API?

Historically most ERP based master data resides in existing ABAP Systems. Also the majority of the business logic in that is consuming the master data also resides in ABAP based systems.  Therefore it makes sense to extend the accessiblity of SAP NetWeaver MDM to allow for easy accessiblity from ABAP.

That is the goal of the MDM ABAP API (MDM4A).  MDM4A takes the same read, modify, search, and Administrative functionalities of the established COM and Java APIs (MDM4J) and brings them to the ABAP World.

By using MDM4A, ABAP developers do not have to learn the SAP NetWeaver MDM specific data types.  MDM4A does the job of mapping all the data types and structures for the developer. It translates the structures such as data arrays into ABAP constructs like Internal Tables.

MDM also takes a different approach to passing language specific data. It might be important to note that all the data is passed through MDM4A via Unicode (UTF-8) regardless of the settings in the AS-ABAP system (Unicode vs. Non-Unicode). The MDM4A layers also do all the work of translating this data into the code page of the current system. Even on Unicode systems, a translation from UTF-8 to UTF-16 must occur.

What is the Architecture of MDM4A?

What is the Architecture of MDM4A?

MDM4A is made up of three major parts:

  • Generic API
  • Provider Framework
  • C-Kernel

The Generic API is a release independent interface into the SAP NetWeaver MDM API.  It is the only layer that application developers should ever directly interact with.  It is comprised of publically available Function Modules and Classes.

The Provider Framework is the release specific implementation of the SAP NetWeaver MDM API.  As new releases or support packages of MDM are released, new matching version fo the provider framework will be created.

However the features of the provider framework are always abastracted by the Generic API, causing the least amount of changes to the consuming applications as possible.  This protects the application developer from changes within MDM breaking their applications. The Provider Framework is not intended for direct access by SAP's Customers or Partners.  The MDM 5.5 SP4 class for the provider framework is CL_MDM_PROVIDER_SP4_PL00.

The Generic API and the Provider Framework are both delivered as part of a SAINT Package (SAP Add-on installed into the system via transaction SAINT).

Finally there are new Kernel Libraries written in C that are an integrated part of the ABAP stack that provide the low level communication interface to MDM. The C-Kernel is an integrated part of the AS-ABAP Kernel. The file dw_mdm.dll is part of the core disp+work package of the Kernel and is installed into /usr/sap/<SID>/DVEBMGS<Instance Number>/exe just like the rest of the Kernel

What Codepage is used by MDM4A?

What Codepage is used by MDM4A?

MDM4A is always a Unicode based interface regardless of the codepage used by the ABAP system.  Althought a Unicode ABAP system is UTF-16, the MDM4A interface is UTF-8.  Therefore regardless of the ABAP system codepage, a codepage conversion must take place. The codepage conversion is done within the inner layers of the MDM4A.  However on non-Unicode ABAP systems if you attempt to process characters from MDM that are outside your current codepage, this will produce a CX_SY_CONVERSION_CODEPAGE shortdump.

In non-Unicode ABAP systems, the best way to avoid such errors is to match the logon langauge of the ABAP system to the langauge used to connect to MDM.

DATA ls_language TYPE mdm_cdt_language_code.
ls_language-language = 'eng'.
ls_language-country = 'US'.
ls_language-region = 'USA'.
lr_api->mo_accessor->connect( ls_language ).

What causes the CRC Check Error?

What does it mean when I receive the following error message:

  Server return code 0x8002000E: File failed a crc check

This probably means that there is a mismatch between the release/patch level of the MDM Server and the ABAP API Add-In or Java API add-in (e.g MDMJAVAAPI04_0.sca).

Although a single ABAP system with the MDM API Add-In could potentially interface with multiple MDM Servers on different release levels, the ABAP MDM API Add-In release level/patch level must always match at least that of the most release level of any MDM Server it connects to. In other words, the ABAP side the MDM APIs (provided via an ABAP Add-In) is backwards compatible, but not forwards compatible.

Lets say for instance that you are running the MDM Server at 5.5 SP4 Patch 0. This would show up as something like 5.5.32.56 in the release level dialog on the MDM Server Console. Your ABAP system should have installed at least the same patch level. If you update your MDM Server to 5.5 SP4 Patch 1 (version 5.5.33.13), then patch one of the MDM ABAP API Add-on must be applied as well. Patches for the MDM ABAP API Add-on can be downloaded from the Service Marketplace.

You also need to make sure that your have configured the correct MDM Provider for your particular repository in the MDM Configuration with the ABAP System (Transaction MDMAPIC).

How do you use the Function Module-Based version of MDM4A?

How do you use the Function Module-Based version of MDM4A?

There are function groups that map directly to the main Interfaces of the provider class. The processing logic is the same (the class-based interface is called from within the Function Modules). Several of the Key Function Modules are "Remote Enabled". Because they are remote enabled, they can also very quickly be generated into Web Services.

Function Group/Class Interface Mapping
FG_MDM_ACCESSOR = IF_MDM_ACCESSOR
FG_MDM_ADMIN_API = IF_MDM_ADMIN
FG_MDM_CONFIG_MONITOR = IF_MDM_API_CONFIG
FG_MDM_CORE_SERVICE_API = IF_MDM_CORE_SERVICES
FG_MDM_META_API = IF_MDM_META

How do you use the Class-Based version of MDM4A?

How do you use the Class-Based version of MDM4A?

For all class-based access to MDM4A you only interact with the object CL_MDM_GENERIC_API. Internally the Abstract Provider will be instantiated with the release specific provider. All access to the functionality of MDM4A is done through the instances of the main group of Interfaces exposed by the Generic API

The object CL_MDM_GENERIC_API has attributes that hold object references to the 5 major parts of the API:

IF_MDM_ACCESSOR
This interface controls the opening and closing of a connection to a repository.
For many of the other API Methods, you must first have created a connection to a repository via this interface.

IF_MDM_ADMIN
This interface provides access to Admin functions similar to those available via the MDM Console. It includes User (creation, password set, role maintenance) and Repository (Mount or Load Repositories) Administration.

The IF_MDM_ADMIN interface poses an interesting situation. Many of the functions here could be automated and then batch scheduled using the local ABAP Scheduler or the Netweaver Central Scheduler by Redwood. It would also be quite easy to use IF_MDM_ADMIN to batch create users (based upon their existence or role assignment in AS-ABAP) for the MDM Server.

IF_MDM_API_CONFIG
This interface allows you to read the configuration entries from Transaction MDMAPIC for one repository or all of them at once. See the Data Dictionary structures MDM_REPOSITORY, MDM_CONNECTION, MDM_DBMS, and MDM_PROVIDER for the data supplied by this Interface.

IF_MDM_CORE_SERVICES
This is the main interface to directly manipulate the data within a repository.
It includes Check In/Out, Client System Keys, Update, Delete, Creation, and Query of data.

Many of the Core Services have a second method that ends in _SIMPLE. For instance there is UPDATE and UPDATE_SIMPLE. The "Simple" methods accept data dictionary structures that match the format of the repository table that you want to manipulate. This provides an easier interface into the API but requires the creation of a matching structure in the ABAP Data Dictionary.

The field names in the ABAP Data Dictionary Structure must be the same as the Name in the MDM Repository (case-sensitive). You are also restricted to only using the MDM API Data Types. Keep in mind that in ABAP there is no NULL state for a value. Any NULL value from MDM will be returned through the simple data types using the initial value for the underlying Data Dictionary Domain. Use of the specific methods instead of the SIMPLE ones will avoid this issue.

IF_MDM_META
This interface provides methods that allow you to change the metadata of a repository. Many of these methods require that the repository be unloaded before they can be performed.

SAP Developer Network Latest Updates