<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cell color in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607078#M272413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some simple steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)add a field to your output table&lt;/P&gt;&lt;P&gt;line_color(4) type c,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Do programmatically what you need to do and specify the colour you want for each row.&lt;/P&gt;&lt;P&gt;e.g &lt;/P&gt;&lt;P&gt;if &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;itab-line_colour = 'C210'&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;how you get this is &lt;/P&gt;&lt;P&gt;Char 1 = C (This is a color property)&lt;/P&gt;&lt;P&gt;Char 2 = 3 (Color codes: 1 - 7)&lt;/P&gt;&lt;P&gt;Char 3 = Intensified on/off ( 1 or 0 )&lt;/P&gt;&lt;P&gt;Char 4 = Inverse display on/off ( 1 or 0 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3 Define the layout with&lt;/P&gt;&lt;P&gt;ws_layout-info_fieldname =  'LINE_COLOR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will enable you to set the colour for various conditions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Oct 2006 13:43:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-13T13:43:17Z</dc:date>
    <item>
      <title>Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607076#M272411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to color a particular cell in ALV display by using methods sET_TABLE_FOR_FIRST_DISPLAY  ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;johnn.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 13:29:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607076#M272411</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T13:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607077#M272412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a short example program which shows how to color a row, column, or cell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0002 .

*****************************************************************
* Use of colours in ALV grid (cell, line and column)            *
*****************************************************************

* Table
tables : mara.

* Type
types : begin of ty_mara,
          matnr         like mara-matnr,
          matkl         like mara-matkl,
          counter(4)    type n,
          free_text(15) type c,
          color_line(4) type c,           " Line color
          color_cell    type lvc_t_scol,  " Cell color
end of ty_mara.

* Structures
data  : wa_mara     type ty_mara,
        wa_fieldcat type lvc_s_fcat,
        is_layout   type lvc_s_layo,
        wa_color    type lvc_s_scol.

* Internal table
data : it_mara     type standard table of ty_mara,
       it_fieldcat type standard table of lvc_s_fcat,
       it_color    type table          of lvc_s_scol.

* Variables
data : okcode like sy-ucomm,
       w_alv_grid          type ref to cl_gui_alv_grid,
       w_docking_container type ref to cl_gui_docking_container.


parameters : p_column as checkbox,
             p_line   as checkbox,
             p_cell   as checkbox.

at selection-screen output.

  perform get_data.
  perform fill_catalog.

  if w_docking_container is initial.
    perform create_objects.
  endif.

*&amp;amp;--------------------------------------------------------------*
*&amp;amp;      Form  create_objects
*&amp;amp;--------------------------------------------------------------*
form create_objects.

  create object w_docking_container
    exporting
      ratio                       = 60
    exceptions
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      lifetime_dynpro_dynpro_link = 5
      others                      = 6.

  create object w_alv_grid
    exporting
      i_parent          = w_docking_container.

* Field that identify color line in internal table
  move 'COLOR_LINE' to is_layout-info_fname.

* Field that identify cell color in inetrnal table
  move 'COLOR_CELL' to is_layout-ctab_fname.

  call method w_alv_grid-&amp;gt;set_table_for_first_display
    exporting
      is_layout                     = is_layout
    changing
      it_outtab                     = it_mara
      it_fieldcatalog               = it_fieldcat
    exceptions
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      others                        = 4.

endform.
*&amp;amp;--------------------------------------------------------------*
*&amp;amp;      Form  get_data
*&amp;amp;--------------------------------------------------------------*
form get_data.

  select * from mara up to 5 rows.
    clear : wa_mara-color_line, wa_mara-color_cell.

    move-corresponding mara to wa_mara.
    add 1                   to wa_mara-counter.
    move 'Blabla'           to wa_mara-free_text.

    if wa_mara-counter = '0002'
    and p_line = 'X'.
