Skip to Content
Author's profile photo Former Member

MDG – Technical Customization and Configuration of the screens Based on User role

Let me start with the basic requirement before going into technical details.

SAP Master Data Governance for Material (MDG-M) provides business processes to find, create, change, and mark material master data for deletion. It supports the governance of material master data in a central hub and the distribution to connected operational and business intelligence systems.

The processes are workflow-driven and can include several approval and revision phases, and the collaboration of all users participating in the master data maintenance.

This scenario addresses the customer requirement to have a more flexible user interface. This could dependent for example on roles.

Based on the roles we need to do the below operations
 
1.Adjust the definition of attributes or add new attributes
2.Restrict the values displayed in a dropdown box or selection field group
3.Restrict the values displayed in the input help
4.Dynamically control the visibility of fields on the user interface and of the property that determines if fields are required or display-only
5.Initialize the displayed data
To achive all the above functionality a custom table is defined.
Table details.PNG
All the values for Action, event id ,Main view id, subview id are maintianed at domain level.
For action, the values are

01 Restrict Dropdown list based on  prior selection.

02 Manage View

03 Manage SubView

04 Context based Adaptation

05 Manage FPM Buttons

For Event, the values are

1 USMD_TABLE_ADD_LINE

2 USMD_TABLE_COPY_LINE

3 USMD_TABLE_DEL_LINE

For Main view id, The values are

01 MM_BASIC_DATA

02 MM_DESCRIPT

03 MM_CLASSIFICATION

04 MM_UOM

05 MM_ADD_EAN

06 MM_BASIC_TEXT

07 MM_INT_COMMENT

For subview id, The values are

01 MM_BASIC_DATA_MAIN

02 MM_DESCRIPT_MAIN

03 MM_CLASSIFICATION_MAIN

04 MM_UOM_MAIN

05 MM_ADDEAN_MAIN

06 MM_BASIC_TEXT_MAIN

07 MM_BASIC_INT_COMMENT

