Skip to Content

FPM List UIBB with FBI - How to set cell background color?

Hello!

We use in our application a FPM List ATS UIBB with FBI (Floorplan manager BOPF Integration). Because of FBI usage the standard FBI Feeder Class /BOFU/CL_FBI_GUIBB_LIST_ATS is used.

Can someone tell me how to set the background color of a single cell programatically?

Thanks in advance!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jul 19, 2017 at 06:50 AM

    Hi Volker,

    how It basically works programatically:

    • in the fieldcatalog of your LIST_UIBB you need an extra component (TYPE: WDUI_TABLE_CELL_DESIGN) to provide a color code to 1-n cells. (as you can guess, if different cells within one table row will need different colors, for each color you have to setup an extra component in the fieldcatalog).
    • for the cell to be colored, you have to maintain the field description (method if_fpm_guibb_list~get_definition) to pass the information about where to find the color-reference.
    <ls_field_descr>-cell_design_ref = '<YOUR_EXTRA_COMPONENT>'.
    • in the if_fpm_guibb_list~get_data method you can now set the color code to your extra component(s) as you like to.

    ------------------------------------------------------------------

    In your specific case (I don't know /BOFU/CL_FBI_GUIBB_LIST_ATS - so this is just a quick guess how it could work!!!):

    Because you will have to implement some code, I would recommend to create a subclass of /BOFU/CL_FBI_GUIBB_LIST_ATS and redefine the methods if_fpm_guibb_list~get_definition and if_fpm_guibb_list~get_definition. In each redefinition call the super method first to keep the standard implementation working! After the call of the super method you will have to create some extra coding to get the cells colored.

    ------------------------------------------------------------------

    things to implement:

    if_fpm_guibb_list~get_definition:

    data: lt_comp type abap_structdescr=>component_table
    ,     ls_comp like line of lt_comp
    .
    
    field-symbols: <ls_field_descr> like line of et_field_description.
    
    " super call
    super->if_fpm_guibb_list~get_definition( ... ).
    
    " Get the current fieldcatalog
    lt_comp = eo_field_catalog->get_components( ).
    
    " setup the extra component 
    clear ls_comp.
    ls_comp-name  = '<YOUR_EXTRA_COMP>'.
    ls_comp-type ?= cl_abap_typedescr=>describe_by_name( 'WDUI_TABLE_CELL_DESIGN' ).
    append ls_comp to lt_comp.
    
    " extend the fiedcatalog with the new component
    eo_field_catalog ?= cl_abap_structdescr=>create( p_components = lt_comp ).
    
    " assign the color reference to the cell to be colored
    " (I assume that the std. implementation already maintains the field description for the std. columns)
    read table et_field_description assigning <ls_field_descr> with key name = '<COL_TO_BE_COLORED>'.
    if sy-subrc eq 0.
      <ls_field_descr>-cell_design_ref = '<YOUR_EXTRA_COMP>'.
    endif.

    --> You don't need to do the structure-extension via code if you know the DDIC type of the list structure exactly and its extendible. In this case you can extend the field catalog by using a z-append. But assuming that the /BOFU/CL_FBI_GUIBB_LIST_ATS feeder is used for dynamic UI creation and therefore the DDIC type might change depending on the business case, I would go the above shown way.

    if_fpm_guibb_list~get_data:

    field-symbols: <ls_data>  type data
    ,              <lv_color> type WDUI_TABLE_CELL_DESIGN
    .
    
    " super call
    super->if_fpm_guibb_list~get_data( ... ).
    
    " set the color
    loop at ct_data assigning <ls_data>.
      assign component '<YOUR_EXTRA_COMP>' of structure <ls_data> to <lv_color>.
      if sy-subrc eq 0.
        <lv_color> = 61. " --> cold_blue
      endif.
    endloop.
    if sy-subrc eq 0.
      ev_data_changed = abap_true.
    endif. 

    I don't know if the code is working, because I just wrote it down here in the editor, but just give it a try ;-)

    @EDIT:

    To get this working, you will have to set the newly created feeder in your LIST_UIBB configuration ... if its a sap configuration you can do this by enhancing the configuration in the FLUID editor.

    regards

    Fabian

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 27, 2017 at 10:43 AM

    Hello Fabian!

    That works. I modified the fieldcatalog of list UIBB (type WDUI_TABLE_CELL_DESIGN) as you recommended, than I implemented /BOFU/IF_FBI_VIEW_EXITINTF_DEF~adapt_fields of the "Exit Intfce Class" to set the cell_design_ref (<ls_field_descr>-cell_design_ref ='<YOUR_EXTRA_COMPONENT>'.) of the attribute I want to colorize.

    And last, in the method /BOFU/IF_FBI_VIEW_EXITINTF_RUN~adapt_data of the "Exit Intfce Class" I set the color of each cell.

    Thanks a lot

    Volker

    Add comment
    10|10000 characters needed characters exceeded