* Color line
      move 'C410' to wa_mara-color_line.
    elseif wa_mara-counter = '0004'
    and p_cell = 'X'.
* Color cell
      move 'FREE_TEXT' to wa_color-fname.
      move '6'         to wa_color-color-col.
      move '1'         to wa_color-color-int.
      move '1'         to wa_color-color-inv.
      append wa_color to it_color.
      wa_mara-color_cell[] = it_color[].
    endif.

    append wa_mara to it_mara.
  endselect.

endform.
*&amp;amp;--------------------------------------------------------------*
*&amp;amp;      Form  fill_catalog
*&amp;amp;--------------------------------------------------------------*
form fill_catalog.

*****************************************************************
* Colour code :                                                 *
* Colour is a 4-char field where :                              *
*              - 1st char = C (color property)                  *
*              - 2nd char = color code (from 0 to 7)            *
*                                  0 = background color         *
*                                  1 = blue                     *
*                                  2 = gray                     *
*                                  3 = yellow                   *
*                                  4 = blue/gray                *
*                                  5 = green                    *
*                                  6 = red                      *
*                                  7 = orange                   *
*              - 3rd char = intensified (0=off, 1=on)           *
*              - 4th char = inverse display (0=off, 1=on)       *
*                                                               *
* Colour overwriting priority :                                 *
*   1. Line                                                     *
*   2. Cell                                                     *
*   3. Column                                                   *
*****************************************************************
  data : w_position type i value '1'.

  clear wa_fieldcat.
  move w_position to wa_fieldcat-col_pos.
  move 'MATNR'    to wa_fieldcat-fieldname.
  move 'MARA'     to wa_fieldcat-ref_table.
  move 'MATNR'    to wa_fieldcat-ref_field.
  append wa_fieldcat to it_fieldcat.

  add 1 to w_position.

  clear wa_fieldcat.
  move w_position to wa_fieldcat-col_pos.
  move 'MATKL'    to wa_fieldcat-fieldname.
  move 'MARA'     to wa_fieldcat-ref_table.
  move 'MATKL'    to wa_fieldcat-ref_field.
* Color column
  if p_column = 'X'.
    move 'C610'     to wa_fieldcat-emphasize.
  endif.
  append wa_fieldcat to it_fieldcat.

  add 1 to w_position.

  clear wa_fieldcat.
  move w_position to wa_fieldcat-col_pos.
  move 'COUNTER'  to wa_fieldcat-fieldname.
  move 'N'        to wa_fieldcat-inttype.
  move '4'        to wa_fieldcat-intlen.
  move 'Counter'  to wa_fieldcat-coltext.
  append wa_fieldcat to it_fieldcat.

  add 1 to w_position.

  clear wa_fieldcat.
  move w_position  to wa_fieldcat-col_pos.
  move 'FREE_TEXT' to wa_fieldcat-fieldname.
  move 'C'         to wa_fieldcat-inttype.
  move '20'        to wa_fieldcat-intlen.
  move 'Text'      to wa_fieldcat-coltext.
  append wa_fieldcat to it_fieldcat.

