<?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: alv in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665688#M1097600</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;Check this sample code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  z_colour NO STANDARD PAGE HEADING  . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES :pa0002. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TYPE-POOLS: slis.                 "ALV Declarations &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF it OCCURS 0, &lt;/P&gt;&lt;P&gt;      pernr LIKE pa0001-pernr, &lt;/P&gt;&lt;P&gt;      rufnm LIKE pa0002-rufnm, &lt;/P&gt;&lt;P&gt;      cell_colour TYPE lvc_t_scol,    "Cell colour &lt;/P&gt;&lt;P&gt;       END OF it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME. &lt;/P&gt;&lt;P&gt;SELECT-OPTIONS :s_pnum  FOR pa0002-pernr . &lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK main. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*ALV data declarations &lt;/P&gt;&lt;P&gt;DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH &lt;/P&gt;&lt;P&gt;HEADER LINE, &lt;/P&gt;&lt;P&gt;      gd_layout    TYPE slis_layout_alv, &lt;/P&gt;&lt;P&gt;      gd_repid     LIKE sy-repid, &lt;/P&gt;&lt;P&gt;      gt_sort     TYPE slis_t_sortinfo_alv. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To colour a cell. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  DATA ls_cellcolour TYPE lvc_s_scol. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION. &lt;/P&gt;&lt;P&gt;  PERFORM data_retrieval. &lt;/P&gt;&lt;P&gt;  PERFORM build_fieldcatalog. &lt;/P&gt;&lt;P&gt;  PERFORM build_layout. &lt;/P&gt;&lt;P&gt;  PERFORM display_alv_report. &lt;/P&gt;&lt;P&gt;END-OF-SELECTION. &lt;/P&gt;&lt;P&gt;  FREE : it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_fieldcatalog . &lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'PERNR'. &lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Personnel No.'. &lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     =  0. &lt;/P&gt;&lt;P&gt;  APPEND fieldcatalog TO fieldcatalog. &lt;/P&gt;&lt;P&gt;  CLEAR  fieldcatalog. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'RUFNM'. &lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Name'. &lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     =  0. &lt;/P&gt;&lt;P&gt;  APPEND fieldcatalog TO fieldcatalog. &lt;/P&gt;&lt;P&gt;  CLEAR  fieldcatalog. &lt;/P&gt;&lt;P&gt;ENDFORM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_layout . &lt;/P&gt;&lt;P&gt;  gd_layout-no_input          = 'X'. &lt;/P&gt;&lt;P&gt;  gd_layout-colwidth_optimize = 'X'. &lt;/P&gt;&lt;P&gt;  gd_layout-totals_text       = 'Totals'(256). &lt;/P&gt;&lt;P&gt;  gd_layout-coltab_fieldname = 'CELL_COLOUR'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " build_layout &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM display_alv_report . &lt;/P&gt;&lt;P&gt;  gd_repid = sy-repid. &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       = gd_repid &lt;/P&gt;&lt;P&gt;      is_layout                = gd_layout &lt;/P&gt;&lt;P&gt;      it_fieldcat              = fieldcatalog[] &lt;/P&gt;&lt;P&gt;      i_save                   = 'A' &lt;/P&gt;&lt;P&gt;    TABLES &lt;/P&gt;&lt;P&gt;      t_outtab                 = it &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;  IF sy-subrc &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;  ENDIF. &lt;/P&gt;&lt;P&gt;ENDFORM.                    " display_alv_report &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM data_retrieval . &lt;/P&gt;&lt;P&gt;select pernr rufnm from pa0002 into corresponding &lt;/P&gt;&lt;P&gt;fields of table it where pernr in s_pnum. &lt;/P&gt;&lt;P&gt;  LOOP AT it. &lt;/P&gt;&lt;P&gt;*Now based on the value of the field pernr we can &lt;/P&gt;&lt;P&gt;change the cell colour of the field rufnm or pernr. &lt;/P&gt;&lt;P&gt;    IF it-pernr eq '10001' . &lt;/P&gt;&lt;P&gt;      ls_cellcolour-fname = 'RUFNM'. &lt;/P&gt;&lt;P&gt;      ls_cellcolour-color-col = '5'. &lt;/P&gt;&lt;P&gt;      ls_cellcolour-color-int = '1'. &lt;/P&gt;&lt;P&gt;      ls_cellcolour-color-inv = '0'. &lt;/P&gt;&lt;P&gt;      APPEND ls_cellcolour TO it-cell_colour. &lt;/P&gt;&lt;P&gt;      IF sy-subrc EQ 0. &lt;/P&gt;&lt;P&gt;        MODIFY it. &lt;/P&gt;&lt;P&gt;      ENDIF. &lt;/P&gt;&lt;P&gt;    ENDIF. &lt;/P&gt;&lt;P&gt;  ENDLOOP. &lt;/P&gt;&lt;P&gt;ENDFORM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Neenu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Oct 2008 04:48:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-10-23T04:48:39Z</dc:date>
    <item>
      <title>alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665685#M1097597</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;  i want to dispaly in alv grid display output one perticular column with colour .&lt;/P&gt;&lt;P&gt;  how can i do? what is the condition i have to put?&lt;/P&gt;&lt;P&gt; thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 04:45:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665685#M1097597</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T04:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665686#M1097598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set the following value in the fieldcatalog entry for this column:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LS_FCAT-EMPHASIZE = 'C400'.  " possible values: 100/100 - 700/710&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a look at sample report &lt;STRONG&gt;ZUS_SDN_ALV_CELL_STYLE_2&lt;/STRONG&gt; (&lt;SPAN __jive_macro_name="thread" id="1072435"&gt;&lt;/SPAN&gt;) to see what is possible with respect to ALV colouring.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 04:48:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665686#M1097598</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2008-10-23T04:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665687#M1097599</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;In fieldcatalogue for that particular field where you want to add colour add :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it_fcat-EMPHASIZE = 'C410'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C- stands for colour&lt;/P&gt;&lt;P&gt;Other combinations can be c410, C411, C400, ......C510 , &lt;/P&gt;&lt;P&gt;The format should be like &lt;/P&gt;&lt;P&gt;C&amp;lt;1-9&amp;gt;&amp;lt;0-1&amp;gt;&amp;lt;0-1&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 04:48:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665687#M1097599</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T04:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665688#M1097600</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;Check this sample code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  z_colour NO STANDARD PAGE HEADING  . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES :pa0002. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TYPE-POOLS: slis.                 "ALV Declarations &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : BEGIN OF it OCCURS 0, &lt;/P&gt;&lt;P&gt;      pernr LIKE pa0001-pernr, &lt;/P&gt;&lt;P&gt;      rufnm LIKE pa0002-rufnm, &lt;/P&gt;&lt;P&gt;      cell_colour TYPE lvc_t_scol,    "Cell colour &lt;/P&gt;&lt;P&gt;       END OF it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME. &lt;/P&gt;&lt;P&gt;SELECT-OPTIONS :s_pnum  FOR pa0002-pernr . &lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK main. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*ALV data declarations &lt;/P&gt;&lt;P&gt;DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH &lt;/P&gt;&lt;P&gt;HEADER LINE, &lt;/P&gt;&lt;P&gt;      gd_layout    TYPE slis_layout_alv, &lt;/P&gt;&lt;P&gt;      gd_repid     LIKE sy-repid, &lt;/P&gt;&lt;P&gt;      gt_sort     TYPE slis_t_sortinfo_alv. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To colour a cell. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  DATA ls_cellcolour TYPE lvc_s_scol. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION. &lt;/P&gt;&lt;P&gt;  PERFORM data_retrieval. &lt;/P&gt;&lt;P&gt;  PERFORM build_fieldcatalog. &lt;/P&gt;&lt;P&gt;  PERFORM build_layout. &lt;/P&gt;&lt;P&gt;  PERFORM display_alv_report. &lt;/P&gt;&lt;P&gt;END-OF-SELECTION. &lt;/P&gt;&lt;P&gt;  FREE : it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_fieldcatalog . &lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'PERNR'. &lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Personnel No.'. &lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     =  0. &lt;/P&gt;&lt;P&gt;  APPEND fieldcatalog TO fieldcatalog. &lt;/P&gt;&lt;P&gt;  CLEAR  fieldcatalog. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'RUFNM'. &lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Name'. &lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     =  0. &lt;/P&gt;&lt;P&gt;  APPEND fieldcatalog TO fieldcatalog. &lt;/P&gt;&lt;P&gt;  CLEAR  fieldcatalog. &lt;/P&gt;&lt;P&gt;ENDFORM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM build_layout . &lt;/P&gt;&lt;P&gt;  gd_layout-no_input          = 'X'. &lt;/P&gt;&lt;P&gt;  gd_layout-colwidth_optimize = 'X'. &lt;/P&gt;&lt;P&gt;  gd_layout-totals_text       = 'Totals'(256). &lt;/P&gt;&lt;P&gt;  gd_layout-coltab_fieldname = 'CELL_COLOUR'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " build_layout &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM display_alv_report . &lt;/P&gt;&lt;P&gt;  gd_repid = sy-repid. &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       = gd_repid &lt;/P&gt;&lt;P&gt;      is_layout                = gd_layout &lt;/P&gt;&lt;P&gt;      it_fieldcat              = fieldcatalog[] &lt;/P&gt;&lt;P&gt;      i_save                   = 'A' &lt;/P&gt;&lt;P&gt;    TABLES &lt;/P&gt;&lt;P&gt;      t_outtab                 = it &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;  IF sy-subrc &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;  ENDIF. &lt;/P&gt;&lt;P&gt;ENDFORM.                    " display_alv_report &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM data_retrieval . &lt;/P&gt;&lt;P&gt;select pernr rufnm from pa0002 into corresponding &lt;/P&gt;&lt;P&gt;fields of table it where pernr in s_pnum. &lt;/P&gt;&lt;P&gt;  LOOP AT it. &lt;/P&gt;&lt;P&gt;*Now based on the value of the field pernr we can &lt;/P&gt;&lt;P&gt;change the cell colour of the field rufnm or pernr. &lt;/P&gt;&lt;P&gt;    IF it-pernr eq '10001' . &lt;/P&gt;&lt;P&gt;      ls_cellcolour-fname = 'RUFNM'. &lt;/P&gt;&lt;P&gt;      ls_cellcolour-color-col = '5'. &lt;/P&gt;&lt;P&gt;      ls_cellcolour-color-int = '1'. &lt;/P&gt;&lt;P&gt;      ls_cellcolour-color-inv = '0'. &lt;/P&gt;&lt;P&gt;      APPEND ls_cellcolour TO it-cell_colour. &lt;/P&gt;&lt;P&gt;      IF sy-subrc EQ 0. &lt;/P&gt;&lt;P&gt;        MODIFY it. &lt;/P&gt;&lt;P&gt;      ENDIF. &lt;/P&gt;&lt;P&gt;    ENDIF. &lt;/P&gt;&lt;P&gt;  ENDLOOP. &lt;/P&gt;&lt;P&gt;ENDFORM. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Neenu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 04:48:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665688#M1097600</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T04:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: alv</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665689#M1097601</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;use this code from (perfect code to color..single row,column,cell)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2569493"&gt;&lt;/A&gt;&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;regards&lt;/P&gt;&lt;P&gt;vivek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2008 04:49:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/4665689#M1097601</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-23T04:49:51Z</dc:date>
    </item>
  </channel>
</rss>

