Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a columm color in a alv factory class.

Former Member
0 Kudos

How to set a column name a color like green usign alv factory.

i have this code:

"Classe para Criação do ALV.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = r_table
CHANGING
t_table = it_tab.

"ALV TOOLBAR

DATA lo_sel TYPE REF TO cl_salv_selections.

lo_sel = r_table->get_selections( ).
lo_sel->set_selection_mode( if_salv_c_selection_mode=>row_column ).

"Toolbar icones
r_functions = r_table->get_functions( ).
r_functions->set_all( abap_true ).

DATA lo_columns TYPE REF TO cl_salv_columns_table.
lo_columns = r_table->get_columns( ).

" ALV LINE COLOUR
DATA: gr_display TYPE REF TO cl_salv_display_settings.
gr_display = r_table->get_display_settings( ).
gr_display->set_striped_pattern( cl_salv_display_settings=>true ).

* TRY.
*
* lo_col_tab ?= lo_cols_tab->get_column( 'BUTXT' ).
* ls_color-col = col_total.
* lo_col_tab->set_color( ls_color ).
* CATCH cx_salv_not_found.
* ENDTRY.





"HEADER
DATA: gr_display2 TYPE REF TO cl_salv_display_settings.
gr_display = r_table->get_display_settings( ).
gr_display->set_list_header( text-003 ).


r_functions = r_table->get_functions( ).
r_functions->set_all( abap_true ).


r_table->display( ).

Thank you

1 REPLY 1

Sandra_Rossi
Active Contributor
0 Kudos

In your code, you have used

ls_color-col = col_total.

Did you search the web?

Fields of LVC_S_COLO are COL, INT, INV, with these possible values:

color code (from 0 to 7)  
  0 = background color  
  1 = blue  
  2 = gray  
  3 = yellow  
  4 = blue/gray  
  5 = green  
  6 = red  
  7 = orange  
intensified (0=off, 1=on)  
inverse display (0=off, 1=on)S

So, please try yourself.