Introduction

                SAP Master Data Governance software helps organizations govern financial, material, customer, or supplier master data from its creation in a business application through its replication to target applications to ensure data quality and regulatory compliance across the enterprise

Scope

              Master Data Governance for Custom Objects has the capability of Using UI Badi through which we would be able to restrict the drop down values dynamically. In this we will try to provide dynamic drop down values based on some criteria.

Pre Requisites

                    You should be having developer access for creating components and creating new configurations. You should have some knowledge of Web Dynpro ABAP and also the concept of using UI badi.

Data Modelling

                  I have created a sample data model with its own access class. I have an entity type CHARP which is a qualifying relationship to another entity type. This entity is going to be the drop down value.

/wp-content/uploads/2013/08/1_269447.jpg

UI Badi

              Navigate to MDGIMG-> UI Modelling-> Business Addins

/wp-content/uploads/2013/08/1_269447.jpg

Create an enhancement implementation and provide the filter value as the UI configuration for which the BADI has to be called.

/wp-content/uploads/2013/08/1_269447.jpg

/wp-content/uploads/2013/08/1_269447.jpg

 

Navigate to the class and implement the method IF_EX_USMD_UI_EVENT2~GET_ATTR_VALUE_SET

 

 

The ID_ATTRIBUTE field contains the field name for which the drop down value is triggered and you can use the below coding to fetch the value that is needed, based on which the drop down value has to be shown.

One thing to be noted is that this method gets called only one time during initiation or when the tab changes.

 

if id_attribute = ‘CHARP’.

lo_usmd_model_ext = is_ui_contexto_model.

if lo_usmd_model_ext is not initial.

read table it_key_field into wa_key_field with key fieldname = ‘MARA’.

wa_selfieldname = ‘MARA’.
wa_sel
sign = ‘I’.
wa_sel
option = ‘EQ’.
wa_sel
low = wa_key_fieldvalue.
append wa_sel to it_sel.

call method lo_usmd_model_ext->read_entity_data_all(
exporting
i_fieldname
= ‘MARA’
if_active
=
it_sel
= it_sel
importing
et_data_entity
= it_data_entity ).

if it_data_entity is initial.

call method lo_usmd_model_ext->create_data_reference(
exporting
i_fieldname
= ‘MARA’
i_struct
= ‘KATTR’
if_table
= ‘X’
importing
er_data
= lr_data ).

assign lr_data->* to <fs_data>.

call method lo_usmd_model_ext->read_char_value(
exporting
i_fieldname
= ‘MARA’
it_sel
= it_sel
importing
et_data
= <fs_data> ).

else.

read table it_data_entity into wa_data_entity index 1.

lr_data = wa_data_entityr_t_data.
assign lr_data->* to <fs_data>.

endif.

if <fs_data> is assigned.

loop at <fs_data> assigning <fs_structure>.

assign component ‘MATNR’ of structure <fs_structure> to <fs_matnr>.

endloop.

endif.

if <fs_matnr> is assigned and
<fs_matnr>
is not initial.

//provide own logic for filtering out values based on matnr values.

loop at it_output into wa_output.

wa_selectionfieldname = id_attribute.
wa_selection
sign = ‘I’.
wa_selection
option = ‘EQ’.
wa_selection
low = wa_outputvalue.
insert wa_selection into table et_selection
.

endloop.

endif.

endif.

endif.

The et_selection table contains the values that will be displayed for the drop down.

Assign UI configuration to Change request

                                               

                                                  Now this UI configuration can be used either in the URL directly or provide this configuration name to a Change request type so that wherever this Change Request type is called, this UI configuration will be called.

                           /wp-content/uploads/2013/08/1_269447.jpg

Select the change request type and double click Entity types.

/wp-content/uploads/2013/08/1_269447.jpg

Now you could provide the new UI configuration name in the UI configuration column.

/wp-content/uploads/2013/08/1_269447.jpg

If it is in display mode and if you are not able to change it, then it means that there are some existing  request that are open in this Change Request Type. So you have to clear those request that will enable you to change the UI configuration name

Note: you could makes use of the report USMD_DELETE_CREQUEST to delete Change requests. This is available only from EHP 5 SP05

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply