<?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 grid display in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235010#M481279</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Check this sample prg.&lt;/P&gt;&lt;P&gt;I think i would be useful for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SIMPLE ALV PROGRAM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USING TWO TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZEASALV_04                              .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES : zeastable_02,zeastable_04.&lt;/P&gt;&lt;P&gt;TYPE-POOLS : slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF fieldst,&lt;/P&gt;&lt;P&gt;        name LIKE zeastable_02-name,&lt;/P&gt;&lt;P&gt;        znum LIKE zeastable_02-znum,&lt;/P&gt;&lt;P&gt;        empno LIKE zeastable_04-empno,&lt;/P&gt;&lt;P&gt;        zempsalary LIKE zeastable_04-zempsalary,&lt;/P&gt;&lt;P&gt;        END OF fieldst.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab TYPE TABLE OF fieldst WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: w_report_id  LIKE sy-repid.            "Program name&lt;/P&gt;&lt;P&gt;DATA: w_title   TYPE lvc_title VALUE    'Assignment 1 in ALV'.&lt;/P&gt;&lt;P&gt;DATA: w_layout   TYPE slis_layout_alv.      "Layout setup&lt;/P&gt;&lt;P&gt;DATA: w_fieldcat TYPE slis_t_fieldcat_alv.  "Field Catlog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT-OPTIONS employee FOR zeastable_04-empno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT zeastable_02&lt;SUB&gt;name  zeastable_02&lt;/SUB&gt;znum&lt;/P&gt;&lt;P&gt;       zeastable_04&lt;SUB&gt;empno zeastable_04&lt;/SUB&gt;zempsalary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE itab FROM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       zeastable_02 INNER JOIN zeastable_04 ON&lt;/P&gt;&lt;P&gt;       zeastable_02&lt;SUB&gt;name = zeastable_04&lt;/SUB&gt;name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       WHERE  zeastable_04~empno IN employee.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; LOOP AT itab.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;   itab-name,itab-znum, itab-empno,itab-zempsalary.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDLOOP.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDSELECT.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; itab.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_report_id = sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM i_layout CHANGING w_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM i_fieldcat CHANGING w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;    i_callback_program                = 'ZEASALV_04'&lt;/P&gt;&lt;P&gt;     i_grid_title                      = w_title&lt;/P&gt;&lt;P&gt;     is_layout                         = w_layout&lt;/P&gt;&lt;P&gt;     it_fieldcat                       = w_fieldcat&lt;/P&gt;&lt;P&gt;     i_save                            = 'A'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      t_outtab                          = itab&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;  IF sy-subrc &amp;lt;&amp;gt; 0.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PERFORM i_layout CHANGING w_layout.&lt;/P&gt;&lt;P&gt;  PERFORM i_fieldcat CHANGING w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;PERFROM  i_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  i_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;      text&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     &amp;lt;--P_W_LAYOUT  text&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 i_layout  changing p_w_layout.&lt;/P&gt;&lt;P&gt;clear w_layout.&lt;/P&gt;&lt;P&gt;  w_layout-colwidth_optimize = 'X'.&lt;/P&gt;&lt;P&gt;  w_layout-edit = ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " i_layout&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM  i_fieldcat&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  i_fieldcat&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;      text&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     &amp;lt;--P_W_FEILDCAT  text&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 i_fieldcat  changing p_w_feildcat.&lt;/P&gt;&lt;P&gt;data: l_line_fieldcat type slis_fieldcat_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear l_line_fieldcat.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-fieldname = 'NAME'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-ref_tabname = 'itab'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-seltext_m = 'NAME'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  l_line_fieldcat-key  = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   append l_line_fieldcat to w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear l_line_fieldcat.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-fieldname = 'ZNUM'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-ref_tabname = 'itab'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-seltext_m = 'NUMBER'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  l_line_fieldcat-key  = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  append l_line_fieldcat to w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear l_line_fieldcat.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-fieldname = 'EMPNO'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-ref_tabname = 'itab'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-seltext_m = 'EMPLNUM'.&lt;/P&gt;&lt;P&gt;*l_line_fieldcat-key  = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  append l_line_fieldcat to w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear l_line_fieldcat.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-fieldname = 'ZEMPSALARY'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-ref_tabname = 'itab'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-seltext_m = 'SALARY'.&lt;/P&gt;&lt;P&gt;*l_line_fieldcat-key  = 'X'.&lt;/P&gt;&lt;P&gt;  append l_line_fieldcat to w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " i_fieldcat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if it is useful to you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Apr 2007 09:45:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-30T09:45:37Z</dc:date>
    <item>
      <title>alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235003#M481272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi i am new to ABAP...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   i have two data base tables mara,makt....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i want dislpa matnr meins maktx using alv grid display....&lt;/P&gt;&lt;P&gt;any one can help me in this issue.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Apr 2007 05:11:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235003#M481272</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-29T05:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235004#M481273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check this link -&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm" target="test_blank"&gt;http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpful replies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Apr 2007 05:33:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235004#M481273</guid>
      <dc:creator>amit_khare</dc:creator>
      <dc:date>2007-04-29T05:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235005#M481274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://www.alvrobot.com.ar/home.php" target="test_blank"&gt;http://www.alvrobot.com.ar/home.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/mpioud/Abap_programs.html" target="test_blank"&gt;http://www.geocities.com/mpioud/Abap_programs.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Santhosh Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Apr 2007 05:48:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235005#M481274</guid>
      <dc:creator>SantoshKallem</dc:creator>
      <dc:date>2007-04-29T05:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235006#M481275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;follow the link below which will generate tyhe automatic code at end and u can copy that code to ur ABAP program.&lt;/P&gt;&lt;P&gt;click on this link and proceed as follows&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.alvrobot.com.ar/SRG_1.php" target="test_blank"&gt;http://www.alvrobot.com.ar/SRG_1.php&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Welcome!&lt;/P&gt;&lt;P&gt;&amp;#149;	Home &lt;/P&gt;&lt;P&gt;&amp;#149;	Start generating ALV   -&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt;&amp;amp;#61664;choose this&lt;/P&gt;&lt;P&gt;&amp;#149;	What is this about &lt;/P&gt;&lt;P&gt;&amp;#149;	Personalized templates &lt;/P&gt;&lt;P&gt;Step1:  give name, author, title and descri.(any chars for all)&lt;/P&gt;&lt;P&gt;Step2: fill with ur tables choose inner join&lt;/P&gt;&lt;P&gt;And follow the remaining steps as similarly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if helpful&lt;/P&gt;&lt;P&gt;regards &lt;/P&gt;&lt;P&gt;sreeni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Apr 2007 06:07:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235006#M481275</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-29T06:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235007#M481276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Refer the following program and add the fields according your requirements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  z_82235_test4                           .

