$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
0

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

Jun 20, 2017 at 02:18 PM

63

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sandra Rossi Jun 21, 2017 at 06:13 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded