Skip to Content
0
Nov 24, 2011 at 06:57 PM

How to colour specific rows within an WebDynpro ALV

211 Views

Hi everyone,

I need to colour only specific rows of an ALV. I've already scoured sdn and implemented the solutions that I found but none of them seems to be working okay.

I have an ALV table and I want to highlight only a few rows based on a certain logic.

I've defined a context node that defines 2 attributes: textview_design and cell_design.

  LOOP AT ft_out_purchase_order_temp INTO ls_out_purchase_order_temp.

  if ....
    ls_out_purchase_order_temp-textview_design =  cl_wd_text_view=>e_design-standard.
    ls_out_purchase_order_temp-cell_design = cl_wd_table_column=>e_cell_design-standard.
  else.
      ls_out_purchase_order_temp-cell_design =  cl_wd_table_column=>e_cell_design-total.
      ls_out_purchase_order_temp-textview_design =  cl_wd_text_view=>e_design-emphasized.
  endif.

ENDLOOP.

  lr_column_settings ?= po_alv_config_table.
  lr_column = lr_column_settings->get_column( 'EBELN' ).
  lr_column = po_alv_config_table->if_salv_wd_column_settings~get_column( 'EBELN' ).
  lr_column->set_cell_design_fieldname( value = 'CELL_DESIGN' ).

This code works but the thing is that the whole column named 'EBELN' is coloured light green. This is strange because I've instructed the system that the design of the column EBELN is controlled by the field CELL_DESIGN and this field has the following values:

10 (light green)

33 (light blue)

10

10

10

33

10

33

...

Any ideas?