endform.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 13:33:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607077#M272412</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-10-13T13:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607078#M272413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some simple steps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)add a field to your output table&lt;/P&gt;&lt;P&gt;line_color(4) type c,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Do programmatically what you need to do and specify the colour you want for each row.&lt;/P&gt;&lt;P&gt;e.g &lt;/P&gt;&lt;P&gt;if &amp;lt;condition&amp;gt;.&lt;/P&gt;&lt;P&gt;itab-line_colour = 'C210'&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;how you get this is &lt;/P&gt;&lt;P&gt;Char 1 = C (This is a color property)&lt;/P&gt;&lt;P&gt;Char 2 = 3 (Color codes: 1 - 7)&lt;/P&gt;&lt;P&gt;Char 3 = Intensified on/off ( 1 or 0 )&lt;/P&gt;&lt;P&gt;Char 4 = Inverse display on/off ( 1 or 0 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3 Define the layout with&lt;/P&gt;&lt;P&gt;ws_layout-info_fieldname =  'LINE_COLOR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will enable you to set the colour for various conditions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 13:43:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607078#M272413</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T13:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607079#M272414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assign a variable celltab TYPE lvc_t_styl, in the internal table which u dispaly the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the layout give, wa_layout-stylefname = 'CELLTAB'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the final table before showing the data do like the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : lt_celltab TYPE lvc_t_styl,&lt;/P&gt;&lt;P&gt;ls_celltab TYPE lvc_s_styl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE i_final_data INTO wa_final_data INDEX 1.&lt;/P&gt;&lt;P&gt;ls_celltab-fieldname = 'LNG_TYPES'.&lt;/P&gt;&lt;P&gt;ls_celltab-style = '00000060'.&lt;/P&gt;&lt;P&gt;INSERT ls_celltab INTO TABLE lt_celltab.&lt;/P&gt;&lt;P&gt;CLEAR ls_celltab.&lt;/P&gt;&lt;P&gt;ls_celltab-fieldname = 'LNG_QUANTITY'.&lt;/P&gt;&lt;P&gt;ls_celltab-style = '00003060'.&lt;/P&gt;&lt;P&gt;INSERT ls_celltab INTO TABLE lt_celltab.&lt;/P&gt;&lt;P&gt;CLEAR ls_celltab.&lt;/P&gt;&lt;P&gt;ls_celltab-fieldname = 'NG_TYPES'.&lt;/P&gt;&lt;P&gt;ls_celltab-style = '00000666'.&lt;/P&gt;&lt;P&gt;INSERT ls_celltab INTO TABLE lt_celltab.&lt;/P&gt;&lt;P&gt;CLEAR ls_celltab.&lt;/P&gt;&lt;P&gt;ls_celltab-fieldname = 'NG_QUANTITY'.&lt;/P&gt;&lt;P&gt;ls_celltab-style = '00000066'.&lt;/P&gt;&lt;P&gt;INSERT ls_celltab INTO TABLE lt_celltab.&lt;/P&gt;&lt;P&gt;CLEAR ls_celltab.&lt;/P&gt;&lt;P&gt;wa_final_data-celltab[] = lt_celltab[].&lt;/P&gt;&lt;P&gt;MODIFY i_final_data FROM wa_final_data INDEX 1.&lt;/P&gt;&lt;P&gt;CLEAR: ls_celltab, lt_celltab, wa_final_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here ls_celltab-style = '00000066' or '00000060' gives the color for a particular cell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read the row which u want to make cell colored. For that row, append the field name and style into ls_celltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ls_celltab-fieldname = 'LNG_TYPES'.&lt;/P&gt;&lt;P&gt;ls_celltab-style = '00003040'.&lt;/P&gt;&lt;P&gt;INSERT ls_celltab INTO TABLE lt_celltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_final_data-celltab[] = lt_celltab[].&lt;/P&gt;&lt;P&gt;So that the particular cell will become colored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do as follows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. declare one field say color in the output table of type SLIS_T_SPECIALCOL_ALV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Also declare a table color like &lt;/P&gt;&lt;P&gt;DATA COLOR TYPE SLIS_T_SPECIALCOL_ALV WITH HEADER LINE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. After you have filled the field catalog do like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_ALV_DATA.&lt;/P&gt;&lt;P&gt;IF SY-TABIX = 2.&lt;/P&gt;&lt;P&gt;COLOR-FIELDNAME = 'POSNR'.&lt;/P&gt;&lt;P&gt;COLOR-COLOR-COL = 6.&lt;/P&gt;&lt;P&gt;COLOR-COLOR-INT = 0.&lt;/P&gt;&lt;P&gt;APPEND COLOR.&lt;/P&gt;&lt;P&gt;IT_ALV_DATA-COLOR = COLOR[].&lt;/P&gt;&lt;P&gt;MODIFY IT_ALV_DATA.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prakash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Oct 2006 13:52:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607079#M272414</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-13T13:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607080#M272415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is Great Program but could you modify this for following Hirarchial ALV. I tried but i am not getting color changed for the Cell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'&lt;/P&gt;&lt;P&gt; exporting&lt;/P&gt;&lt;P&gt;  is_layout = gd_layout&lt;/P&gt;&lt;P&gt;  it_fieldcat = g_fieldcat&lt;/P&gt;&lt;P&gt;  i_tabname_header = 'WA_HEADER'&lt;/P&gt;&lt;P&gt;  i_tabname_item = 'WA_ITEM'&lt;/P&gt;&lt;P&gt;  is_keyinfo = wa_keyinfo&lt;/P&gt;&lt;P&gt;  is_variant             = l_variant&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;  t_outtab_header = it_header1&lt;/P&gt;&lt;P&gt;  t_outtab_item = it_item1&lt;/P&gt;&lt;P&gt;  exceptions&lt;/P&gt;&lt;P&gt;  program_error = 1&lt;/P&gt;&lt;P&gt;  others = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2007 00:07:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607080#M272415</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-24T00:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607081#M272416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John similar to your requirement only i also got the requirement after working some times i got the solutions the demo report of that one i have written down if you need you can go through it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS : slis .&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF type_vbrk ,&lt;/P&gt;&lt;P&gt;          vbeln TYPE vbrk-vbeln ,&lt;/P&gt;&lt;P&gt;          netwr TYPE vbrk-netwr ,&lt;/P&gt;&lt;P&gt;          cellcolor TYPE lvc_t_scol ,&lt;/P&gt;&lt;P&gt;        END OF type_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : type_t_vbrk TYPE STANDARD TABLE OF type_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : wa_vbrk TYPE type_vbrk ,&lt;/P&gt;&lt;P&gt;       it_vbrk TYPE type_t_vbrk ,&lt;/P&gt;&lt;P&gt;       it_fieldcat TYPE slis_t_fieldcat_alv ,&lt;/P&gt;&lt;P&gt;       wa_fieldcat TYPE slis_fieldcat_alv ,&lt;/P&gt;&lt;P&gt;       wa_layout TYPE slis_layout_alv .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION .&lt;/P&gt;&lt;P&gt;  CLEAR wa_vbrk .&lt;/P&gt;&lt;P&gt;  wa_vbrk-vbeln = '121212' .&lt;/P&gt;&lt;P&gt;  wa_vbrk-netwr = '12.22' .&lt;/P&gt;&lt;P&gt;  APPEND wa_vbrk TO it_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_vbrk .&lt;/P&gt;&lt;P&gt;  wa_vbrk-vbeln = '121213' .&lt;/P&gt;&lt;P&gt;  wa_vbrk-netwr = '-12.22' .&lt;/P&gt;&lt;P&gt;  APPEND wa_vbrk TO it_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_vbrk .&lt;/P&gt;&lt;P&gt;  wa_vbrk-vbeln = '10001' .&lt;/P&gt;&lt;P&gt;  wa_vbrk-netwr = '-16.22' .&lt;/P&gt;&lt;P&gt;  APPEND wa_vbrk TO it_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_vbrk .&lt;/P&gt;&lt;P&gt;  wa_vbrk-vbeln = '10002' .&lt;/P&gt;&lt;P&gt;  wa_vbrk-netwr = '36.22' .&lt;/P&gt;&lt;P&gt;  APPEND wa_vbrk TO it_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_vbrk .&lt;/P&gt;&lt;P&gt;  wa_vbrk-vbeln = '101012' .&lt;/P&gt;&lt;P&gt;  wa_vbrk-netwr = '-32.22' .&lt;/P&gt;&lt;P&gt;  APPEND wa_vbrk TO it_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_vbrk .&lt;/P&gt;&lt;P&gt;  wa_vbrk-vbeln = '121219' .&lt;/P&gt;&lt;P&gt;  wa_vbrk-netwr = '-45.00' .&lt;/P&gt;&lt;P&gt;  APPEND wa_vbrk TO it_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_vbrk .&lt;/P&gt;&lt;P&gt;  wa_vbrk-vbeln = '1125212' .&lt;/P&gt;&lt;P&gt;  wa_vbrk-netwr = '92.22' .&lt;/P&gt;&lt;P&gt;  APPEND wa_vbrk TO it_vbrk .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- SETTING THE CELL COLOR&lt;/P&gt;&lt;P&gt;  DATA: wa_cellcolor TYPE lvc_s_scol ,&lt;/P&gt;&lt;P&gt;        ld_index TYPE sy-tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT it_vbrk INTO wa_vbrk .&lt;/P&gt;&lt;P&gt;    ld_index = sy-tabix.&lt;/P&gt;&lt;P&gt;    IF wa_vbrk-netwr &amp;lt; 0 .&lt;/P&gt;&lt;P&gt;      wa_cellcolor-fname = 'NETWR'.&lt;/P&gt;&lt;P&gt;      wa_cellcolor-color-col = 6 .  "color code 1-7, if outside rage defaults to 7&lt;/P&gt;&lt;P&gt;      wa_cellcolor-color-int = '1' .  "1 = Intensified on, 0 = Intensified off&lt;/P&gt;&lt;P&gt;      wa_cellcolor-color-inv = '0' .  "1 = text colour, 0 = background colour&lt;/P&gt;&lt;P&gt;      APPEND wa_cellcolor TO wa_vbrk-cellcolor.&lt;/P&gt;&lt;P&gt;      MODIFY it_vbrk FROM wa_vbrk INDEX ld_index TRANSPORTING cellcolor.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_fieldcat .&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos = 1 .&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname = 'VBELN' .&lt;/P&gt;&lt;P&gt;  wa_fieldcat-tabname = 'IT_VBRK' .&lt;/P&gt;&lt;P&gt;  wa_fieldcat-seltext_m = 'Invoice Number' .&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_fieldcat .&lt;/P&gt;&lt;P&gt;  wa_fieldcat-col_pos = 2 .&lt;/P&gt;&lt;P&gt;  wa_fieldcat-fieldname = 'NETWR' .&lt;/P&gt;&lt;P&gt;  wa_fieldcat-tabname = 'IT_VBRK' .&lt;/P&gt;&lt;P&gt;  wa_fieldcat-seltext_m = 'Net Value' .&lt;/P&gt;&lt;P&gt;  APPEND wa_fieldcat TO it_fieldcat .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wa_layout-zebra = 'X' .&lt;/P&gt;&lt;P&gt;  wa_layout-colwidth_optimize = 'X' .&lt;/P&gt;&lt;P&gt;  wa_layout-coltab_fieldname = 'CELLCOLOR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;P&gt;     i_callback_program                = sy-repid&lt;/P&gt;&lt;P&gt;     i_grid_title                      = 'Supress Negative Values'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     I_GRID_SETTINGS                   =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;     is_layout                         = wa_layout&lt;/P&gt;&lt;P&gt;     it_fieldcat                       = it_fieldcat&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      t_outtab                          = it_vbrk&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     PROGRAM_ERROR                     = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     OTHERS                            = 2&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            .&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 11:08:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607081#M272416</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-20T11:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607082#M272417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ALL,&lt;/P&gt;&lt;P&gt;bellow you can see a simple code about how to change a cell color in ALV .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; TYPES: BEGIN OF wa_out .&lt;/P&gt;&lt;P&gt;    INCLUDE STRUCTURE ZPP_BARCODE .&lt;/P&gt;&lt;P&gt;   TYPES : cellcolors TYPE lvc_t_scol ,&lt;/P&gt;&lt;P&gt;   SERNR TYPE objk-SERNR ,&lt;/P&gt;&lt;P&gt;   VORNR TYPE afru-VORNR  ,&lt;/P&gt;&lt;P&gt;   ROWNO TYPE i ,&lt;/P&gt;&lt;P&gt;   end of wa_out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  data: w_cellcolor TYPE lvc_s_scol. "For cell color .&lt;/P&gt;&lt;P&gt;  data:   gt_out  TYPE STANDARD TABLE OF wa_out , " table for ALV output &lt;/P&gt;&lt;P&gt;          wa_out1 type wa_out ,&lt;/P&gt;&lt;P&gt;P_INDX  type I .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- first : append data to  gt_out  table &lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------" /&gt;&lt;P&gt;now , you can modify  table for coloring cell&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR W_CELLCOLOR.&lt;/P&gt;&lt;P&gt;P_INDX   = 10  ."-----for coloring a cell in row 10 &lt;/P&gt;&lt;P&gt;  W_CELLCOLOR-FNAME =  FNAME . "field name for example cell for material -&amp;gt;matnr &lt;/P&gt;&lt;P&gt;  W_CELLCOLOR-COLOR-COL = '6'. "color&lt;/P&gt;&lt;P&gt;  W_CELLCOLOR-COLOR-INT = '1'.&lt;/P&gt;&lt;P&gt;  W_CELLCOLOR-COLOR-INV = '1'.&lt;/P&gt;&lt;P&gt;  APPEND W_CELLCOLOR TO WA_OUT1-CELLCOLORS.&lt;/P&gt;&lt;P&gt;  MODIFY GT_OUT FROM WA_OUT1 INDEX P_INDX  TRANSPORTING CELLCOLORS.&lt;/P&gt;&lt;P&gt;. ...&lt;/P&gt;&lt;P&gt;..&lt;/P&gt;&lt;P&gt;,,&lt;/P&gt;&lt;P&gt;,,,,,&lt;/P&gt;&lt;P&gt;CALL METHOD gi_grid-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        is_variant           = ls_variant&lt;/P&gt;&lt;P&gt;        i_save               = lv_save&lt;/P&gt;&lt;P&gt;        is_layout            = ls_layout&lt;/P&gt;&lt;P&gt;        it_toolbar_excluding = lt_exclude&lt;/P&gt;&lt;P&gt;      CHANGING&lt;/P&gt;&lt;P&gt;        it_outtab            =  gt_out &lt;/P&gt;&lt;P&gt;        it_fieldcatalog      = lt_fcat&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        OTHERS               = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards ,&lt;/P&gt;&lt;P&gt;REZA ROSTAMI / ABAP / MAPNA &lt;/P&gt;&lt;P&gt;2011.09 .26&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 12:23:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607082#M272417</guid>
      <dc:creator>former_member211857</dc:creator>
      <dc:date>2011-09-26T12:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607083#M272418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See the following example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DEFINE m_fieldcat.
  add 1 to ls_fieldcat-col_pos.
  ls_fieldcat-fieldname   = &amp;amp;1.
  ls_fieldcat-ref_tabname = &amp;amp;2.
  append ls_fieldcat to lt_fieldcat.
