MDG – notes/attachments marker on CR header
Soon after we went live with MDG-M project, users started to complain that attachments or notes added to Change Request header are often not noticed by next steps processors. That’s mainly because to see them, they have to switch the tabs.
Well, I must admit – they were right. If only a few percent of all Change Requests have some notes or attachments, then it is annoying to check both tabs for each CR just to – in most cases – find nothing there. Fortunately the remedy is pretty simple.
Thinking on the solution
It would be nice to have some LED icons on the tabs to mark, that there is content inside – something like below:
After analyzing how FPM Tabbed UIBB works it has turned out there is no way to achieve the above without enhancement/modification of that core FPM component – I didn’t like that.
So, another – not so fancy but still not bad looking – solution is to show the indicators on the first tab which is always opened by default:
The first thing to do is to replace feeder class of the UIBB where we want to show the icons (another option is to enhance the standard class). The new class in this case should inherit from the standard one CL_USMD_CR_GUIBB_GENERAL_DATA.
As the icons should be shown/hidden depending on some conditions we should link them to new fields of the form UIBB. The fields can be added in redefinition of method IF_FPM_GUIBB_FORM~GET_DEFINITION like below:
METHOD if_fpm_guibb_form~get_definition. CALL METHOD super->if_fpm_guibb_form~get_definition IMPORTING eo_field_catalog = eo_field_catalog et_field_description = et_field_description et_action_definition = et_action_definition et_special_groups = et_special_groups et_dnd_definition = et_dnd_definition es_options = es_options es_message = es_message ev_additional_error_info = ev_additional_error_info. *>>> add icon fields DATA(lt_component) = eo_field_catalog->get_components( ). APPEND INITIAL LINE TO lt_component ASSIGNING FIELD-SYMBOL(<ls_component>). <ls_component>-name = 'NOTES_ICON'. <ls_component>-type = cl_abap_elemdescr=>get_c( 1 ). APPEND INITIAL LINE TO lt_component ASSIGNING <ls_component>. <ls_component>-name = 'ATTACH_ICON'. <ls_component>-type = cl_abap_elemdescr=>get_c( 1 ). eo_field_catalog = cl_abap_structdescr=>create( lt_component ). APPEND INITIAL LINE TO et_field_description ASSIGNING FIELD-SYMBOL(<ls_fdesc>). <ls_fdesc>-name = 'NOTES_ICON'. <ls_fdesc>-label_text = 'Notes Icon'. <ls_fdesc>-read_only = abap_true. APPEND INITIAL LINE TO et_field_description ASSIGNING <ls_fdesc>. <ls_fdesc>-name = 'ATTACH_ICON'. <ls_fdesc>-label_text = 'Attachments Icon'. <ls_fdesc>-read_only = abap_true. *<<< ENDMETHOD.
The next step is to set visibility of the fields depending on existence of notes/attachment, this can be achieved by redefinition of method CHECK_FIELD_USAGE like below:
METHOD check_field_usage. super->check_field_usage( CHANGING ct_field_usage = ct_field_usage ). * hide/show attachment/notes icons depending if there are any assigned or not DATA: lv_note_visible TYPE wdy_uie_library_enum_type VALUE cl_wd_uielement=>e_visible-none, lv_atch_visible TYPE wdy_uie_library_enum_type VALUE cl_wd_uielement=>e_visible-none. TRY. DATA(lo_conv_api) = cl_usmd_conv_som_gov_api=>get_instance( ). DATA(lt_attachments) = lo_conv_api->get_attachment_list( if_with_content = abap_false ). IF lt_attachments IS NOT INITIAL. lv_atch_visible = cl_wd_uielement=>e_visible-visible. ENDIF. DATA(lt_notes) = lo_conv_api->get_notes( ). IF lt_notes IS NOT INITIAL. lv_note_visible = cl_wd_uielement=>e_visible-visible. ENDIF. CATCH cx_usmd_gov_api. RETURN. " let it go ENDTRY. LOOP AT ct_field_usage ASSIGNING FIELD-SYMBOL(<ls_field_usage>). CASE <ls_field_usage>-name. WHEN 'NOTES_ICON'. <ls_field_usage>-visibility = lv_note_visible. WHEN 'ATTACH_ICON'. <ls_field_usage>-visibility = lv_atch_visible. ENDCASE. ENDLOOP. ENDMETHOD.
Finally we just need to add the icons on the UIBB and link them to the new fields. I did that with UIBB customizing but can be achieved as well with CBA configuration:
Remaining non-standard attributes values of the elements (not visible on the picture above):
|UI Element Width||20||20|
Without the last one the icons are ugly big.
Thanks for the Nice Blog.
this is a great blog and valueable info. The solution is simple but this makes it even more precious.
This is nice, thanks!
This is very nice blog.
Could you please let me know how to add this customised change request, as per our requirement.