09-10-2009 6:20 PM
Hello,
Is there a way I could change the color of a cell using the class "cl_salv_column_table", I wanted to make all the cells that have let say value of 10 to be in red.
Thanks in advanced.
09-10-2009 10:11 PM
Hello Ricky
You should have a look at sample report SALV_DEMO_TABLE_COLUMNS:
...
*... §5.2 set the color of a complete row
* (2) set the color information to the row in the output
* table.
* note: do not fill the parameter FNAME for setting the
* color of the complete row
* fill the parameter FNAME for setting the color
* of a cell (Row and Column are definied)
clear lt_color.
clear ls_color.
ls_color-fname = 'PRICE'.
ls_color-color-col = col_negative.
ls_color-color-int = 0.
ls_color-color-inv = 0.
append ls_color to lt_color.
ls_color-fname = 'FLDATE'.
ls_color-color-col = col_positive.
ls_color-color-int = 0.
ls_color-color-inv = 0.
append ls_color to lt_color.
<ls_outtab>-t_color = lt_color.
clear lt_celltype.
clear ls_celltype.
ls_celltype-columnname = space.
ls_celltype-value = if_salv_c_cell_type=>text.
append ls_celltype to lt_celltype.
<ls_outtab>-t_celltype = lt_celltype.
endcase.
...
...
*... §5.2 set the color of a complete row
* (1) register the column in which the color information
* for the row is held
try.
lr_columns->set_color_column( 'T_COLOR' ).
catch cx_salv_data_error. "#EC NO_HANDLER
endtry.
...
Regards
Uwe
09-10-2009 6:31 PM
09-10-2009 6:58 PM
Thanks for the quick reply, but this is the other way of doing ALV output, I was expecting something about using this specific class (cl_salv_column_table).
Edited by: Ricky Orea on Sep 10, 2009 10:58 AM
09-10-2009 10:11 PM
Hello Ricky
You should have a look at sample report SALV_DEMO_TABLE_COLUMNS:
...
*... §5.2 set the color of a complete row
* (2) set the color information to the row in the output
* table.
* note: do not fill the parameter FNAME for setting the
* color of the complete row
* fill the parameter FNAME for setting the color
* of a cell (Row and Column are definied)
clear lt_color.
clear ls_color.
ls_color-fname = 'PRICE'.
ls_color-color-col = col_negative.
ls_color-color-int = 0.
ls_color-color-inv = 0.
append ls_color to lt_color.
ls_color-fname = 'FLDATE'.
ls_color-color-col = col_positive.
ls_color-color-int = 0.
ls_color-color-inv = 0.
append ls_color to lt_color.
<ls_outtab>-t_color = lt_color.
clear lt_celltype.
clear ls_celltype.
ls_celltype-columnname = space.
ls_celltype-value = if_salv_c_cell_type=>text.
append ls_celltype to lt_celltype.
<ls_outtab>-t_celltype = lt_celltype.
endcase.
...
...
*... §5.2 set the color of a complete row
* (1) register the column in which the color information
* for the row is held
try.
lr_columns->set_color_column( 'T_COLOR' ).
catch cx_salv_data_error. "#EC NO_HANDLER
endtry.
...
Regards
Uwe