END-OF-DEFINITION.
TYPE-POOLS: slis.                      " ALV Global types

SELECTION-SCREEN :
  SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.    
PARAMETERS p_max(2) TYPE n DEFAULT '30' OBLIGATORY.       
SELECTION-SCREEN END OF LINE.
TYPES :
  BEGIN OF ty_data,
    vkorg TYPE vbak-vkorg,             " Sales organization
    kunnr TYPE vbak-kunnr,             " Sold-to party
    vbeln TYPE vbak-vbeln,             " Sales document
    netwr TYPE vbak-netwr,             " Net Value of the Sales Order
  END OF ty_data,
BEGIN OF ty_vbak,
    vkorg TYPE vbak-vkorg,             " Sales organization
    kunnr TYPE vbak-kunnr,             " Sold-to party
    vbeln TYPE vbak-vbeln,             " Sales document
    netwr TYPE vbak-netwr,             " Net Value of the Sales Order
    tabcolor TYPE lvc_t_scol,          " Cell Color
  END OF ty_vbak.
DATA:
  gt_data TYPE TABLE OF ty_data,
gt_vbak TYPE TABLE OF ty_vbak.
INITIALIZATION.

  v_1 = 'Maximum of records to read'. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 13:01:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607083#M272418</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-28T13:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607084#M272419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Continue........&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