So based on the data model, Request type, Reason and the role, and depending on the other filed combinations either the view is hidden or a field is made visible, read only or hidden.The detailed requirement can be described as below.
table values.PNG
Once the table is created, we need to start with the below configuration and changes in the classes and relevant methods.
  1. The Badi BADI_MDG_BS_MAT is enhanced to read the values from the above table and modify the properties.

  2. Copy the enhancement implementation MDG_BS_MAT_GEN from package MDG_BS_MAT_MODEL_GEN into Z_IM_MDG_BS_MAT_GEN.

  3. Copy the class CL_MDG_BS_MAT_UI_BADI into ZCL_IM_MDG_BS_MAT_UI_BADI.

  4. Set the filter value UICONFIGURATION = Z_MM_MATGEN_ALL__SG_01_1 (Configuration that needs to be used ,If it is custom set as custom)

  5. In the attributes tab Change the value of GC_USUAL_UI_CONFIG to ‘Z_MM_MATGEN_ALL__SG_01_1’.

  6. The code has been implemented in three methods

  7. IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION used to hide the Main view and subview and the event buttons

  8. IF_EX_USMD_UI_EVENT2~PROCESS_VALUE_HELP used to filter the F4 value based on the custom table entries.
  9. IF_EX_USMD_UI_EVENT2~MODIFY_VIEW  to set the filed level attributes.
  10. The custom table zmmdguibadi has been created to maintain the different combination of data.Based on the user , retrieve the roles from table agr_users.  Based on the Model,CREQ type , roles and entity retrieve the information from zmmdguibadi which will be used in all the METHODS.
  11. IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION—Based on zmmdguibadi-action eq ‘02’ ,zmmdguibadi -usmd_mview_id, zmmdguibadi -usmd_visible      hide main view
  12. Based on zmmdguibadi-action eq ‘03’ , zmmdguibadiusmd_sview_id and ls_zmmdguibadiusmd_visible hide subview.
  13. IF_EX_USMD_UI_EVENT2~PROCESS_VALUE_HELP – Based on the zmmdguibadi-action eq ‘01’ ,zmmdguibadiusmd_attribute1 and the value of zmmdguibadiusmd_attribute , Retrieve the corresponding entries to be populated into F4 help of other fields.
  14. IF_EX_USMD_UI_EVENT2~MODIFY_VIEW — Based on the value of zmmdguibadi-action eq ‘04’ , zmmdguibadiusmd_attribute , set            zmmdguibadiusmd_attribute1 required , read_only  or visible.
  15. IF_EX_USMD_UI_EVENT2~MODIFY_VIEW — Based on the value of zmmdguibadi-action eq ‘05’ , zmmdguibadi fpm_event_id, set event invisible.
  16. The standard BADI USMD_CREQUEST_UI is  implemented ZMMD_USMD_CREQUEST_UI. The code changes are done in the method INITIALIZE to make the reason field mandatory.

          

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Very useful article. Thanks.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks Raj

      Author's profile photo Abdul Rahman Nagoor Meeran
      Abdul Rahman Nagoor Meeran

      Thanks for sharing.

      If possible, Can You explain the things, Configuration/Changes required in Classes and its relevant Methods(Point 1 to 15), Implementing Standard BAdi/Code Changes in Method INITIALIZE(Point 16) little detail with screenshots ?

      My understandings from blog are given below, correct me if wrong, kindly add Your notes wherever You feel to explain.

      (Points 1 to 16 are in same order as blog)

      1. The Badi BADI_MDG_BS_MAT is enhanced to read the values from the above table and modify the properties.
        • We need to enhance the BAdi Implementation ‘BADI_MDG_BS_MAT’ to read values from ‘required table(As in blog)’ and we need to modify Properties
      2. Copy the enhancement implementation MDG_BS_MAT_GEN from package MDG_BS_MAT_MODEL_GEN into ‘Z_IM_MDG_BS_MAT_GEN’.
        • Copy Enhancement Implementation ‘MDG_BS_MAT_GEN’ via SE19 ??
        • Via SE18, BAdi Definition ‘USMD_UI_EVENT2’, After Copying ??
        • when copying ‘Enhancement Implementation’, its belongings(Enh. Imple. Elements) are getting copied,
          • BAdi Implementation
          • Implementing Class (it belongings)
          • Class-Methods
          • Methods-Code
          • Filter Values
      3. Copy the class CL_MDG_BS_MAT_UI_BADI into ZCL_IM_MDG_BS_MAT_UI_BADI.
        • As Class ‘CL_MDG_BS_MAT_UI_BADI’ also get copied while copying Enhancement Implementation ‘Z_IM_MDG_BS_MAT_GEN’, we need to change the Class with ‘ZCL_IM_MDG_BS_MAT_UI_BADI’.
        • Via SE24, copying ??
        • Changing the Class in ‘Enhancement Implementation’ to ‘Z_IM_MDG_BS_MAT_GEN’ ??
      4. Set the filter value UICONFIGURATION = Z_MM_MATGEN_ALL__SG_01_1 (Configuration that needs to be used ,If it is custom set as custom)
        • Deleting ‘FilterValues’  that are get copied while copying Enhancement Implementation ‘Z_IM_MDG_BS_MAT_GEN’ ??
        • Adding ‘Filter Combination’ ‘UICONFIGURATION = Z_MM_MATGEN_ALL__SG_01_1’
      5. In the attributes tab Change the value of GC_USUAL_UI_CONFIG to ‘Z_MM_MATGEN_ALL__SG_01_1’.
        • Changing Attribute Value ??
      6. The code has been implemented in three methods
        • From 7, 8 & 9th points
          • IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION
          • IF_EX_USMD_UI_EVENT2~PROCESS_VALUE_HELP
          • IF_EX_USMD_UI_EVENT2~MODIFY_VIEW
        • Method listed in ‘Requirement Detailing Table’
          • IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION
          • IF_EX_USMD_UI_EVENT2~MODIFY_VIEW
          • IF_EX_USMD_UI_EVENT2~GET_ATTR_VALUE_SET
      7. IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION used to hide the Main view and subview and the event buttons
        • To Adjust Definition of Attributes/Add Attributes ::: Used to Hide Main View, Sub View & Event Buttons
      8. IF_EX_USMD_UI_EVENT2~PROCESS_VALUE_HELP used to filter the F4 value based on the custom table entries
        • To Restrict Selection for Input Help ::: Used to Filter F4 Value, based on Custom Table Entries
      9. IF_EX_USMD_UI_EVENT2~MODIFY_VIEW  to set the filed level attributes.
        • To Dynamically Adjust User Interface ::: Used to Set Field Level Attributes
      10. The custom table zmmdguibadi has been created to maintain the different combination of data.Based on the user , retrieve the roles from table agr_users.  Based on the Model,CREQ type , roles and entity retrieve the information from zmmdguibadi which will be used in all the METHODS.
        • Custom Table ‘zmmdguibadi’ created to maintain different combination of Data
          • Based on User, Retrieve the Roles from Table ‘agr_users’ with ‘AGR_NAME’
          • Based on Model, CREQ Type, Roles and Entity; Retrieve information from ‘zmmdguibadi’ which is used in Methods
      11. IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION—Based on zmmdguibadi-action eq ‘02’ ,zmmdguibadi -usmd_mview_id, zmmdguibadi -usmd_visible      hide main view
        • Method ‘IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION’; will Hide Main View, Based on ‘zmmdguibadi’ when
          • ‘Action’ Equals to ‘02’,
            • ‘zmmdguibadi’ – ‘usmd_mview_id’
            • ‘zmmdguibadi’ – ‘usmd_visible’
      12. Based on zmmdguibadi-action eq ‘03’ , zmmdguibadi–usmd_sview_id and ls_zmmdguibadi–usmd_visible hide subview.
        • Method ‘IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION’; will Hide SubView, Based on ‘zmmdguibadi’ when
          • ‘Action’ Equals to ‘03’,
            • ‘zmmdguibadi’ – ‘usmd_sview_id’
            • ‘zmmdguibadi’ – ‘usmd_visible’
      13. IF_EX_USMD_UI_EVENT2~PROCESS_VALUE_HELP – Based on the zmmdguibadi-action eq ‘01’ ,zmmdguibadi—usmd_attribute1 and the value of zmmdguibadi–usmd_attribute , Retrieve the corresponding entries to be populated into F4 help of other fields.
        • Method ‘IF_EX_USMD_UI_EVENT2~PROCESS_VALUE_HELP’, will Retrieve corresponding entries to be populated into F4 help. Based on ‘zmmdguibadi’ when
          • ‘Action’ Equals to ‘01’,
            • ‘zmmdguibadi’ – ‘usmd_attribute1’
            • ‘zmmdguibadi’ – ‘usmd_attribute’
      14. IF_EX_USMD_UI_EVENT2~MODIFY_VIEW — Based on the value of zmmdguibadi-action eq ‘04’ , zmmdguibadi—usmd_attribute , set            zmmdguibadi–usmd_attribute1 required ,read_only  or visible.
        • Method ‘IF_EX_USMD_UI_EVENT2~MODIFY_VIEW’, will make the field ‘ReadOnly’ or ‘Visible’, Based on ‘zmmdguibadi’ when
          • ‘Action’ Equals to ‘04’,
            • ‘zmmdguibadi’ – ‘usmd_attribute1’
            • ‘zmmdguibadi’ – ‘usmd_attribute’
      15. IF_EX_USMD_UI_EVENT2~MODIFY_VIEW — Based on the value of zmmdguibadi-action eq ‘05’ , zmmdguibadi— fpm_event_id, set event invisible.
        • Method ‘IF_EX_USMD_UI_EVENT2~MODIFY_VIEW’, will set event ‘Invisible’, Based on ‘zmmdguibadi’ when
          • ‘Action’ Equals to ‘05’,
            • ‘zmmdguibadi’ – ‘fpm_event_id’
      16. The standard BADI USMD_CREQUEST_UI is  implemented ZMMD_USMD_CREQUEST_UI. The code changes are done in the method INITIALIZE to make the reason field mandatory
        • Kindly elaborate.
      Author's profile photo Rahul Bhayani
      Rahul Bhayani

      Is it working for OVP ? if yes could you please give us an example.