Hi Oliver,
Great to hear you once more, i guess now you know how to color cell text with the help of thread
, for background cell color just prepare the HTML code as below,
CASE p_column_key.
WHEN 'DESCRIPTION'. "// Field (or Colunm) name
READ TABLE me->gt_result INTO ls_order INDEX p_row_index.
IF sy-subrc NE 0.
EXIT."==============>>>
ENDIF.
ASSIGN COMPONENT p_column_key OF STRUCTURE ls_order TO <col>.
IF sy-subrc = 0.
wf_text = <col>."// Field value
ENDIF.
CASE wf_text. "// Field value
WHEN 'TESTING'. "// Field value
CONCATENATE '<span style="background-color:#00FF00">' wf_text '</span>'
INTO html_str. "// Setting background color for particular column
CREATE OBJECT html_bee.
html_bee->add( html = html_str ).
p_replacement_bee = html_bee.
WHEN 'TEST'. "// Field value
CONCATENATE '<span style="background-color:YELLOW">' wf_text '</span>'
INTO html_str. "// Setting background color for particular column
CREATE OBJECT html_bee.
html_bee->add( html = html_str ).
p_replacement_bee = html_bee.
WHEN 'TEST123'. "// Field value
CONCATENATE '<span style="background-color:RED">' wf_text '</span>'
INTO html_str. "// Setting background color for particular column
CREATE OBJECT html_bee.
html_bee->add( html = html_str ).
p_replacement_bee = html_bee.
WHEN 'HI'. "// Field value
CONCATENATE '<span style="background-color:PINK">' wf_text '</span>'
INTO html_str. "// Setting background color for particular column
CREATE OBJECT html_bee.
html_bee->add( html = html_str ).
p_replacement_bee = html_bee.
ENDCASE.
ENDCASE.
NOTE: The table GT_RESULT will contain the table view records.
Be careful WHEN 'DESCRIPTION' always taking the search result’s field
name and WF_TEXT = 'TESTING' is taking the search result’s field value (in my
case).
Please feel free to query again
Regards,
Vishal.