START-OF-SELECTION.
  PERFORM read_data.
  PERFORM fill_color.
  PERFORM display_data.
FORMread_data.

  SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_data
           FROM vbak UP TO p_max ROWS.

ENDFORM.   
FORM fill_color.

  DATA :
    ls_data TYPE ty_data,
    ls_vbak TYPE ty_vbak.

  LOOP AT gt_data INTO ls_data.

    CLEAR ls_vbak.
    MOVE-CORRESPONDING ls_data TO ls_vbak.

    PERFORM f_modify_color USING 'NETWR' CHANGING ls_vbak.
    PERFORM f_modify_color USING 'VBELN' CHANGING ls_vbak.

*   Fill gt_vbak
    APPEND ls_vbak TO gt_vbak.

  ENDLOOP.

ENDFORM.           

FORM f_modify_color USING u_fieldname TYPE lvc_fname
                 CHANGING us_vbak     TYPE ty_vbak.

  DATA :
    l_rnd_value TYPE integer2,
    ls_tabcolor TYPE lvc_s_scol.

* Random value
  CALL FUNCTION 'RANDOM_I2'
       EXPORTING
            rnd_min   = 0
            rnd_max   = 3
       IMPORTING
            rnd_value = l_rnd_value.

  CLEAR ls_tabcolor.
  ls_tabcolor-fname = u_fieldname.

  CASE l_rnd_value.
    WHEN 0.
      ls_tabcolor-color-col = 1.       " Blue.
      ls_tabcolor-color-int = 0.
      ls_tabcolor-color-inv = 0.
    WHEN 1.
      ls_tabcolor-color-col = 3.       " Yellow.
      ls_tabcolor-color-int = 0.
      ls_tabcolor-color-inv = 0.
    WHEN 2.
      ls_tabcolor-color-col = 5.       " Green.
      ls_tabcolor-color-int = 0.
      ls_tabcolor-color-inv = 0.
    WHEN 3.
      ls_tabcolor-color-col = 6.       " Red.
      ls_tabcolor-color-int = 0.
      ls_tabcolor-color-inv = 0.
  ENDCASE.

  INSERT ls_tabcolor INTO TABLE us_vbak-tabcolor.

ENDFORM.                        
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 13:03:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607084#M272419</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-28T13:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cell color</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607085#M272420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Continue........&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FORM display_data.

  DATA:
    ls_layout   TYPE slis_layout_alv,
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv.

* Build the field catalog
  m_fieldcat 'VKORG' 'VBAK'.
  m_fieldcat 'KUNNR' 'VBAK'.
  m_fieldcat 'VBELN' 'VBAK'.
  m_fieldcat 'NETWR' 'VBAK'.

* Fill Layout
  ls_layout-coltab_fieldname  = 'TABCOLOR'.

* Display the list
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            is_layout   = ls_layout
            it_fieldcat = lt_fieldcat
       TABLES
            t_outtab    = gt_vbak.

ENDFORM.                               " F_DISPLAY_DATA
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 13:04:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/cell-color/m-p/1607085#M272420</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-28T13:04:50Z</dc:date>
    </item>
  </channel>
</rss>

