Displaying field as icon/image in CRM WebUI

Problem: you want to show a field as an icon/image in CRM WebUI.

Solution: Follow these steps:

1. Add field in the configuration of a view. Field has to cover the entire panel.

2. Generate the GET_P_* method for the field in the context. Put below code in the method:

METHOD get_p_icon.
  CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_image.
  ENDCASE.
ENDMETHOD.
METHOD get_p_icon.
  CASE iv_property.
    WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
      rv_value = cl_bsp_dlc_view_descriptor=>field_type_image.
  ENDCASE.
ENDMETHOD.

3. In the GET_* method return the name of the icon or image you want to show. For example:

METHOD get_icon.
  value = cl_bsp_mimes=>sap_icon( id = 'ICON_CHECKED' ).
ENDMETHOD.
METHOD get_icon.
  value = cl_bsp_mimes=>sap_icon( id = 'ICON_CHECKED' ).
ENDMETHOD.

Komentowanie jest zakończone.