TABLES: mara, makt.

TYPE-POOLS: slis.

TYPES: BEGIN OF tab,
          matnr TYPE matnr,
          matkl TYPE matkl,
          maktx TYPE maktx,
       END OF tab.

DATA: itab TYPE TABLE OF tab,
      wa LIKE LINE OF itab.



*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
      gd_tab_group type slis_t_sp_group_alv,
      gd_layout    type slis_layout_alv,
      gd_repid     like sy-repid.


************************************************************************
*Start-of-selection.
START-OF-SELECTION.

perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform display_alv_report.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  BUILD_FIELDCATALOG
*&amp;amp;---------------------------------------------------------------------*
*       Build Fieldcatalog for ALV Report
*----------------------------------------------------------------------*
form build_fieldcatalog.

* There are a number of ways to create a fieldcat.
* For the purpose of this example i will build the fieldcatalog manualy
* by populating the internal table fields individually and then
* appending the rows. This method can be the most time consuming but can
* also allow you  more control of the final product.

* Beware though, you need to ensure that all fields required are
* populated. When using some of functionality available via ALV, such as
* total. You may need to provide more information than if you were
* simply displaying the result
*               I.e. Field type may be required in-order for
*                    the 'TOTAL' function to work.

  fieldcatalog-fieldname   = 'MATNR'.
  fieldcatalog-seltext_m   = 'Material No'.
  fieldcatalog-col_pos     = 0.
  fieldcatalog-outputlen   = 10.
  fieldcatalog-emphasize   = 'X'.
  append fieldcatalog to fieldcatalog.
  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'MATKL'.
  fieldcatalog-seltext_m   = 'Group'.
  fieldcatalog-col_pos     = 2.
   fieldcatalog-outputlen   = 5.
  append fieldcatalog to fieldcatalog.
  clear  fieldcatalog.

  fieldcatalog-fieldname   = 'MAKTX'.
  fieldcatalog-seltext_m   = 'Description'.
  fieldcatalog-col_pos     = 1.
  fieldcatalog-outputlen   = 8.
  append fieldcatalog to fieldcatalog.
  clear  fieldcatalog.


