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.
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
For Main view id, The values are
For subview id, The values are
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.
Once the table is created, we need to start with the below configuration and changes in the classes and relevant methods.
The Badi BADI_MDG_BS_MAT is enhanced to read the values from the above table and modify the properties.
Copy the enhancement implementation MDG_BS_MAT_GEN from package MDG_BS_MAT_MODEL_GEN into Z_IM_MDG_BS_MAT_GEN.
Copy the class CL_MDG_BS_MAT_UI_BADI into ZCL_IM_MDG_BS_MAT_UI_BADI.
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)
In the attributes tab Change the value of GC_USUAL_UI_CONFIG to ‘Z_MM_MATGEN_ALL__SG_01_1’.
The code has been implemented in three methods
IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION used to hide the Main view and subview and the event buttons
IF_EX_USMD_UI_EVENT2~PROCESS_VALUE_HELP used to filter the F4 value based on the custom table entries.
IF_EX_USMD_UI_EVENT2~MODIFY_VIEW to set the filed level attributes.
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.
IF_EX_USMD_UI_EVENT2~MODIFY_DEFINITION—Based on zmmdguibadi-action eq ‘02’ ,zmmdguibadi -usmd_mview_id, zmmdguibadi -usmd_visible hide main view
Based on zmmdguibadi-action eq ‘03’ , zmmdguibadi–usmd_sview_id and ls_zmmdguibadi–usmd_visible hide subview.
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.
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.
IF_EX_USMD_UI_EVENT2~MODIFY_VIEW — Based on the value of zmmdguibadi-action eq ‘05’ , zmmdguibadi— fpm_event_id, set event invisible.
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.
Very useful article. Thanks.
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)
Is it working for OVP ? if yes could you please give us an example.