Skip to Content
Technical Articles
Author's profile photo Senthilkumar Moorthy

Achieve Automatic Customizing for Reference Master Data in MDG


Reference Master Data is a type of Master Data in SAP, which is mainly used as a Look-up data or value help during creation of other operational master data such as Material Master, Business Partner, etc.

Check this Blog from Markus which talks in detail about how to govern the Reference Master Data.

In this blog, we are not going to talk about how to create governance for Reference Master data, but only about how to achieve Automatic Customizing for Reference Master Data using MDG Data Replication Framework.


In a distributed SAP Environment, MDG is usually put in a  Hub system, where you govern your data centrally and distribute the data to the required target ERP System. In case of Reference Master data, which is usually a Customizing entry in the target ERP system, i.e., you need the Reference Master data to be available in the T* tables of your respective ERP transaction system, so that it is convenient to consume the centrally created Reference Master data in your transaction process.

Now, the question is

What is the easy way to achieve this?

How can i follow a standard approach to implement this scenario?


Reference Master data can be automatically distributed to any Target ERP System as a Customizing entry, i.e., using the SAP Standard BC Set approach. After approval from MDG, the Reference Master data is created in target system and gets locked under a Customizing Transport Request.

You can also decide to maintain only the Mandatory attributes for a given Customizing table. Later, the same entry can be enhanced manually in the target system with all required information, before the release of the BC set transport. In case you have filled the complete customizing attributes in MDG, then you can also automatically release the Transport in the target system during the replication.

In this blog, we will see in detail about how to configure MDG Data Replication Framework to achieve this automatic customizing.


Below are the high level steps to achieve automatic customizing


Creation of New Outbound Implementation

A new outbound implementation has to be created with the Communication channel as ‘4 Replication via RFC’. Standard delivered Implementation class ‘CL_MDG_OIF_DRF_OUTBOUND_IMPL’  can be used


Also provide the Business Object type which you have originally created for the Data Model / Entity, provide the Filter Object if required.

Creation of New Outbound Interface Model

A new outbound Interface Model should be created. During the Interface Model creation, the Function Module code will get auto generated which will contain the code to create the Automatic transport request along with the customizing entry as BC Set in the target system.

Map the required fields for which the structures should be generated. Please note, this structure will be used during the SMT Mapping at the later stage. So, please select all the required fields which you want during the Customizing entry creation.


Creation of New Target structure for SMT Mapping

A new inbound structure for the SMT Mapping configuration has to be created. This structure can be of same type of the Table / View of the Standard Customizing T* table. For example, if the target standard customizing table is V_T001, then you can create a Y or Z structure with the include of V_T001.

Creation of New SMT Mapping

Create a new SMT mapping to map the Source Structure which is generated through the outbound interface model and the target structure which is created above.


Create a new mapping step and provide the source and the target structure

Create a new Field Mapping transformation and map the required fields from source structure to the target structure

Update the view V_MDG_RD_MAPPING

A new entry in the  view V_MDG_RD_MAPPING should be created as below. The Table name is the Table type structure created in the outbound interface model, Object is the standard customizing table/view and the SMT mapping to Active area is the new SMT Mapping Created above.

Assignment of outbound implementation to Replication Model

The newly created outbound implementation should be attached to the replication model. Provide the Target system for the outbound implementation in the replication model configuration. Please ensure an Active RFC Connection to the target system exists.


Sample Code for the Function Module

FUNCTION zn_companycode.
*"*"Local Interface:

**This is a generated FM by OIF.
**Please do not change the signature of the FM.
**By default it calls the same FM with an RFC desitination assuming
**that the FM with the same name would exist in the receiver system.
**You can reimplement the FM by commenting out the call to the FM
**with your respective inbound FM based on the destination.


  DATA: lo_container TYPE REF TO if_bcfg_config_container,
   ls_mapping TYPE if_bcfg_config_container=>ty_s_mapping_info,
   lt_langu TYPE if_bcfg_config_container=>ty_t_languages,
   lt_mapping TYPE if_bcfg_config_container=>ty_t_mapping_info,
   ls_mdg_rd_mapping TYPE mdg_rd_mapping,
   ls_header TYPE ttypename,
   lv_order TYPE trkorr.

* Step to Create the Transport request number in the target system.

  CALL METHOD cl_mdg_ref_data_api=>create_transport
      iv_user     = sy-uname
      iv_rfc_dest = iv_rfc_dest
      ev_order    = lv_order.

  ls_header = 'ZNT_BURKS' .
  ls_mdg_rd_mapping = cl_mdg_ref_data_api=>read_refdat_config(
  iv_tabletype = ls_header ).
  MOVE-CORRESPONDING ls_mdg_rd_mapping TO ls_mapping.
  CLEAR: ls_mapping-tablename, lt_mapping.
  APPEND ls_mapping TO lt_mapping.
  INSERT 'E' INTO TABLE lt_langu.
  IF sy-langu NE 'E'.
    INSERT sy-langu INTO TABLE lt_langu.
  CALL METHOD cl_mdg_ref_data_api=>create_container
      iv_rfc_dest  = iv_rfc_dest
      it_langu     = lt_langu
      it_mapping   = lt_mapping
      eo_container = lo_container.
