on 08-22-2013 1:30 PM
Hi Guys,
until now I could change the font color of the text inside a cell to red by using the following code:
CONCATENATE '<font color="red">' ls_ci_ti_compare-ci_value '</font>' INTO html_string.
CREATE OBJECT html_bee.
html_bee->add( html = html_string ).
p_replacement_bee = html_bee.
Can anybody tell me how is the code to set the background colour to red? I need really a code example how to
fill the variable html_string?
Thank you,
Oliver
Hi Oliver,
Great to hear you once more, i guess now you know how to color cell text with the help of threadhttp://scn.sap.com/message/14295856 , 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Vishal,
Is any way how to make the row with color not just one cell.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It will look like :-
concatenate '<span style="background-color:#FFFF00;font-weight:bold">' LV_DATA
'</span>' into html_str.
create object html_bee.
html_bee->add( html = html_str ).
For more info Check below threads:
http://scn.sap.com/thread/3164090
http://scn.sap.com/thread/2128064
http://scn.sap.com/message/11135446
Thanks
Kumar Gaurav.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
4 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.