Skip to Content
Technical Articles

Modify UI attribute properties of CLASSASGN entity in MDG-M

Introduction

Over the last few weeks I have been trying to figure out the ways and means to try and change the UI attribute properties of CLASSASGN or Classification entity. This includes the classification data and its characteristics. I have come to know that for some reason it cannot be handled with the help of BADI – USMD_ACC_FLD_PROP_CUST_DEP_SET. Then how do we do it ? That’s exactly what I have explained in this blog. I will basically explain how to make the entity as read-only by enhancing standard web dynpro component. The MDG-M version in this scenario is 8.0.

 

Prerequisites

The developer should be aware of the concepts in Web Dynpro ABAP, especially the ones which are used when enhancing a standard Web Dynpro Component.

 

Technical Solution

The Web Dynpro component meant for Classification entity is – /PLMU/WDC_CLF. We need to enhance this component.

Firstly, to make the Classification UI table holding the classes as read only, enhance the View V_CLASS and create a post-exit method out of the hook method- WDDOMODIFYVIEW. After this, you need to insert the following code. This code will make the Classification UI table as read only which is not good enough as the end user could still use the search help of individual columns. We also need to make each of the table attributes or columns as read-only. By doing so we ensure that the Classification UI table is now read-only in every respect.

DATA : lo_table      TYPE REF TO cl_wd_table,
       lo_button     TYPE REF TO cl_wd_toolbar_button,
       lo_elment     TYPE REF TO if_wd_context_element,
       ls_data       TYPE /plmu/s_clf_class,
       lo_nd_class   TYPE REF TO if_wd_context_node.


lo_table ?= wd_this->mo_view->get_element( id = 'CLASS_TAB' ).  "Id of Table UI element
lo_table->set_read_only( EXPORTING value = abap_true ).

* navigate from <CONTEXT> to <CLASS> via lead selection
  lo_nd_class = wd_context->path_get_node( path = `LEAD_OBJ.CLASSTYPE.CLASS` ).
  DATA(lt_elments) = lo_nd_class->get_elements( ).
  DATA(lt_attributes) = lo_nd_class->get_node_info( )->get_attribute_names( ).

  LOOP AT lt_elments INTO lo_elment.
    lo_elment->get_static_attributes( IMPORTING static_attributes = ls_data ).
    LOOP AT lt_attributes INTO DATA(lv_attribute).
      ASSIGN COMPONENT lv_attribute OF STRUCTURE ls_data TO FIELD-SYMBOL(<lv_value>).
      IF <lv_value> IS ASSIGNED.
        lo_elm->set_attribute_property(
          EXPORTING
            attribute_name = lv_attribute
            property       = if_wd_context_element=>e_property-read_only
            value          = abap_true ).
      ENDIF.
    ENDLOOP.
  ENDLOOP.



 

The next step will be to make the characteristic input fields as read only or disabled. In custom controller DISPLAY_VALUES, we need to create an overwrite exit out of the method – CREATE_INPUT_FIELD_VALUE_NEW. This method is called every time a new characteristic is to be displayed on UI. The same code as that of the actual method needs to copied in the overwrite exit with a few modifications.

The below screenshot shows that the enabled parameter needs to be controlled dynamically as per the condition we want. By default, this parameter is set to abap_true. This would enable/disable the characteristic. Due to lack of time I could not figure out how exactly to make the characteristic read only as it was also giving me some trouble. But disabling the characteristic also did the trick for me.

 

Conclusion

By performing the above steps we can control the Classification entity on MDG-M UI and that too in a dynamic manner. We can control both the UI table holding Classes and Characteristic section.

 

/
Be the first to leave a comment
You must be Logged on to comment or reply to a post.