* Read data from remote system to check whether 
* the data already there, to avoid overwritting
  data lt_data type STANDARD TABLE OF t001.
  data lt_options type STANDARD TABLE OF RFC_DB_OPT.
  data ls_options type rfc_db_opt.
* build where clause for the remote select
  FIELD-SYMBOLS: <ls_burks> like line of it_bukrs.
  LOOP AT it_bukrs ASSIGNING <ls_burks>.
               <ls_burks>-bukrs '''' space
          INTO ls_options.
    APPEND ls_options TO lt_options.

* Source code to read data from target system
      query_table                = 'T001'
*     DELIMITER                  = ' '
*     NO_DATA                    = ' '
*     ROWSKIPS                   = 0
*     ROWCOUNT                   = 0
      options                    = lt_options
*      fields                     = fields
      data                       = lt_data
     TABLE_NOT_AVAILABLE        = 1
     TABLE_WITHOUT_DATA         = 2
     OPTION_NOT_VALID           = 3
     FIELD_NOT_VALID            = 4
     NOT_AUTHORIZED             = 5
     OTHERS                     = 7
  IF sy-subrc <> 0.
   E_RC = sy-subrc.

* Source code to generate the BCset and add it to the Transport
  CALL METHOD cl_mdg_ref_data_api=>add_lines_generic
      it_lines      = it_bukrs
      iv_objectname = ls_mapping-objectname
      io_container  = lo_container
      iv_order      = lv_order
      iv_mapping    = ls_mdg_rd_mapping-mapping.


* Source code to release the Transport request number. 
* Please be cautious to uncomment only if you know that all the 
* attributes are filled in the customizing. 
* Otherwise, you cannot use the same Transport.

*  CALL METHOD cl_mdg_ref_data_api=>release_transport
*      iv_order    = lv_order
*      iv_rfc_dest = iv_rfc_dest.


Critical Authorizations for the User

The Replication usually happens in the background, so the same RFC user which is used in the RFC Destination, is generally taken as a user in target system for creation of the BC Set transport. But, if you want to change the user for the Transport request, please input the right user name in the below source code of the FM generated above.

 CALL METHOD cl_mdg_ref_data_api=>create_transport
*      iv_user     = sy-uname
      iv_user     = < replace the actual user id from target system >
      iv_rfc_dest = iv_rfc_dest
      ev_order    = lv_order.


Please ensure the user in the target system is having basic authorization for creation of BCSet and Transport Request.

S_TRANSPRT – Used to secure the functions that change transport requests and tasks

S_CTS_ADMI – Used to secure the administration functions in the CTS

S_BCSETS – Used to Secure the function that create / change the BCSet

*Source :  SAP Help Portal


Once the final approval is provided for the Reference Master data in the MDG System, a Replication is triggered from MDG to the respective ERP system, which is connected through the RFC destination. In the Target system, a Transport request is created with the required Customizing entry updated in the respective T* table.

A sample Transport is provide below, where the T001 (Company Code) is created


*All the images shown here are own images and taken from an Sandbox SAP system. Any resemblance to other systems are not intentional.


Senthilkumar Moorthy.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Ramesh G
      Ramesh G

      Great Blog ! Well explained - Thanks .

      Author's profile photo Senthilkumar Moorthy
      Senthilkumar Moorthy
      Blog Post Author

      Thanks Ramesh. 🙂

      Author's profile photo Deepak Kumar
      Deepak Kumar

      Helpful Document.

      But how can we go for auto customization of reference data from multiple S/4 instances to a single MDG hub system.

      Author's profile photo Senthilkumar Moorthy
      Senthilkumar Moorthy
      Blog Post Author

      Hello Deepak,

      Thanks for your feedback.

      The scenario discussed in this blog is about Reference Master Data Governance from MDG Hub to multiple S4 systems. In case you want the customizing from multiple S4 instance, then you can either use Migration Cockpit or anyother migration tools



      Author's profile photo Gianni Coenen
      Gianni Coenen


      Very helpful document. I do have one additional question, is there a possibility to make this reference data time dependent? Like we can do with editions for financial data.

      This way we could already setup the reference data and replicate it only at the date they become valid to the correct systems.



      Author's profile photo Senthilkumar Moorthy
      Senthilkumar Moorthy
      Blog Post Author

      Hello Gianni,


      Thanks and glad that the document helped you.

      Yes, it is certainly possible to create time-dependent (edition based) reference master data. I will write a blog soon on how to create and configure edition based reference master data and i will also provide that link to this blog.




      Author's profile photo Senthilkumar Moorthy
      Senthilkumar Moorthy
      Blog Post Author

      Hello Gianni Coenen ,

      Though it is little late, i though it is good to mention here about my blogpost on Edition.



      Author's profile photo Wisam Chahoud
      Wisam Chahoud

      Great Blog !

      Best Regards


      Author's profile photo Pushpalatha Muppalla
      Pushpalatha Muppalla

      Dear Moorthy,

      Thank you so much for the in depth explanation. its a great blog!

      Could you also let me know how we could replicate the reference data into non sap systems ?