endform.                    " BUILD_FIELDCATALOG


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  BUILD_LAYOUT
*&amp;amp;---------------------------------------------------------------------*
*       Build layout for ALV grid report
*----------------------------------------------------------------------*
form build_layout.
  gd_layout-no_input          = 'X'.
  gd_layout-colwidth_optimize = 'X'.
endform.                    " BUILD_LAYOUT


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  DISPLAY_ALV_REPORT
*&amp;amp;---------------------------------------------------------------------*
*       Display report using ALV grid
*----------------------------------------------------------------------*
form display_alv_report.
  gd_repid = sy-repid.
  call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
            i_callback_program      = gd_repid
*            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
*            i_callback_user_command = 'USER_COMMAND'
*            i_grid_title           = outtext
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
*            it_special_groups       = gd_tabgroup
*            IT_EVENTS                = GT_XEVENTS
            i_save                  = 'X'
*            is_variant              = z_template

       tables
            t_outtab                = itab
       exceptions
            program_error           = 1
            others                  = 2.
  if sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.
endform.                    " DISPLAY_ALV_REPORT


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  DATA_RETRIEVAL
*&amp;amp;---------------------------------------------------------------------*
*       Retrieve data form EKPO table and populate itab it_ekko
*----------------------------------------------------------------------*
form data_retrieval.

SELECT F~matnr F~matkl P~maktx
    INTO table itab
    FROM mara AS F INNER JOIN makt AS P
           ON F~matnr = P~matnr.

