Skip to Content

This document contains information on “how to access MDM from SRM using custom APIs” from the scratch. Screenshots have been provided to understand with ease.

To access from MDM into SRM, there are three major steps.

  1. MDM server configuration
  2. SRM server configuration
  3. Custom FM/ class to fetch the data

1. MDM Server Configuration


First check if you have the MDM add on installed on your SAP SRM system. If it is not installed, contact your Basis/ Infrastructure administration team to install it.

You can find it via System -> Status -> SAP System data -> component version -> component information

/wp-content/uploads/2013/07/1_251843.jpg

You should be seeing MDM_TECH software component along with it version information

/wp-content/uploads/2013/07/1_251843.jpg

Then, check if your SRM system is allowed to connect to MDM server. This information can be found on MDM installation path. The file “allow.ip” will contain the information of the IP address that can connect to MDM, whereas the file “deny.ip“ will contain the blocked list of IP address. They are just the files containing IP address and no other information.

/wp-content/uploads/2013/07/1_251843.jpg

/wp-content/uploads/2013/07/1_251843.jpg

Most of these configurations will be taken care by MDM system’s Infrastructure team.

2. SRM server configuration

Go to transaction MDMAPIC. And ABAP Implementation for MDM Version Support.

You can find all the MDM Provider classes supporting different versions of SAP. Check if your SRM system has supporting provider class for connecting to your MDM system. If the respective patch is installed, it would reflect here.

/wp-content/uploads/2013/07/1_251843.jpg


     Creating DBMS Host

Now, Double click on MDM DBMS Hosts. You can find a list of MDM DBMS Hosts maintained.

/wp-content/uploads/2013/07/1_251843.jpg

For adding a new Host, click on New Entries -> Enter a logical name for the new host, database type, and IP address / host’s domain name. Save the data.

/wp-content/uploads/2013/07/1_251843.jpg

Creating Server Connection

After that, Double click on MDM Server Connections to see the list of MDM Server connections available.

  /wp-content/uploads/2013/07/1_251843.jpg

For creating a new connection, Click on New entries , enter logical name for your MDM Connection, IP address or name of DBMS host and port of DBMS (which is 20005, by default) and save the connection. An RFC destination is created by default.

You can check for it in SM59 under TCP/IP connections.

Creating MDM Repository

Double click on MDM Repositories, to see the list of MDM repositories if any./wp-content/uploads/2013/07/1_251843.jpg

To create a new repository, click on “New Entries”. /wp-content/uploads/2013/07/1_251843.jpg

Enter any object name, The repository that you are connecting to (MDM repository), MDM connection that you created in the previous step, MDM DBMS host created, MDM Provider (depending upon the version). Save it (repository connection object).

Now you are done with the configuration steps. The rest is the coding part.

3. Code To Operate On Data Using The Connection Object

Data:

lw_language          TYPE mdm_cdt_language_code,

lo_mdm_connection    TYPE REF TO cl_mdm_generic_api.

lw_language-language = ‘eng’.
lw_language-country  = ‘US’.
lw_language-region   = ‘USA’.

*– Create instance

      CREATE OBJECT lo_mdm_api
EXPORTING
iv_log_object_name
= <<object_name_created>>.

*– Connect to MDM
lo_mdm_api
->mo_accessor->connect( lw_language ).

*– Retrieve record ids set from MDM table
CALL METHOD lo_mdm_api->mo_core_service->query
EXPORTING
iv_object_type_code     
= <<mdm_table_name>>
        iv_start_with            = lv_start_position
        iv_hits_max              = lv_no_of_records
        it_query                 = lt_query
is_sort_information      = lw_sort

      IMPORTING
et_result_set           
= lt_query_result_set
ev_result_size          
= lv_total_size.

lt_query will contain anywhere conditions that you want to apply on the table. The table lt_query_result_set will contain the resultant record IDs. Using the record ids/keys, we retrieve the record data.

LOOP AT lt_query_result_set INTO lw_query_result_set.
     
APPEND LINES OF lw_query_result_setrecord_ids TO lt_keys.
  
ENDLOOP.

    CALL METHOD po_mdm_api->mo_core_service->retrieve
     
EXPORTING
      iv_object_type_code
= <<mdm_table_name>>
      it_keys            
= lt_keys
     
IMPORTING
      et_result_set      
= lt_result_set.

*– Disconnecting from MDM
lo_mdm_api
->mo_accessor->disconnect( ).

Note: Don’t forget to include   “TYPE-POOLS mdmif.” in your report.

            Handle all possible exceptions by looking into the respective classes.

Appendix


  • Building the where condition to the “query” method – sample code.

lw_qualifier_query-value = lr_data_ref.
lw_qualifier_query
qualifier_field_code = <<table_name>>. *Eg:’MDMSRM_CATALOG_ITEMS’.
lw_query
parameter_code  =   <<Field_name>>.

“Eg: ‘MDMSRM_SORTABLE_PRICE’.
lw_query
operator        = <<relational_operator>>.

“Eg: ‘GE’,’CS’,’SW’ etc.,
lw_query
dimension_type  = <<dimension_type>>.

“Eg: mdmif_search_dim_field.
lw_query
constraint_type = <<constraint_type>>.

“Eg: mdmif_search_constr_text, mdmif_search_constr_num etc.,
GET REFERENCE OF lv_price_from INTO lw_queryvalue_low.
APPEND lw_query TO lt_query.

  • For more operations on MDM tables using the APIs look out for the interface IF_MDM_CORE_SERVICES. All these methods are already implemented for you. You need to consume them.
  • MDM Language keys   

/wp-content/uploads/2013/07/1_251843.jpg

/wp-content/uploads/2013/07/1_251843.jpg

Please post your valuable comments on any updations, correction or your reviews. Thanks in advance. 🙂

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply