<?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 ALV fields in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335187#M799265</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 need some columns in ALV(in ALV Grid )  list with diferent color ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so how we can do that can any one tell me ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THX&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Feb 2008 08:33:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-04T08:33:22Z</dc:date>
    <item>
      <title>ALV fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335187#M799265</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 need some columns in ALV(in ALV Grid )  list with diferent color ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so how we can do that can any one tell me ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THX&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2008 08:33:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335187#M799265</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-04T08:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: ALV fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335188#M799266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;use field catlog..&lt;/P&gt;&lt;P&gt;there is a option to color field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   row_pos        like sy-curow, " output in row&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; l_fieldcat-col_pos = '2'." position of the column&lt;/P&gt;&lt;P&gt; l_fieldcat-fieldname = 'VBELN'.&lt;/P&gt;&lt;P&gt; l_fieldcat-tabname = 'IT_VBAK_VBAP'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  currency(5)    type c,decimal places of the field with currency unit&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   cfieldname     type slis_fieldname, " field with currency unit&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   ctabname       type slis_tabname,   " and table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   l_fieldcat-ifieldname = ''. " initial column&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   quantity(3)    type c,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   qfieldname     type slis_fieldname, " field with quantity unit&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   qtabname       type slis_tabname,   " and table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   round          type i,        " round in write statement&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   exponent(3)       type c,     " exponent for floats&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; l_fieldcat-key = 'X'." column with key-color&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   icon(1)        type c,        " as icon&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   symbol(1)      type c,        " as symbol&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   checkbox(1)    type c,        " as checkbox&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; l_fieldcat-just = 'R'." (R)ight (L)eft (C)ent.&lt;/P&gt;&lt;P&gt; l_fieldcat-lzero = 'X'." leading zero&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   no_sign(1)     type c,        " write no-sign&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   no_zero(1)     type c,        " write no-zero&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   no_convext(1)  type c,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   edit_mask      type slis_edit_mask,                "&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   emphasize(4)   type c,        " emphasize&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   fix_column(1)   type c,       " Spalte fixieren&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   do_sum(1)      type c,        " sum up&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   no_out(1)      type c,        " (O)blig.(X)no out&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   tech(1)        type c,        " technical field&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   outputlen      like dd03p-outputlen,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   offset         type dd03p-outputlen,     " offset&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; l_fieldcat-seltext_l = 'SALES ORDER NUMBER'.      " long key word&lt;/P&gt;&lt;P&gt; l_fieldcat-seltext_m = 'SALES ORD. NO.'.     " middle key word&lt;/P&gt;&lt;P&gt; l_fieldcat-seltext_s = 'SD NO.'.     " short key word&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        ddictxt(1)     type c,        " (S)hort (M)iddle (L)ong&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        rollname       like dd03p-rollname,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        datatype       like dd03p-datatype,&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        inttype        like dd03p-inttype,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; l_fieldcat-intlen = 20.&lt;/P&gt;&lt;P&gt; l_fieldcat-ref_fieldname = 'VBELN'.&lt;/P&gt;&lt;P&gt; l_fieldcat-ref_tabname = 'VBAK'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        roundfieldname&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        roundtabname&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        decimalsfieldname&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        decimalstabname&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        decimals_out(6)   " decimals in write statement&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        text_fieldname&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;l_fieldcat-reptext_ddic = 'GAURAV'.     " heading (ddic)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        ddic_outputlen&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        key_sel(1)     type c,        " field not obligatory&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; l_fieldcat-no_sum = 'X'.    " do not sum up&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        sp_group(4)    type c,        " group specification&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        reprep(1)      type c,        " selection for rep/rep&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        input(1)       type c,        " input&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        edit(1)        type c,        " internal use only&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        hotspot(1)     type c,        " hotspot&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through this code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Build layout for ALV grid report &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&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'(201).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set layout field for row attributes(i.e. color) &lt;/P&gt;&lt;P&gt;gd_layout-info_fieldname = 'LINE_COLOR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gd_layout-totals_only = 'X'. &lt;/P&gt;&lt;P&gt;gd_layout-f2code = 'DISP'. "Sets fcode for when double &lt;/P&gt;&lt;P&gt;"click(press f2) &lt;/P&gt;&lt;P&gt;gd_layout-zebra = 'X'. &lt;/P&gt;&lt;P&gt;gd_layout-group_change_edit = 'X'. &lt;/P&gt;&lt;P&gt;gd_layout-header_text = 'helllllo'. &lt;/P&gt;&lt;P&gt;ENDFORM. " BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Display report using ALV grid &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&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_LIST_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;&lt;/P&gt;&lt;P&gt;i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM &lt;/P&gt;&lt;P&gt;i_callback_user_command = 'USER_COMMAND' &lt;/P&gt;&lt;P&gt;i_grid_title = outtext &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;&lt;/P&gt;&lt;P&gt;it_special_groups = gd_tabgroup &lt;/P&gt;&lt;P&gt;IT_EVENTS = GT_XEVENTS &lt;/P&gt;&lt;P&gt;i_save = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is_variant = z_template &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;t_outtab = it_ekko&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 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO &lt;/P&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. &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;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Retrieve data form EKPO table and populate itab it_ekko &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;FORM data_retrieval.&lt;/P&gt;&lt;P&gt;DATA: ld_color(1) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh&lt;/P&gt;&lt;P&gt;UP TO 10 ROWS&lt;/P&gt;&lt;P&gt;FROM ekpo&lt;/P&gt;&lt;P&gt;INTO TABLE it_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate field with color attributes&lt;/P&gt;&lt;P&gt;LOOP AT it_ekko INTO wa_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Populate color variable with colour properties &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;i.e. wa_ekko-line_color = 'C410' &lt;/P&gt;&lt;P&gt;ld_color = ld_color + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only 7 colours so need to reset color value &lt;/P&gt;&lt;P&gt;IF ld_color = 8.&lt;/P&gt;&lt;P&gt;ld_color = 1.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_ekko-line_color = 'C410'. &lt;/P&gt;&lt;P&gt;MODIFY it_ekko FROM wa_ekko.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDFORM. " DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards &lt;/P&gt;&lt;P&gt;Gaurav J.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: GAURAV on Feb 4, 2008 9:35 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: GAURAV on Feb 4, 2008 9:39 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2008 08:34:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335188#M799266</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-04T08:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: ALV fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335189#M799267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Go thorugh below link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=52107" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=52107&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2008 08:35:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335189#M799267</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-04T08:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: ALV fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335190#M799268</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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SEE THIS PROGRAM AND YOU CAN UNDERSTAND VERY EASILY &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;codeREPORT zdemo_alvgrid .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES: ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type-pools: slis. "ALV Declarations&lt;/P&gt;&lt;P&gt;*Data Declaration&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;TYPES: BEGIN OF t_ekko,&lt;/P&gt;&lt;P&gt;ebeln TYPE ekpo-ebeln,&lt;/P&gt;&lt;P&gt;ebelp TYPE ekpo-ebelp,&lt;/P&gt;&lt;P&gt;statu TYPE ekpo-statu,&lt;/P&gt;&lt;P&gt;aedat TYPE ekpo-aedat,&lt;/P&gt;&lt;P&gt;matnr TYPE ekpo-matnr,&lt;/P&gt;&lt;P&gt;menge TYPE ekpo-menge,&lt;/P&gt;&lt;P&gt;meins TYPE ekpo-meins,&lt;/P&gt;&lt;P&gt;netpr TYPE ekpo-netpr,&lt;/P&gt;&lt;P&gt;peinh TYPE ekpo-peinh,&lt;/P&gt;&lt;P&gt;line_color(4) type c, "Used to store row color attributes&lt;/P&gt;&lt;P&gt;END OF t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;wa_ekko TYPE t_ekko.&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 header line,&lt;/P&gt;&lt;P&gt;gd_tab_group type slis_t_sp_group_alv,&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*Start-of-selection.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Build Fieldcatalog for ALV Report &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;form build_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a number of ways to create a fieldcat. &lt;/P&gt;&lt;P&gt;For the purpose of this example i will build the fieldcatalog manualy &lt;/P&gt;&lt;P&gt;by populating the internal table fields individually and then &lt;/P&gt;&lt;P&gt;appending the rows. This method can be the most time consuming but can &lt;/P&gt;&lt;P&gt;also allow you more control of the final product. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Beware though, you need to ensure that all fields required are &lt;/P&gt;&lt;P&gt;populated. When using some of functionality available via ALV, such as &lt;/P&gt;&lt;P&gt;total. You may need to provide more information than if you were &lt;/P&gt;&lt;P&gt;simply displaying the result &lt;/P&gt;&lt;P&gt;I.e. Field type may be required in-order for &lt;/P&gt;&lt;P&gt;the 'TOTAL' function to work. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fieldcatalog-fieldname = 'EBELN'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'Purchase Order'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 0.&lt;/P&gt;&lt;P&gt;fieldcatalog-outputlen = 10.&lt;/P&gt;&lt;P&gt;fieldcatalog-emphasize = 'X'.&lt;/P&gt;&lt;P&gt;fieldcatalog-key = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fieldcatalog-do_sum = 'X'. &lt;/P&gt;&lt;P&gt;fieldcatalog-no_zero = 'X'. &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 = 'EBELP'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'PO Item'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 1.&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 = 'STATU'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'Status'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 2.&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 = 'AEDAT'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'Item change date'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 3.&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 = 'MATNR'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'Material Number'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 4.&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 = 'MENGE'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'PO quantity'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 5.&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 = 'MEINS'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'Order Unit'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 6.&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 = 'NETPR'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'Net Price'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 7.&lt;/P&gt;&lt;P&gt;fieldcatalog-outputlen = 15.&lt;/P&gt;&lt;P&gt;fieldcatalog-datatype = 'CURR'.&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 = 'PEINH'.&lt;/P&gt;&lt;P&gt;fieldcatalog-seltext_m = 'Price Unit'.&lt;/P&gt;&lt;P&gt;fieldcatalog-col_pos = 8.&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. " BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Build layout for ALV grid report &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&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'(201).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set layout field for row attributes(i.e. color) &lt;/P&gt;&lt;P&gt;gd_layout-info_fieldname = 'LINE_COLOR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gd_layout-totals_only = 'X'. &lt;/P&gt;&lt;P&gt;gd_layout-f2code = 'DISP'. "Sets fcode for when double &lt;/P&gt;&lt;P&gt;"click(press f2) &lt;/P&gt;&lt;P&gt;gd_layout-zebra = 'X'. &lt;/P&gt;&lt;P&gt;gd_layout-group_change_edit = 'X'. &lt;/P&gt;&lt;P&gt;gd_layout-header_text = 'helllllo'. &lt;/P&gt;&lt;P&gt;endform. " BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Display report using ALV grid &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&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;&lt;/P&gt;&lt;P&gt;i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM &lt;/P&gt;&lt;P&gt;i_callback_user_command = 'USER_COMMAND' &lt;/P&gt;&lt;P&gt;i_grid_title = outtext &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;&lt;/P&gt;&lt;P&gt;it_special_groups = gd_tabgroup &lt;/P&gt;&lt;P&gt;IT_EVENTS = GT_XEVENTS &lt;/P&gt;&lt;P&gt;i_save = 'X'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is_variant = z_template &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;t_outtab = it_ekko&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 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO &lt;/P&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. &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;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Form DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Retrieve data form EKPO table and populate itab it_ekko &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;form data_retrieval.&lt;/P&gt;&lt;P&gt;data: ld_color(1) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ebeln ebelp statu aedat matnr menge meins netpr peinh&lt;/P&gt;&lt;P&gt;up to 10 rows&lt;/P&gt;&lt;P&gt;from ekpo&lt;/P&gt;&lt;P&gt;into table it_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate field with color attributes&lt;/P&gt;&lt;P&gt;loop at it_ekko into wa_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Populate color variable with colour properties &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;i.e. wa_ekko-line_color = 'C410' &lt;/P&gt;&lt;P&gt;ld_color = ld_color + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only 7 colours so need to reset color value &lt;/P&gt;&lt;P&gt;if ld_color = 8.&lt;/P&gt;&lt;P&gt;ld_color = 1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;concatenate 'C' ld_color '10' into wa_ekko-line_color.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_ekko-line_color = 'C410'. &lt;/P&gt;&lt;P&gt;modify it_ekko from wa_ekko.&lt;/P&gt;&lt;P&gt;endloop.&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;reward if helpful&lt;/P&gt;&lt;P&gt;kushagra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2008 08:35:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335190#M799268</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-04T08:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: ALV fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335191#M799269</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;The follow program demonstrates how to change the colour of individual rows of an ALV grid. Changes required&lt;/P&gt;&lt;P&gt;from a basic ALV grid include adding a new field to ALV grid data table(it_ekko), Populating this field with color&lt;/P&gt;&lt;P&gt;attribute and adding an entry to layout control table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zdemo_alvgrid                 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES:     ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;type-pools: slis.                                 "ALV Declarations&lt;/P&gt;&lt;P&gt;*Data Declaration&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------" /&gt;&lt;P&gt;TYPES: BEGIN OF t_ekko,&lt;/P&gt;&lt;P&gt;  ebeln TYPE ekpo-ebeln,&lt;/P&gt;&lt;P&gt;  ebelp TYPE ekpo-ebelp,&lt;/P&gt;&lt;P&gt;  statu TYPE ekpo-statu,&lt;/P&gt;&lt;P&gt;  aedat TYPE ekpo-aedat,&lt;/P&gt;&lt;P&gt;  matnr TYPE ekpo-matnr,&lt;/P&gt;&lt;P&gt;  menge TYPE ekpo-menge,&lt;/P&gt;&lt;P&gt;  meins TYPE ekpo-meins,&lt;/P&gt;&lt;P&gt;  netpr TYPE ekpo-netpr,&lt;/P&gt;&lt;P&gt;  peinh TYPE ekpo-peinh,&lt;/P&gt;&lt;P&gt;  line_color(4) type c,     "Used to store row color attributes&lt;/P&gt;&lt;P&gt; END OF t_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,&lt;/P&gt;&lt;P&gt;      wa_ekko TYPE t_ekko.&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 header line,&lt;/P&gt;&lt;P&gt;      gd_tab_group type slis_t_sp_group_alv,&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*Start-of-selection.&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Build Fieldcatalog for ALV Report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form build_fieldcatalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;There are a number of ways to create a fieldcat.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For the purpose of this example i will build the fieldcatalog manualy&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;by populating the internal table fields individually and then&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;appending the rows. This method can be the most time consuming but can&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;also allow you  more control of the final product.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Beware though, you need to ensure that all fields required are&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;populated. When using some of functionality available via ALV, such as&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;total. You may need to provide more information than if you were&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;simply displaying the result&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;              I.e. Field type may be required in-order for&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                   the 'TOTAL' function to work.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  fieldcatalog-fieldname   = 'EBELN'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Purchase Order'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 0.&lt;/P&gt;&lt;P&gt;  fieldcatalog-outputlen   = 10.&lt;/P&gt;&lt;P&gt;  fieldcatalog-emphasize   = 'X'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-key         = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; fieldcatalog-do_sum      = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; fieldcatalog-no_zero     = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&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   = 'EBELP'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'PO Item'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 1.&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   = 'STATU'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Status'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 2.&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   = 'AEDAT'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Item change date'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 3.&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   = 'MATNR'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Material Number'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 4.&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   = 'MENGE'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'PO quantity'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 5.&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   = 'MEINS'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Order Unit'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 6.&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   = 'NETPR'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Net Price'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 7.&lt;/P&gt;&lt;P&gt;  fieldcatalog-outputlen   = 15.&lt;/P&gt;&lt;P&gt;  fieldcatalog-datatype     = 'CURR'.&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   = 'PEINH'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-seltext_m   = 'Price Unit'.&lt;/P&gt;&lt;P&gt;  fieldcatalog-col_pos     = 8.&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.                    " BUILD_FIELDCATALOG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Build layout for ALV grid report&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&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'(201).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set layout field for row attributes(i.e. color) &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  gd_layout-info_fieldname =      'LINE_COLOR'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; gd_layout-totals_only        = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; gd_layout-f2code            = 'DISP'.  "Sets fcode for when double&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                                        "click(press f2)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; gd_layout-zebra             = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; gd_layout-group_change_edit = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; gd_layout-header_text       = 'helllllo'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;endform.                    " BUILD_LAYOUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Display report using ALV grid&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           i_callback_user_command = 'USER_COMMAND'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           i_grid_title           = outtext&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            is_layout               = gd_layout&lt;/P&gt;&lt;P&gt;            it_fieldcat             = fieldcatalog[]&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           it_special_groups       = gd_tabgroup&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           IT_EVENTS                = GT_XEVENTS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            i_save                  = 'X'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           is_variant              = z_template&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       tables&lt;/P&gt;&lt;P&gt;            t_outtab                = it_ekko&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;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;P&gt;endform.                    " DISPLAY_ALV_REPORT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  DATA_RETRIEVAL&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Retrieve data form EKPO table and populate itab it_ekko&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form data_retrieval.&lt;/P&gt;&lt;P&gt;data: ld_color(1) type c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ebeln ebelp statu aedat matnr menge meins netpr peinh&lt;/P&gt;&lt;P&gt; up to 10 rows&lt;/P&gt;&lt;P&gt;  from ekpo&lt;/P&gt;&lt;P&gt;  into table it_ekko.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Populate field with color attributes&lt;/P&gt;&lt;P&gt;loop at it_ekko into wa_ekko.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate color variable with colour properties&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Char 1 = C (This is a color property)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Char 2 = 3 (Color codes: 1 - 7)&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Char 3 = Intensified on/off ( 1 or 0 )&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Char 4 = Inverse display on/off ( 1 or 0 )&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;          i.e. wa_ekko-line_color = 'C410'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ld_color = ld_color + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Only 7 colours so need to reset color value&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  if ld_color = 8.&lt;/P&gt;&lt;P&gt;    ld_color = 1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  concatenate 'C' ld_color '10' into wa_ekko-line_color.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; wa_ekko-line_color = 'C410'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  modify it_ekko from wa_ekko.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endform.                    " DATA_RETRIEVAL&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2008 08:37:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335191#M799269</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-04T08:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: ALV fields</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335192#M799270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;these links are helpful...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ALV&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Please give me general info on ALV.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=58286" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=58286&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=76490" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=76490&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=20591" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=20591&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=66305" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=66305&lt;/A&gt; - this one discusses which way should you use - ABAP Objects calls or simple function modules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. How do I program double click in ALV?&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=11601" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=11601&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=23010" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=23010&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. How do I add subtotals (I have problem to add them)...&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=20386" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=20386&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=85191" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=85191&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=88401" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=88401&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=17335" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=17335&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. How to add list heading like top-of-page in ABAP lists?&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=58775" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=58775&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=60550" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=60550&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=16629" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=16629&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. How to print page number / total number of pages X/XX in ALV? &lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=29597" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=29597&lt;/A&gt; (no direct solution)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=64320" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=64320&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=44477" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=44477&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. How can I set the cell color in ALV? &lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=52107" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=52107&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;8. How do I print a logo/graphics in ALV?&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=81149" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=81149&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=35498" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=35498&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=5013" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=5013&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;9. How do I create and use input-enabled fields in ALV?&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=84933" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=84933&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=69878" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=69878&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10. How can I use ALV for reports that are going to be run in background?&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=83243" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=83243&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=19224" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=19224&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;11. How can I display an icon in ALV? (Common requirement is traffic light icon).&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=79424" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=79424&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=24512" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=24512&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;12. How can I display a checkbox in ALV? &lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=88376" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=88376&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=40968" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=40968&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sapfans.com/forums/viewtopic.php?t=6919" target="test_blank"&gt;http://www.sapfans.com/forums/viewtopic.php?t=6919&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS&lt;/P&gt;&lt;P&gt;Gaurav J&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2008 08:41:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-fields/m-p/3335192#M799270</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-04T08:41:39Z</dc:date>
    </item>
  </channel>
</rss>