endform.                    " DATA_RETRIEVAL&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Apr 2007 06:15:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235007#M481276</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-29T06:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235008#M481277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;declare fieldcatalog variable in dat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : d_fieldcat type slis_ t_fieldcat_alv,&lt;/P&gt;&lt;P&gt;         d_fieldcat_wa type slis_fieldcat_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;d_fielcat_wa-matnr = 'MATNR'.&lt;/P&gt;&lt;P&gt;d_fieldcat_wa-seltext_i  = 'material no'.&lt;/P&gt;&lt;P&gt;d_fieldcat_wa-col_pos = 1.&lt;/P&gt;&lt;P&gt;append d_fieldcat_wa to d_fieldcat.&lt;/P&gt;&lt;P&gt;clear d_fieldcat_wa.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;d_fielcat_wa-matnr = 'MAKTX'.&lt;/P&gt;&lt;P&gt;d_fieldcat_wa-seltext_i  = 'material description'.&lt;/P&gt;&lt;P&gt;d_fieldcat_wa-col_pos = 2.&lt;/P&gt;&lt;P&gt;append d_fieldcat_wa to d_fieldcat.&lt;/P&gt;&lt;P&gt;clear d_fieldcat_wa.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;d_fielcat_wa-matnr = 'MEINS'.&lt;/P&gt;&lt;P&gt;d_fieldcat_wa-seltext_i  = 'unit'.&lt;/P&gt;&lt;P&gt;d_fieldcat_wa-col_pos = 3.&lt;/P&gt;&lt;P&gt;append d_fieldcat_wa to d_fieldcat.&lt;/P&gt;&lt;P&gt;clear d_fieldcat_wa.&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;programname = gd_repid.&lt;/P&gt;&lt;P&gt;fieldcat = d_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;importing.&lt;/P&gt;&lt;P&gt;t_outtab = itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward with points. if u find this as helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Vinutha YV&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 09:02:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235008#M481277</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T09:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235009#M481278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi hari prasad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go through this urlls:&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;/P&gt;&lt;P&gt;&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;/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;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;/P&gt;&lt;P&gt;&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;Go thru these programs they may help u to try on some hands on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ALV Demo program&lt;/P&gt;&lt;P&gt;BCALV_DEMO_HTML&lt;/P&gt;&lt;P&gt;BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode&lt;/P&gt;&lt;P&gt;BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode&lt;/P&gt;&lt;P&gt;BCALV_GRID_DEMO Simple ALV Control Call Demo Program&lt;/P&gt;&lt;P&gt;BCALV_TREE_DEMO Demo for ALV tree control&lt;/P&gt;&lt;P&gt;BCALV_TREE_SIMPLE_DEMO&lt;/P&gt;&lt;P&gt;BC_ALV_DEMO_HTML_D0100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go through this program/.&lt;/P&gt;&lt;P&gt;REPORT  zbt_rep NO STANDARD PAGE HEADING&lt;/P&gt;&lt;P&gt;                      MESSAGE-ID zbt_msg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES:mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN:BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS:s_matnr FOR mara-matnr OBLIGATORY.&lt;/P&gt;&lt;P&gt;PARAMETERS:p_mtart TYPE mara-mtart.&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN:END OF BLOCK b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:BEGIN OF ty_mat,&lt;/P&gt;&lt;P&gt;        matnr TYPE mara-matnr,&lt;/P&gt;&lt;P&gt;        mtart TYPE mara-mtart,&lt;/P&gt;&lt;P&gt;        meins TYPE mara-meins,&lt;/P&gt;&lt;P&gt;      END OF ty_mat,&lt;/P&gt;&lt;P&gt;      BEGIN OF ty_uom_text,&lt;/P&gt;&lt;P&gt;        msehi TYPE t006a-msehi,&lt;/P&gt;&lt;P&gt;        msehl TYPE t006a-msehl,&lt;/P&gt;&lt;P&gt;      END OF ty_uom_text,&lt;/P&gt;&lt;P&gt;      BEGIN OF ty_output,&lt;/P&gt;&lt;P&gt;        matnr TYPE mara-matnr,&lt;/P&gt;&lt;P&gt;        mtart TYPE mara-mtart,&lt;/P&gt;&lt;P&gt;        meins TYPE mara-meins,&lt;/P&gt;&lt;P&gt;        msehl TYPE t006a-msehl,&lt;/P&gt;&lt;P&gt;      END OF ty_output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: it_mat TYPE STANDARD TABLE OF ty_mat WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      it_uom_text TYPE STANDARD TABLE OF ty_uom_text WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;      it_output TYPE STANDARD TABLE OF ty_output WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INITIALIZATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  s_matnr-sign = 'I'.&lt;/P&gt;&lt;P&gt;  s_matnr-option = 'BT'.&lt;/P&gt;&lt;P&gt;  s_matnr-low = '1'.&lt;/P&gt;&lt;P&gt;  s_matnr-high = '1000'.&lt;/P&gt;&lt;P&gt;  APPEND s_matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF s_matnr-high IS INITIAL.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Make an entry in all required fields&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    MESSAGE e001(zbt_msg).&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT matnr mtart meins FROM mara INTO TABLE it_mat&lt;/P&gt;&lt;P&gt;                         WHERE matnr IN s_matnr AND&lt;/P&gt;&lt;P&gt;                               mtart = p_mtart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT msehi msehl FROM t006a INTO TABLE it_uom_text&lt;/P&gt;&lt;P&gt;                        WHERE spras = sy-langu.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;END-OF-SELECTION.&lt;/P&gt;&lt;P&gt;  LOOP AT it_mat.&lt;/P&gt;&lt;P&gt;    it_output-matnr = it_mat-matnr.&lt;/P&gt;&lt;P&gt;    it_output-mtart = it_mat-mtart.&lt;/P&gt;&lt;P&gt;    it_output-meins = it_mat-meins.&lt;/P&gt;&lt;P&gt;    READ TABLE it_uom_text WITH KEY msehi = it_mat-meins.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      it_output-msehl = it_uom_text-msehl.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    APPEND it_output.&lt;/P&gt;&lt;P&gt;    CLEAR it_output.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT it_output[] IS INITIAL.&lt;/P&gt;&lt;P&gt;    LOOP AT it_output.&lt;/P&gt;&lt;P&gt;      WRITE:/ it_output-matnr,it_output-mtart,&lt;/P&gt;&lt;P&gt;              it_output-meins,it_output-msehl.&lt;/P&gt;&lt;P&gt;      CLEAR it_output.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    MESSAGE s002(zbt_msg).&lt;/P&gt;&lt;P&gt;    LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TOP-OF-PAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  WRITE:/ 'MATREIAL INFORMATION'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*********Rewards some points.&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;P.Naganjana Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 09:07:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235009#M481278</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T09:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: alv grid display</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235010#M481279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Check this sample prg.&lt;/P&gt;&lt;P&gt;I think i would be useful for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SIMPLE ALV PROGRAM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USING TWO TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZEASALV_04                              .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES : zeastable_02,zeastable_04.&lt;/P&gt;&lt;P&gt;TYPE-POOLS : slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF fieldst,&lt;/P&gt;&lt;P&gt;        name LIKE zeastable_02-name,&lt;/P&gt;&lt;P&gt;        znum LIKE zeastable_02-znum,&lt;/P&gt;&lt;P&gt;        empno LIKE zeastable_04-empno,&lt;/P&gt;&lt;P&gt;        zempsalary LIKE zeastable_04-zempsalary,&lt;/P&gt;&lt;P&gt;        END OF fieldst.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA itab TYPE TABLE OF fieldst WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: w_report_id  LIKE sy-repid.            "Program name&lt;/P&gt;&lt;P&gt;DATA: w_title   TYPE lvc_title VALUE    'Assignment 1 in ALV'.&lt;/P&gt;&lt;P&gt;DATA: w_layout   TYPE slis_layout_alv.      "Layout setup&lt;/P&gt;&lt;P&gt;DATA: w_fieldcat TYPE slis_t_fieldcat_alv.  "Field Catlog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT-OPTIONS employee FOR zeastable_04-empno.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT zeastable_02&lt;SUB&gt;name  zeastable_02&lt;/SUB&gt;znum&lt;/P&gt;&lt;P&gt;       zeastable_04&lt;SUB&gt;empno zeastable_04&lt;/SUB&gt;zempsalary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE itab FROM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       zeastable_02 INNER JOIN zeastable_04 ON&lt;/P&gt;&lt;P&gt;       zeastable_02&lt;SUB&gt;name = zeastable_04&lt;/SUB&gt;name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       WHERE  zeastable_04~empno IN employee.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; LOOP AT itab.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt;   itab-name,itab-znum, itab-empno,itab-zempsalary.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDLOOP.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ENDSELECT.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; itab.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;w_report_id = sy-repid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM i_layout CHANGING w_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM i_fieldcat CHANGING w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;    i_callback_program                = 'ZEASALV_04'&lt;/P&gt;&lt;P&gt;     i_grid_title                      = w_title&lt;/P&gt;&lt;P&gt;     is_layout                         = w_layout&lt;/P&gt;&lt;P&gt;     it_fieldcat                       = w_fieldcat&lt;/P&gt;&lt;P&gt;     i_save                            = 'A'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      t_outtab                          = itab&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;  IF sy-subrc &amp;lt;&amp;gt; 0.&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PERFORM i_layout CHANGING w_layout.&lt;/P&gt;&lt;P&gt;  PERFORM i_fieldcat CHANGING w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;PERFROM  i_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  i_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;      text&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     &amp;lt;--P_W_LAYOUT  text&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 i_layout  changing p_w_layout.&lt;/P&gt;&lt;P&gt;clear w_layout.&lt;/P&gt;&lt;P&gt;  w_layout-colwidth_optimize = 'X'.&lt;/P&gt;&lt;P&gt;  w_layout-edit = ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " i_layout&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM  i_fieldcat&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  i_fieldcat&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;      text&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     &amp;lt;--P_W_FEILDCAT  text&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 i_fieldcat  changing p_w_feildcat.&lt;/P&gt;&lt;P&gt;data: l_line_fieldcat type slis_fieldcat_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear l_line_fieldcat.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-fieldname = 'NAME'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-ref_tabname = 'itab'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-seltext_m = 'NAME'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  l_line_fieldcat-key  = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   append l_line_fieldcat to w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear l_line_fieldcat.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-fieldname = 'ZNUM'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-ref_tabname = 'itab'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-seltext_m = 'NUMBER'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  l_line_fieldcat-key  = 'X'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  append l_line_fieldcat to w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear l_line_fieldcat.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-fieldname = 'EMPNO'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-ref_tabname = 'itab'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-seltext_m = 'EMPLNUM'.&lt;/P&gt;&lt;P&gt;*l_line_fieldcat-key  = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  append l_line_fieldcat to w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  clear l_line_fieldcat.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-fieldname = 'ZEMPSALARY'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-ref_tabname = 'itab'.&lt;/P&gt;&lt;P&gt;  l_line_fieldcat-seltext_m = 'SALARY'.&lt;/P&gt;&lt;P&gt;*l_line_fieldcat-key  = 'X'.&lt;/P&gt;&lt;P&gt;  append l_line_fieldcat to w_fieldcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.                    " i_fieldcat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if it is useful to you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Apr 2007 09:45:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-grid-display/m-p/2235010#M481279</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-30T09:45:37Z</dc:date>
    </item>
  </channel>
</rss>

