<?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 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528169#M572935</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;     can anybody give  all the FMs in ALV and their short description?&lt;/P&gt;&lt;P&gt;     what is the use of BLOCKED LIST... where we can use it ?&lt;/P&gt;&lt;P&gt;     and where we can use this HIRARCIAL LIST?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     thanks &amp;amp; regards &lt;/P&gt;&lt;P&gt;         kanny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jul 2007 06:01:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-19T06:01:50Z</dc:date>
    <item>
      <title>ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528169#M572935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;     can anybody give  all the FMs in ALV and their short description?&lt;/P&gt;&lt;P&gt;     what is the use of BLOCKED LIST... where we can use it ?&lt;/P&gt;&lt;P&gt;     and where we can use this HIRARCIAL LIST?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     thanks &amp;amp; regards &lt;/P&gt;&lt;P&gt;         kanny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 06:01:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528169#M572935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T06:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528170#M572936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Go to transaction SE37 and type REUSE&lt;STRONG&gt;ALV&lt;/STRONG&gt; and press F4. You wil get all the FMs used in ALV reporting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 06:05:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528170#M572936</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T06:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528171#M572937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;ALV - ABAP List Viewer&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV). &lt;/P&gt;&lt;P&gt;This helps us to implement all the features mentioned very effectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using ALV, We can have three types of reports:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Simple Report&lt;/P&gt;&lt;P&gt;2. Block Report&lt;/P&gt;&lt;P&gt;3. Hierarchical Sequential Report&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are some function modules which will enable to produce the above reports without much effort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;1. SIMPLE REPORT.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important function modules are &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. Reuse_alv_list_display&lt;/P&gt;&lt;P&gt;b. Reuse_alv_fieldcatalog_merge&lt;/P&gt;&lt;P&gt;c. Reuse_alv_events_get&lt;/P&gt;&lt;P&gt;d. Reuse_alv_commentary_write&lt;/P&gt;&lt;P&gt;e. Reuse_alv_grid_display&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important parameters are :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I. Export :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i. I_callback_program : report id&lt;/P&gt;&lt;P&gt;ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status&lt;/P&gt;&lt;P&gt;iii. I_callback_user_command : routine where the function codes are handled&lt;/P&gt;&lt;P&gt;iv. I_structure name : name of the dictionary table &lt;/P&gt;&lt;P&gt;v. Is_layout : structure to set the layout of the report&lt;/P&gt;&lt;P&gt;vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE&lt;/P&gt;&lt;P&gt;vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;II. Tables :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i. t_outtab : internal table with the data to be output&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Important Parameters are :&lt;/P&gt;&lt;P&gt;I. Export :&lt;/P&gt;&lt;P&gt;i. I_program_name : report id&lt;/P&gt;&lt;P&gt;ii. I_internal_tabname : the internal output table&lt;/P&gt;&lt;P&gt;iii. I_inclname : include or the report name where all the dynamic forms are handled.&lt;/P&gt;&lt;P&gt;II Changing&lt;/P&gt;&lt;P&gt;ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is &lt;/P&gt;&lt;P&gt;declared in the type pool SLIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : &lt;/P&gt;&lt;P&gt;I. Import :&lt;/P&gt;&lt;P&gt;Et_Events : The event table is returned with all possible CALLBACK events &lt;/P&gt;&lt;P&gt;for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV. &lt;/P&gt;&lt;P&gt;II. Export :&lt;/P&gt;&lt;P&gt;I_List_type : &lt;/P&gt;&lt;P&gt;0 = simple list REUSE_ALV_LIST_DISPLAY &lt;/P&gt;&lt;P&gt;1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY &lt;/P&gt;&lt;P&gt;2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND &lt;/P&gt;&lt;P&gt;3 = hierarchical-sequential block list &lt;/P&gt;&lt;P&gt;REUSE_ALV_BLOCK_LIST_HS_APPEND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I. it_list_commentary : internal table with the headings of the type slis_t_listheader.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This internal table has three fields :&lt;/P&gt;&lt;P&gt;Typ : &amp;#145;H&amp;#146; &amp;#150; header, &amp;#145;S&amp;#146; &amp;#150; selection , &amp;#145;A&amp;#146; - action&lt;/P&gt;&lt;P&gt;Key : only when typ is &amp;#145;S&amp;#146;.&lt;/P&gt;&lt;P&gt;Info : the text to be printed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : same as reuse_alv_list_display&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an example for simple list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;2. BLOCK REPORT&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is used to have multiple lists continuously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important functions used in this report are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. REUSE_ALV_BLOCK_LIST_INIT&lt;/P&gt;&lt;P&gt;B. REUSE_ALV_BLOCK_LIST_APPEND&lt;/P&gt;&lt;P&gt;C. REUSE_ALV_BLOCK_LIST_HS_APPEND&lt;/P&gt;&lt;P&gt;D. REUSE_ALV_BLOCK_LIST_DISPLAY&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;A. REUSE_ALV_BLOCK_LIST_INIT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters: &lt;/P&gt;&lt;P&gt;I. I_CALLBACK_PROGRAM &lt;/P&gt;&lt;P&gt;II. I_CALLBACK_PF_STATUS_SET &lt;/P&gt;&lt;P&gt;III. I_CALLBACK_USER_COMMAND &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module is used to set the default gui status etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B. REUSE_ALV_BLOCK_LIST_APPEND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Export : &lt;/P&gt;&lt;P&gt;I. is_layout : layout settings for block &lt;/P&gt;&lt;P&gt;II. it_fieldcat : field catalog &lt;/P&gt;&lt;P&gt;III. i_tabname : internal table name with output data &lt;/P&gt;&lt;P&gt;IV. it_events : internal table with all possible events&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tables :&lt;/P&gt;&lt;P&gt;i. t_outtab : internal table with output data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module adds the data to the block. &lt;/P&gt;&lt;P&gt;Repeat this function for all the different blocks to be displayed one after the other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C. REUSE_ALV_BLOCK_LIST_HS_APPEND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module is used for hierarchical sequential blocks. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D. REUSE_ALV_BLOCK_LIST_DISPLAY &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : All the parameters are optional. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module display the list with data appended by the above function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;3. Hierarchical reports :&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hierarchical sequential list output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function module is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. REUSE_ALV_HIERSEQ_LIST_DISPLAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters: &lt;/P&gt;&lt;P&gt;I. Export: &lt;/P&gt;&lt;P&gt;i. I_CALLBACK_PROGRAM &lt;/P&gt;&lt;P&gt;ii. I_CALLBACK_PF_STATUS_SET &lt;/P&gt;&lt;P&gt;iii. I_CALLBACK_USER_COMMAND &lt;/P&gt;&lt;P&gt;iv. IS_LAYOUT &lt;/P&gt;&lt;P&gt;v. IT_FIELDCAT &lt;/P&gt;&lt;P&gt;vi. IT_EVENTS &lt;/P&gt;&lt;P&gt;vii. i_tabname_header : Name of the internal table in the program containing the &lt;/P&gt;&lt;P&gt;output data of the highest hierarchy level.&lt;/P&gt;&lt;P&gt;viii. i_tabname_item : Name of the internal table in the program containing the &lt;/P&gt;&lt;P&gt;output data of the lowest hierarchy level.&lt;/P&gt;&lt;P&gt;ix. is_keyinfo : This structure contains the header and item table field &lt;/P&gt;&lt;P&gt;names which link the two tables (shared key). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;II. Tables&lt;/P&gt;&lt;P&gt;i. t_outtab_header : Header table with data to be output&lt;/P&gt;&lt;P&gt;ii. t_outtab_item : Name of the internal table in the program containing the &lt;/P&gt;&lt;P&gt;output data of the lowest hierarchy level. &lt;/P&gt;&lt;P&gt;slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using &amp;#145;REUSE_ALV_FIELDCATALOG_MERGE&amp;#146;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Important Attributes :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. col_pos : position of the column&lt;/P&gt;&lt;P&gt;B. fieldname : internal fieldname&lt;/P&gt;&lt;P&gt;C. tabname : internal table name&lt;/P&gt;&lt;P&gt;D. ref_fieldname : fieldname (dictionary)&lt;/P&gt;&lt;P&gt;E. ref_tabname : table (dictionary)&lt;/P&gt;&lt;P&gt;F. key(1) : column with key-color&lt;/P&gt;&lt;P&gt;G. icon(1) : icon&lt;/P&gt;&lt;P&gt;H. symbol(1) : symbol&lt;/P&gt;&lt;P&gt;I. checkbox(1) : checkbox&lt;/P&gt;&lt;P&gt;J. just(1) : (R)ight (L)eft (C)ent.&lt;/P&gt;&lt;P&gt;K. do_sum(1) : sum up&lt;/P&gt;&lt;P&gt;L. no_out(1) : (O)blig.(X)no out&lt;/P&gt;&lt;P&gt;M. outputlen : output length&lt;/P&gt;&lt;P&gt;N. seltext_l : long key word&lt;/P&gt;&lt;P&gt;O. seltext_m : middle key word&lt;/P&gt;&lt;P&gt;P. seltext_s : short key word&lt;/P&gt;&lt;P&gt;Q. reptext_ddic : heading (ddic)&lt;/P&gt;&lt;P&gt;R. ddictxt(1) : (S)hort (M)iddle (L)ong&lt;/P&gt;&lt;P&gt;S. datatype : datatype&lt;/P&gt;&lt;P&gt;T. hotspot(1) : hotspot &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the sample report&lt;/P&gt;&lt;P&gt;report ZRGRIRNA no standard page heading&lt;/P&gt;&lt;P&gt;line-count 65&lt;/P&gt;&lt;P&gt;line-size 255&lt;/P&gt;&lt;P&gt;message-id mm.&lt;/P&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;GR IR Detail 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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : The output has to be displayed&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in the ALV Grid format with the Selection *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;screen appearing on the output. In The Output *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Subtotals for Vendor, Plant, Period, Material,*&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Valuation Class, Purchase Order,Cost Center, *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Cost Element and Receipt Date are displayed *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;after sorting the data by same fields. *&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;Declaration for Tables&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;tables: t001, " Company Codes&lt;/P&gt;&lt;P&gt;t001w, " Plants/Branches&lt;/P&gt;&lt;P&gt;lfa1, " Vendor Master&lt;/P&gt;&lt;P&gt;ska1, " GL Account Master&lt;/P&gt;&lt;P&gt;mara, " Material Master&lt;/P&gt;&lt;P&gt;mbew, " Material Valuation&lt;/P&gt;&lt;P&gt;ekko, " PO Header Data&lt;/P&gt;&lt;P&gt;cska, " Cost Elements&lt;/P&gt;&lt;P&gt;csks, " Cost Centers&lt;/P&gt;&lt;P&gt;bsis, " GL Accounts: Open Items Data&lt;/P&gt;&lt;P&gt;bkpf. " Accounting Doc: Header Data&lt;/P&gt;&lt;P&gt;&lt;/P&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;Type-pools&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;Type pools for ALV display&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;type-pools : slis.&lt;/P&gt;&lt;P&gt;&lt;/P&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;Global variables&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;data: g_repid like sy-repid,&lt;/P&gt;&lt;P&gt;g_exit type c,&lt;/P&gt;&lt;P&gt;g_events type slis_t_event,&lt;/P&gt;&lt;P&gt;g_list_top_of_page type slis_t_listheader,&lt;/P&gt;&lt;P&gt;g_exit_caused_by_caller,&lt;/P&gt;&lt;P&gt;g_exit_caused_by_user type slis_exit_by_user,&lt;/P&gt;&lt;P&gt;g_top_of_page type slis_formname value 'TOP_OF_PAGE',&lt;/P&gt;&lt;P&gt;g_variant like disvariant,&lt;/P&gt;&lt;P&gt;g_save.&lt;/P&gt;&lt;P&gt;&lt;/P&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;Declaration for Constants&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;constants : c_x type c value 'X', " Flag&lt;/P&gt;&lt;P&gt;c_c type c value 'C', " Flag&lt;/P&gt;&lt;P&gt;c_l type c value 'L', " Flag&lt;/P&gt;&lt;P&gt;c_a type c value 'A', " Line Type&lt;/P&gt;&lt;P&gt;c_h type c value 'H', " Dr/Cr&lt;/P&gt;&lt;P&gt;c_s type c value 'S', " Line Type&lt;/P&gt;&lt;P&gt;c_mkpf(4) type c value 'MKPF'. " Table&lt;/P&gt;&lt;P&gt;&lt;/P&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;Declaration of Internal Tables&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;Internal Table for BSIS Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_bsis occurs 0,&lt;/P&gt;&lt;P&gt;bukrs like bsis-bukrs, " Company Code&lt;/P&gt;&lt;P&gt;hkont like bsis-hkont, " GR IR Account&lt;/P&gt;&lt;P&gt;gjahr like bsis-gjahr, " Fiscal Year&lt;/P&gt;&lt;P&gt;belnr like bsis-belnr, " Acc Document&lt;/P&gt;&lt;P&gt;buzei like bsis-buzei, " Item No&lt;/P&gt;&lt;P&gt;budat like bsis-budat, " Receipt Date(Posting)&lt;/P&gt;&lt;P&gt;monat like bsis-monat, " Period&lt;/P&gt;&lt;P&gt;end of i_bsis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for BSEG Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_bseg occurs 0,&lt;/P&gt;&lt;P&gt;bukrs like bsis-bukrs, " Company Code&lt;/P&gt;&lt;P&gt;belnr like bsis-belnr, " Acc Document&lt;/P&gt;&lt;P&gt;buzei like bsis-buzei, " Item No&lt;/P&gt;&lt;P&gt;gjahr like bsis-gjahr, " Fiscal Year&lt;/P&gt;&lt;P&gt;shkzg like bseg-shkzg, " Dr/Cr Indicator&lt;/P&gt;&lt;P&gt;lifnr like bseg-lifnr, " Vendor Code&lt;/P&gt;&lt;P&gt;matnr like bseg-matnr, " Material No&lt;/P&gt;&lt;P&gt;ebeln like bseg-ebeln, " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp like bseg-ebelp, " PO Item&lt;/P&gt;&lt;P&gt;werks like bseg-werks, " Plant&lt;/P&gt;&lt;P&gt;menge like bseg-menge, " PO Quantity&lt;/P&gt;&lt;P&gt;meins like bseg-meins, " UOM&lt;/P&gt;&lt;P&gt;dmbtr like bseg-dmbtr, " Amount in Local Currency&lt;/P&gt;&lt;P&gt;wrbtr like bseg-wrbtr, " Amount in Trans.Currency&lt;/P&gt;&lt;P&gt;end of i_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for BKPF Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_bkpf occurs 0,&lt;/P&gt;&lt;P&gt;bukrs like bkpf-bukrs, " Company Code&lt;/P&gt;&lt;P&gt;belnr like bkpf-belnr, " Acc Document&lt;/P&gt;&lt;P&gt;gjahr like bkpf-gjahr, " Fiscal Year&lt;/P&gt;&lt;P&gt;waers like bkpf-waers, " Trans. Currency&lt;/P&gt;&lt;P&gt;awkey like bkpf-awkey, " Object Key&lt;/P&gt;&lt;P&gt;awtyp like bkpf-awtyp, " Reference Procedure&lt;/P&gt;&lt;P&gt;end of i_bkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for MSEG Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_mseg occurs 0,&lt;/P&gt;&lt;P&gt;mblnr like mseg-mblnr, " Material Document&lt;/P&gt;&lt;P&gt;mjahr like mseg-mjahr, " Fiscal Year&lt;/P&gt;&lt;P&gt;bwart like mseg-bwart, " Movement Type&lt;/P&gt;&lt;P&gt;matnr like mseg-matnr, " Material No&lt;/P&gt;&lt;P&gt;menge like mseg-menge, " PO Quantity&lt;/P&gt;&lt;P&gt;meins like mseg-meins, " UOM&lt;/P&gt;&lt;P&gt;end of i_mseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for MBEW Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_mbew occurs 0,&lt;/P&gt;&lt;P&gt;matnr like mbew-matnr, " Material No&lt;/P&gt;&lt;P&gt;werks like mbew-bwkey, " Plant&lt;/P&gt;&lt;P&gt;bklas like mbew-bklas, " Valuation Class&lt;/P&gt;&lt;P&gt;end of i_mbew.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for EKPO Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_ekpo occurs 0,&lt;/P&gt;&lt;P&gt;ebeln like ekpo-ebeln, " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp like ekpo-ebelp, " PO Item&lt;/P&gt;&lt;P&gt;matnr like ekpo-matnr, " Material No&lt;/P&gt;&lt;P&gt;txz01 like ekpo-txz01, " Material Text&lt;/P&gt;&lt;P&gt;end of i_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for EKKN Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_ekkn occurs 0,&lt;/P&gt;&lt;P&gt;ebeln like ekkn-ebeln, " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp like ekkn-ebelp, " PO Item&lt;/P&gt;&lt;P&gt;kostl like ekkn-kostl, " Cost Center&lt;/P&gt;&lt;P&gt;sakto like ekkn-sakto, " Cost Element&lt;/P&gt;&lt;P&gt;end of i_ekkn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for LFA1 Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_lfa1 occurs 0,&lt;/P&gt;&lt;P&gt;lifnr like lfa1-lifnr, " Vendor&lt;/P&gt;&lt;P&gt;name1 like lfa1-name1, " Name&lt;/P&gt;&lt;P&gt;end of i_lfa1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declaration of Output Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_final occurs 0,&lt;/P&gt;&lt;P&gt;lifnr like lfa1-lifnr, " Vendor&lt;/P&gt;&lt;P&gt;werks like bseg-werks, " Plant&lt;/P&gt;&lt;P&gt;monat like bsis-monat, " Period&lt;/P&gt;&lt;P&gt;matnr like mara-matnr, " Material Number&lt;/P&gt;&lt;P&gt;bklas like mbew-bklas, " Val Class&lt;/P&gt;&lt;P&gt;ebeln like bseg-ebeln, " PO&lt;/P&gt;&lt;P&gt;kostl like ekkn-kostl, " Cost Center&lt;/P&gt;&lt;P&gt;sakto like ekkn-sakto, " Cost Element&lt;/P&gt;&lt;P&gt;budat like bsis-budat, " Rec. Date&lt;/P&gt;&lt;P&gt;name1 like lfa1-name1, " Vendor Name&lt;/P&gt;&lt;P&gt;belnr like bsis-belnr, " FI Document&lt;/P&gt;&lt;P&gt;bwart like mseg-bwart, " Movement Type&lt;/P&gt;&lt;P&gt;txz01 like ekpo-txz01, " Material Text&lt;/P&gt;&lt;P&gt;menge like bseg-menge, " Quantity&lt;/P&gt;&lt;P&gt;meins like bseg-meins, " UOM&lt;/P&gt;&lt;P&gt;dmbtr like bseg-dmbtr, " Local Amount&lt;/P&gt;&lt;P&gt;wrbtr like bseg-wrbtr, " Tran.Amount&lt;/P&gt;&lt;P&gt;waers like bkpf-waers, " Tran.Currency&lt;/P&gt;&lt;P&gt;status type c, " Material Status&lt;/P&gt;&lt;P&gt;end of i_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table to hold field catgory data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: i_fldcat type slis_t_fieldcat_alv. " Table - field catgory&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table to hold Sort/Subtotals criteria data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: i_sort type slis_t_sortinfo_alv. " Table - sort/Subtotals&lt;/P&gt;&lt;P&gt;&lt;/P&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;Structure&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;data: x_layout type slis_layout_alv, " Structure-layout&lt;/P&gt;&lt;P&gt;x_fldcat like line of i_fldcat, " Structure-field catagory&lt;/P&gt;&lt;P&gt;x_sort like line of i_sort. " Structure-Sort/Subtotals&lt;/P&gt;&lt;P&gt;&lt;/P&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;Selection screen&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;selection-screen : begin of block b1 with frame title text-000.&lt;/P&gt;&lt;P&gt;parameters:&lt;/P&gt;&lt;P&gt;p_bukrs like t001-bukrs obligatory, " Company Code&lt;/P&gt;&lt;P&gt;p_grira like ska1-saknr default '0241101000' obligatory. " Account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options:&lt;/P&gt;&lt;P&gt;s_budat for bkpf-budat, " Posting Date&lt;/P&gt;&lt;P&gt;s_werks for t001w-werks, " Plant&lt;/P&gt;&lt;P&gt;s_lifnr for lfa1-lifnr, " Vendor&lt;/P&gt;&lt;P&gt;s_matnr for mara-matnr, " Material Number&lt;/P&gt;&lt;P&gt;s_kostl for csks-kostl, " Cost Center&lt;/P&gt;&lt;P&gt;s_kstar for cska-kstar, " Cost Element&lt;/P&gt;&lt;P&gt;s_ebeln for ekko-ebeln, " Purchase Order&lt;/P&gt;&lt;P&gt;s_monat for bsis-monat. " Period&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen skip.&lt;/P&gt;&lt;P&gt;parameters:&lt;/P&gt;&lt;P&gt;p_incmt as checkbox default 'X',&lt;/P&gt;&lt;P&gt;p_incnm as checkbox default 'X'.&lt;/P&gt;&lt;P&gt;&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;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;Initialization&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;initialization.&lt;/P&gt;&lt;P&gt;g_repid = sy-repid.&lt;/P&gt;&lt;P&gt;perform layout_init using x_layout.&lt;/P&gt;&lt;P&gt;perform eventtab_build using g_events[].&lt;/P&gt;&lt;P&gt;g_variant-report = g_repid.&lt;/P&gt;&lt;P&gt;g_save = 'A'.&lt;/P&gt;&lt;P&gt;&lt;/P&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;At selection screen&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;at selection-screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Selection Screen Fields&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform validate_screen.&lt;/P&gt;&lt;P&gt;&lt;/P&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;Start of selection&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;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read Data from Database Tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform read_data.&lt;/P&gt;&lt;P&gt;&lt;/P&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;End of selection&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;end-of-selection.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build layout report layout.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform populate_layout_stucture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Perform build_field_catalog and Sort Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform build_field_catalog.&lt;/P&gt;&lt;P&gt;perform build_sort_totals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;List Header for Top-Of-Page&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform comment_build using g_list_top_of_page[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call list viewer function module&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform call_list_viewer .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;****************&lt;STRONG&gt;Form - Routines&lt;/STRONG&gt;**************************************&lt;/P&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;Form : layout_init&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Form to Build layout for list display&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 layout_init using rs_layout type slis_layout_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rs_layout-detail_popup = c_x.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&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;Form : Eventtab_build&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Registration of events to happen during list display&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 eventtab_build using rt_events type slis_t_event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Registration of events to happen during list display&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: ls_event type slis_alv_event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_EVENTS_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;i_list_type = 0&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;et_events = rt_events.&lt;/P&gt;&lt;P&gt;read table rt_events with key name = slis_ev_top_of_page&lt;/P&gt;&lt;P&gt;into ls_event.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;move g_top_of_page to ls_event-form.&lt;/P&gt;&lt;P&gt;append ls_event to rt_events.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "eventtab_build&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form : top_of_page&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;*&lt;/P&gt;&lt;P&gt;form top_of_page.&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_COMMENTARY_WRITE'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;I_LOGO = 'ENJOYSAP_LOGO'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;it_list_commentary = g_list_top_of_page.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form validate_screen&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;Validation of Selection Screen fields&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 validate_screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Company Code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear t001.&lt;/P&gt;&lt;P&gt;if not p_bukrs is initial.&lt;/P&gt;&lt;P&gt;select single bukrs&lt;/P&gt;&lt;P&gt;into t001-bukrs&lt;/P&gt;&lt;P&gt;from t001&lt;/P&gt;&lt;P&gt;where bukrs eq p_bukrs.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Company Code'(012).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of GL Account (GR/IR)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear ska1.&lt;/P&gt;&lt;P&gt;if not p_grira is initial.&lt;/P&gt;&lt;P&gt;select saknr&lt;/P&gt;&lt;P&gt;into ska1-saknr&lt;/P&gt;&lt;P&gt;from ska1&lt;/P&gt;&lt;P&gt;up to 1 rows&lt;/P&gt;&lt;P&gt;where saknr eq p_grira.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid GR/IR Account'(013).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Vendor Code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear lfa1.&lt;/P&gt;&lt;P&gt;if not s_lifnr[] is initial.&lt;/P&gt;&lt;P&gt;select single lifnr&lt;/P&gt;&lt;P&gt;into lfa1-lifnr&lt;/P&gt;&lt;P&gt;from lfa1&lt;/P&gt;&lt;P&gt;where lifnr in s_lifnr.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Vendor'(001).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Plant Code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear t001w.&lt;/P&gt;&lt;P&gt;if not s_werks[] is initial.&lt;/P&gt;&lt;P&gt;select single werks&lt;/P&gt;&lt;P&gt;into t001w-werks&lt;/P&gt;&lt;P&gt;from t001w&lt;/P&gt;&lt;P&gt;where werks in s_werks.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Plant'(014).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Material Code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear mara.&lt;/P&gt;&lt;P&gt;if not s_matnr[] is initial.&lt;/P&gt;&lt;P&gt;select single matnr&lt;/P&gt;&lt;P&gt;into mara-matnr&lt;/P&gt;&lt;P&gt;from mara&lt;/P&gt;&lt;P&gt;where matnr in s_matnr.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Material'(015).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Purchase Order&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear ekko.&lt;/P&gt;&lt;P&gt;if not s_ebeln[] is initial.&lt;/P&gt;&lt;P&gt;select single ebeln&lt;/P&gt;&lt;P&gt;into ekko-ebeln&lt;/P&gt;&lt;P&gt;from ekko&lt;/P&gt;&lt;P&gt;where ebeln in s_ebeln.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Purchase Order'(016).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Cost Center&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear csks.&lt;/P&gt;&lt;P&gt;if not s_kostl[] is initial.&lt;/P&gt;&lt;P&gt;select kostl&lt;/P&gt;&lt;P&gt;into csks-kostl&lt;/P&gt;&lt;P&gt;from csks&lt;/P&gt;&lt;P&gt;up to 1 rows&lt;/P&gt;&lt;P&gt;where kostl in s_kostl.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Cost Center'(017).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Cost Element&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear cska.&lt;/P&gt;&lt;P&gt;if not s_kstar[] is initial.&lt;/P&gt;&lt;P&gt;select kstar&lt;/P&gt;&lt;P&gt;into cska-kstar&lt;/P&gt;&lt;P&gt;from cska&lt;/P&gt;&lt;P&gt;up to 1 rows&lt;/P&gt;&lt;P&gt;where kstar in s_kstar.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Cost Element'(018).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "validate_screen&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 read_data&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;Read the Data from the database Tables&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 read_data.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Accounting Documents for the GR/IR Account Entered on&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Selection Screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_bsis.&lt;/P&gt;&lt;P&gt;refresh i_bsis.&lt;/P&gt;&lt;P&gt;select bukrs " Company Code&lt;/P&gt;&lt;P&gt;hkont " GR IR Account&lt;/P&gt;&lt;P&gt;gjahr " Fiscal Year&lt;/P&gt;&lt;P&gt;belnr " Acc Document&lt;/P&gt;&lt;P&gt;buzei " Item No&lt;/P&gt;&lt;P&gt;budat " Receipt Date(Posting)&lt;/P&gt;&lt;P&gt;monat " Period&lt;/P&gt;&lt;P&gt;into table i_bsis&lt;/P&gt;&lt;P&gt;from bsis&lt;/P&gt;&lt;P&gt;where bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;and hkont = p_grira&lt;/P&gt;&lt;P&gt;and budat in s_budat&lt;/P&gt;&lt;P&gt;and monat in s_monat .&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 i899 with 'No data found'(043).&lt;/P&gt;&lt;P&gt;g_exit = c_x.&lt;/P&gt;&lt;P&gt;stop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_bsis by bukrs hkont gjahr belnr buzei.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Vendor,PO,Material,Qty details from BSEG Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if not i_bsis[] is initial.&lt;/P&gt;&lt;P&gt;clear i_bseg.&lt;/P&gt;&lt;P&gt;refresh i_bseg.&lt;/P&gt;&lt;P&gt;select bukrs " Company Code&lt;/P&gt;&lt;P&gt;belnr " Acc Document&lt;/P&gt;&lt;P&gt;buzei " Item No&lt;/P&gt;&lt;P&gt;gjahr " Fiscal Year&lt;/P&gt;&lt;P&gt;shkzg " Dr/Cr Indicator&lt;/P&gt;&lt;P&gt;lifnr " Vendor Code&lt;/P&gt;&lt;P&gt;matnr " Material No&lt;/P&gt;&lt;P&gt;ebeln " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp " PO Item&lt;/P&gt;&lt;P&gt;werks " Plant&lt;/P&gt;&lt;P&gt;menge " PO Quantity&lt;/P&gt;&lt;P&gt;meins " UOM&lt;/P&gt;&lt;P&gt;dmbtr " Amount in Local Currency&lt;/P&gt;&lt;P&gt;wrbtr " Amount in Trans.Currency&lt;/P&gt;&lt;P&gt;into table i_bseg&lt;/P&gt;&lt;P&gt;from bseg&lt;/P&gt;&lt;P&gt;for all entries in i_bsis&lt;/P&gt;&lt;P&gt;where bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;and belnr = i_bsis-belnr&lt;/P&gt;&lt;P&gt;and gjahr = i_bsis-gjahr&lt;/P&gt;&lt;P&gt;and buzei = i_bsis-buzei&lt;/P&gt;&lt;P&gt;and lifnr in s_lifnr&lt;/P&gt;&lt;P&gt;and werks in s_werks&lt;/P&gt;&lt;P&gt;and matnr in s_matnr&lt;/P&gt;&lt;P&gt;and ebeln in s_ebeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_bseg by bukrs belnr buzei gjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Select the Trans.Currency from BKPF Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_bkpf.&lt;/P&gt;&lt;P&gt;refresh i_bkpf.&lt;/P&gt;&lt;P&gt;select bukrs " Company Code&lt;/P&gt;&lt;P&gt;belnr " Acc Document&lt;/P&gt;&lt;P&gt;gjahr " Fiscal Year&lt;/P&gt;&lt;P&gt;waers " Trans. Currency&lt;/P&gt;&lt;P&gt;awkey " Object Key&lt;/P&gt;&lt;P&gt;awtyp " Reference Procedure&lt;/P&gt;&lt;P&gt;into table i_bkpf&lt;/P&gt;&lt;P&gt;from bkpf&lt;/P&gt;&lt;P&gt;for all entries in i_bsis&lt;/P&gt;&lt;P&gt;where bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;and belnr = i_bsis-belnr&lt;/P&gt;&lt;P&gt;and gjahr = i_bsis-gjahr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;sort i_bkpf by bukrs belnr gjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Quantity and UOM of Material from MSEG Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if not i_bkpf[] is initial.&lt;/P&gt;&lt;P&gt;clear i_mseg.&lt;/P&gt;&lt;P&gt;refresh i_mseg.&lt;/P&gt;&lt;P&gt;select mblnr " Material Document&lt;/P&gt;&lt;P&gt;mjahr " Fiscal Year&lt;/P&gt;&lt;P&gt;bwart " Movement Type&lt;/P&gt;&lt;P&gt;matnr " Material No&lt;/P&gt;&lt;P&gt;menge " PO Quantity&lt;/P&gt;&lt;P&gt;meins " UOM&lt;/P&gt;&lt;P&gt;into table i_mseg&lt;/P&gt;&lt;P&gt;from mseg&lt;/P&gt;&lt;P&gt;for all entries in i_bkpf&lt;/P&gt;&lt;P&gt;where mblnr = i_bkpf-awkey(10).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;sort i_mseg by mblnr mjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Material And Description from EKPO Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not i_bseg[] is initial.&lt;/P&gt;&lt;P&gt;clear i_ekpo.&lt;/P&gt;&lt;P&gt;refresh i_ekpo.&lt;/P&gt;&lt;P&gt;select ebeln " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp " PO Item&lt;/P&gt;&lt;P&gt;matnr " Material No&lt;/P&gt;&lt;P&gt;txz01 " Material Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;into table i_ekpo&lt;/P&gt;&lt;P&gt;from ekpo&lt;/P&gt;&lt;P&gt;for all entries in i_bseg&lt;/P&gt;&lt;P&gt;where ebeln = i_bseg-ebeln&lt;/P&gt;&lt;P&gt;and ebelp = i_bseg-ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_ekpo by ebeln ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Valuation Class from MBEW Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_mbew.&lt;/P&gt;&lt;P&gt;refresh i_mbew.&lt;/P&gt;&lt;P&gt;select matnr " Material No&lt;/P&gt;&lt;P&gt;bwkey " Plant&lt;/P&gt;&lt;P&gt;bklas " Valuation Class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;into table i_mbew&lt;/P&gt;&lt;P&gt;from mbew&lt;/P&gt;&lt;P&gt;for all entries in i_bseg&lt;/P&gt;&lt;P&gt;where matnr = i_bseg-matnr&lt;/P&gt;&lt;P&gt;and bwkey = i_bseg-werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_mbew by matnr werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Cost Center and Cost Element of the PO from EKKN Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_ekkn.&lt;/P&gt;&lt;P&gt;refresh i_ekkn.&lt;/P&gt;&lt;P&gt;select ebeln " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp " PO Item&lt;/P&gt;&lt;P&gt;kostl " Cost Center&lt;/P&gt;&lt;P&gt;sakto " Cost Element&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;into table i_ekkn&lt;/P&gt;&lt;P&gt;from ekkn&lt;/P&gt;&lt;P&gt;for all entries in i_bseg&lt;/P&gt;&lt;P&gt;where ebeln = i_bseg-ebeln&lt;/P&gt;&lt;P&gt;and ebelp = i_bseg-ebelp&lt;/P&gt;&lt;P&gt;and kostl in s_kostl&lt;/P&gt;&lt;P&gt;and sakto in s_kstar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_ekkn by ebeln ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Vendor Name&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_lfa1.&lt;/P&gt;&lt;P&gt;refresh i_lfa1.&lt;/P&gt;&lt;P&gt;select lifnr " Vendor&lt;/P&gt;&lt;P&gt;name1 " Name&lt;/P&gt;&lt;P&gt;into table i_lfa1&lt;/P&gt;&lt;P&gt;from lfa1&lt;/P&gt;&lt;P&gt;for all entries in i_bseg&lt;/P&gt;&lt;P&gt;where lifnr = i_bseg-lifnr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;sort i_lfa1 by lifnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Move the data to Final Output Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;loop at i_bsis.&lt;/P&gt;&lt;P&gt;i_final-belnr = i_bsis-belnr. " FI Document&lt;/P&gt;&lt;P&gt;i_final-monat = i_bsis-monat. " Period&lt;/P&gt;&lt;P&gt;i_final-budat = i_bsis-budat. " Rec. Date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Transaction Currency from BKPF Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_bkpf with key bukrs = i_bsis-bukrs&lt;/P&gt;&lt;P&gt;belnr = i_bsis-belnr&lt;/P&gt;&lt;P&gt;gjahr = i_bsis-gjahr&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-waers = i_bkpf-waers. " Tran.Currency&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Movement Type for all Material Related&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Documents from MSEG Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if i_bkpf-awtyp = c_mkpf.&lt;/P&gt;&lt;P&gt;read table i_mseg with key mblnr = i_bkpf-awkey(10)&lt;/P&gt;&lt;P&gt;mjahr = i_bkpf-awkey+10(4).&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-bwart = i_mseg-bwart. " Movement Type&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read Vendor, Plant, PO Document, Local And Trans.Amounts&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from BSEG Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_bseg with key bukrs = i_bsis-bukrs&lt;/P&gt;&lt;P&gt;belnr = i_bsis-belnr&lt;/P&gt;&lt;P&gt;gjahr = i_bsis-gjahr&lt;/P&gt;&lt;P&gt;buzei = i_bsis-buzei&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-lifnr = i_bseg-lifnr. " Vendor&lt;/P&gt;&lt;P&gt;i_final-werks = i_bseg-werks. " Plant&lt;/P&gt;&lt;P&gt;i_final-ebeln = i_bseg-ebeln. " PO&lt;/P&gt;&lt;P&gt;i_final-dmbtr = i_bseg-dmbtr. " Local Amount&lt;/P&gt;&lt;P&gt;i_final-wrbtr = i_bseg-wrbtr. " Tran.Amount&lt;/P&gt;&lt;P&gt;i_final-menge = i_bseg-menge. " Quantity&lt;/P&gt;&lt;P&gt;i_final-meins = i_bseg-meins. " UOM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For Credit Indicator(SHKZG = H) amounts should be (-)ve&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if i_bseg-shkzg = c_h.&lt;/P&gt;&lt;P&gt;i_final-dmbtr = i_final-dmbtr * -1.&lt;/P&gt;&lt;P&gt;i_final-wrbtr = i_final-wrbtr * -1.&lt;/P&gt;&lt;P&gt;i_final-menge = i_final-menge * -1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Material and its Description from EKPO Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_ekpo with key ebeln = i_bseg-ebeln&lt;/P&gt;&lt;P&gt;ebelp = i_bseg-ebelp&lt;/P&gt;&lt;P&gt;matnr = i_bseg-matnr&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-matnr = i_ekpo-matnr. " Material Number&lt;/P&gt;&lt;P&gt;i_final-txz01 = i_ekpo-txz01. " Material Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate the Material Status depending on the Input Checkbox&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;On Selection Screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if not i_ekpo-matnr is initial.&lt;/P&gt;&lt;P&gt;i_final-status = c_x.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the PO related Cost Element and Cost Centers&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from EKKN Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_ekkn with key ebeln = i_bseg-ebeln&lt;/P&gt;&lt;P&gt;ebelp = i_bseg-ebelp&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-kostl = i_ekkn-kostl. " Cost Center&lt;/P&gt;&lt;P&gt;i_final-sakto = i_ekkn-sakto. " Cost Element&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Valuation Class from MBEW Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_mbew with key matnr = i_bseg-matnr&lt;/P&gt;&lt;P&gt;werks = i_bseg-werks&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-bklas = i_mbew-bklas. " Val Class&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Vendor Name from LFA1 Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_lfa1 with key lifnr = i_bseg-lifnr&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-name1 = i_lfa1-name1. " Vendor Name&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append i_final.&lt;/P&gt;&lt;P&gt;clear i_final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_final by lifnr werks monat matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Depending on the check Box Selected display the data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if p_incmt = c_x and p_incnm ne c_x.&lt;/P&gt;&lt;P&gt;delete i_final where matnr eq space.&lt;/P&gt;&lt;P&gt;elseif p_incnm = c_x and p_incmt ne c_x.&lt;/P&gt;&lt;P&gt;delete i_final where matnr ne space.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "Read Data&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form : populate_layout_stucture&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Populating the layout structure&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 populate_layout_stucture.&lt;/P&gt;&lt;P&gt;clear x_layout .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Layout properties&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;x_layout-zebra = c_x.&lt;/P&gt;&lt;P&gt;x_layout-detail_popup = c_x.&lt;/P&gt;&lt;P&gt;x_layout-detail_initial_lines = c_x.&lt;/P&gt;&lt;P&gt;x_layout-colwidth_optimize = c_x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " populate_layout_stucture&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form : build_field_catalog&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Building the field catalog data&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_field_catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;i_program_name = g_repid&lt;/P&gt;&lt;P&gt;i_internal_tabname = 'I_FINAL'&lt;/P&gt;&lt;P&gt;i_inclname = g_repid&lt;/P&gt;&lt;P&gt;changing&lt;/P&gt;&lt;P&gt;ct_fieldcat = i_fldcat&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;inconsistent_interface = 1&lt;/P&gt;&lt;P&gt;program_error = 2&lt;/P&gt;&lt;P&gt;others = 3.&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Getting the Header text for the coloums&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;loop at i_fldcat into x_fldcat where fieldname = 'LIFNR' or&lt;/P&gt;&lt;P&gt;fieldname = 'NAME1' or&lt;/P&gt;&lt;P&gt;fieldname = 'WERKS' or&lt;/P&gt;&lt;P&gt;fieldname = 'MONAT' or&lt;/P&gt;&lt;P&gt;fieldname = 'MATNR' or&lt;/P&gt;&lt;P&gt;fieldname = 'BKLAS' or&lt;/P&gt;&lt;P&gt;fieldname = 'EBELN' or&lt;/P&gt;&lt;P&gt;fieldname = 'KOSTL' or&lt;/P&gt;&lt;P&gt;fieldname = 'SAKTO' or&lt;/P&gt;&lt;P&gt;fieldname = 'BUDAT' or&lt;/P&gt;&lt;P&gt;fieldname = 'BELNR' or&lt;/P&gt;&lt;P&gt;fieldname = 'BWART' or&lt;/P&gt;&lt;P&gt;fieldname = 'TXZ01' or&lt;/P&gt;&lt;P&gt;fieldname = 'MENGE' or&lt;/P&gt;&lt;P&gt;fieldname = 'MEINS' or&lt;/P&gt;&lt;P&gt;fieldname = 'DMBTR' or&lt;/P&gt;&lt;P&gt;fieldname = 'WRBTR' or&lt;/P&gt;&lt;P&gt;fieldname = 'WAERS' or&lt;/P&gt;&lt;P&gt;fieldname = 'STATUS'.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'LIFNR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Vendor'(003).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Vendor'(003).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Vendor'(003).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Vendor'(003).&lt;/P&gt;&lt;P&gt;x_fldcat-inttype = c_c.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'NAME1'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Vendor Name'(002).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Vendor Name'(002).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Vendor Name'(002).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Vendor Name'(002).&lt;/P&gt;&lt;P&gt;x_fldcat-inttype = c_c.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'WERKS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Plant'(010).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Plant'(010).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Plant'(010).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Plant'(010).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'MONAT'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Period'(011).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Period'(011).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Period'(011).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Period'(011).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'MATNR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Material'(004).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Material'(004).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Material'(004).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Material'(004).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'BKLAS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Valuation Class'(009).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Valuation Class'(009).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Valuation Class'(009).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Valuation Class'(009).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'EBELN'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Purchase Order'(005).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Purchase Order'(005).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Purchase Order'(005).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Purchase Order'(005).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'KOSTL'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Cost Center'(006).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Cost Center'(006).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Cost Center'(006).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Cost Center'(006).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'SAKTO'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Cost Element'(007).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Cost Element'(007).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Cost Element'(007).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Cost Element'(007).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'BUDAT'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Receipt Date'(008).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Receipt Date'(008).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Receipt Date'(008).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Receipt Date'(008).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'BELNR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Acc.Document'(100).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Acc.Document'(100).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Acc.Document'(100).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Acc.Document'(100).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'BWART'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Movement Type'(101).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Movement Type'(101).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Movement Type'(101).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Movement Type'(101).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'TXZ01'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Material Text'(102).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Material Text'(102).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Material Text'(102).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Material Text'(102).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'MENGE'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Quantity'(103).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Quantity'(103).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Quantity'(103).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Quantity'(103).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;x_fldcat-do_sum = c_x.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'MEINS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'UOM'(104).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'UOM'(104).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'UOM'(104).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'UOM'(104).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'DMBTR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Amount in Local Curr'(105).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Amount in Local Curr'(105).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Amount in Local Curr'(105).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Amount in Local Curr'(105).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;x_fldcat-do_sum = c_x.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'WRBTR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Amount in Trans.Curr'(106).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Amount in Trans.Curr'(106).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Amount in Trans.Curr'(106).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Amount in Trans.Curr'(106).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;x_fldcat-do_sum = c_x.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'WAERS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Trans.Currency'(107).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Trans.Currency'(107).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Trans.Currency'(107).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Trans.Currency'(107).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'STATUS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Material Status'(019).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Material Status'(019).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Material Status'(019).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Material Status'(019).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify i_fldcat from x_fldcat index sy-tabix.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_field_catalog&lt;/P&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;Form : build_sort_totals&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Building the Criteria for Sort/Subtotals&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_sort_totals.&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'LIFNR'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 1.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'WERKS'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 2.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'MONAT'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 3.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'MATNR'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 4.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'BKLAS'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 5.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'EBELN'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 6.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'KOSTL'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 7.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'SAKTO'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 8.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'BUDAT'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 9.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_sort_totals&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form : comment_build&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : This form is used to display the Report Header(ALV)&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;*&lt;/P&gt;&lt;P&gt;form comment_build using lt_top_of_page type&lt;/P&gt;&lt;P&gt;slis_t_listheader.&lt;/P&gt;&lt;P&gt;data: l_line type slis_listheader,&lt;/P&gt;&lt;P&gt;l_heading1 like rs38m-repti,&lt;/P&gt;&lt;P&gt;l_date(10), l_time(8).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear l_line.&lt;/P&gt;&lt;P&gt;l_heading1 = 'GR/IR DETAIL REPORT'(021).&lt;/P&gt;&lt;P&gt;g_repid = sy-repid.&lt;/P&gt;&lt;P&gt;write sy-uzeit to l_time.&lt;/P&gt;&lt;P&gt;write sy-datum to l_date.&lt;/P&gt;&lt;P&gt;l_line-typ = c_h.&lt;/P&gt;&lt;P&gt;move l_heading1 to l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear l_line.&lt;/P&gt;&lt;P&gt;l_line-typ = c_s.&lt;/P&gt;&lt;P&gt;concatenate 'System:'(023) sy-sysid&lt;/P&gt;&lt;P&gt;'Date:'(024) l_date&lt;/P&gt;&lt;P&gt;' Time:'(025)&lt;/P&gt;&lt;P&gt;l_time into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate 'Report:'(026) g_repid&lt;/P&gt;&lt;P&gt;' User:'(027) sy-uname into&lt;/P&gt;&lt;P&gt;l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;l_line-typ = c_a.&lt;/P&gt;&lt;P&gt;move 'SELECTION CRITERIA:'(028) to l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Company Code : '(029)&lt;/P&gt;&lt;P&gt;p_bukrs into l_line-info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' GR/IR Account: '(030)&lt;/P&gt;&lt;P&gt;p_grira into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Posting Date : '(032) s_budat-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_budat-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Plant : '(033) s_werks-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_werks-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Vendor: '(034) s_lifnr-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_lifnr-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Material: '(035) s_matnr-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_matnr-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Cost Center : '(036) s_kostl-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_kostl-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Cost Element: '(037) s_kstar-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_kstar-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Purchase Order: '(038) s_ebeln-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_ebeln-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Period : '(039) s_monat-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_monat-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Include Material Items: '(040)&lt;/P&gt;&lt;P&gt;p_incmt into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Include Non-Material Items: '(041)&lt;/P&gt;&lt;P&gt;p_incnm into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&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;Form : call_list_viewer&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : This form is used to display the grid through ALV&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 call_list_viewer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;i_callback_program = g_repid&lt;/P&gt;&lt;P&gt;is_layout = x_layout&lt;/P&gt;&lt;P&gt;it_fieldcat = i_fldcat[]&lt;/P&gt;&lt;P&gt;i_default = c_x&lt;/P&gt;&lt;P&gt;it_sort = i_sort[]&lt;/P&gt;&lt;P&gt;i_save = g_save&lt;/P&gt;&lt;P&gt;is_variant = g_variant&lt;/P&gt;&lt;P&gt;it_events = g_events[]&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;e_exit_caused_by_caller = g_exit_caused_by_caller&lt;/P&gt;&lt;P&gt;es_exit_caused_by_user = g_exit_caused_by_user&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;t_outtab = i_final&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;write: / 'Problem in calling the ALV report'(042).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " call_list_viewer&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;***Reward Points if Useful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gokul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 06:09:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528171#M572937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T06:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528172#M572938</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 commonly used ALV functions used for this purpose are; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. REUSE_ALV_VARIANT_DEFAULT_GET &lt;/P&gt;&lt;P&gt;2. REUSE_ALV_VARIANT_F4 &lt;/P&gt;&lt;P&gt;3. REUSE_ALV_VARIANT_EXISTENCE &lt;/P&gt;&lt;P&gt;4. REUSE_ALV_EVENTS_GET &lt;/P&gt;&lt;P&gt;5. REUSE_ALV_COMMENTARY_WRITE &lt;/P&gt;&lt;P&gt;6. REUSE_ALV_FIELDCATALOG_MERGE &lt;/P&gt;&lt;P&gt;7. REUSE_ALV_LIST_DISPLAY &lt;/P&gt;&lt;P&gt;8. REUSE_ALV_GRID_DISPLAY &lt;/P&gt;&lt;P&gt;9. REUSE_ALV_POPUP_TO_SELECT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Look at the Demo Progrmas&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt; Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 06:11:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528172#M572938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T06:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528173#M572939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;ABAP List Viewer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV). &lt;/P&gt;&lt;P&gt;This helps us to implement all the features mentioned very effectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using ALV, We can have three types of reports:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Simple Report&lt;/P&gt;&lt;P&gt;2. Block Report&lt;/P&gt;&lt;P&gt;3. Hierarchical Sequential Report&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are some function modules which will enable to produce the above reports without much effort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. SIMPLE REPORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important function modules are &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. Reuse_alv_list_display&lt;/P&gt;&lt;P&gt;b. Reuse_alv_fieldcatalog_merge&lt;/P&gt;&lt;P&gt;c. Reuse_alv_events_get&lt;/P&gt;&lt;P&gt;d. Reuse_alv_commentary_write&lt;/P&gt;&lt;P&gt;e. Reuse_alv_grid_display&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important parameters are :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I. Export :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i. I_callback_program : report id&lt;/P&gt;&lt;P&gt;ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status&lt;/P&gt;&lt;P&gt;iii. I_callback_user_command : routine where the function codes are handled&lt;/P&gt;&lt;P&gt;iv. I_structure name : name of the dictionary table &lt;/P&gt;&lt;P&gt;v. Is_layout : structure to set the layout of the report&lt;/P&gt;&lt;P&gt;vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE&lt;/P&gt;&lt;P&gt;vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;II. Tables :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i. t_outtab : internal table with the data to be output&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Important Parameters are :&lt;/P&gt;&lt;P&gt;I. Export :&lt;/P&gt;&lt;P&gt;i. I_program_name : report id&lt;/P&gt;&lt;P&gt;ii. I_internal_tabname : the internal output table&lt;/P&gt;&lt;P&gt;iii. I_inclname : include or the report name where all the dynamic forms are handled.&lt;/P&gt;&lt;P&gt;II Changing&lt;/P&gt;&lt;P&gt;ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is &lt;/P&gt;&lt;P&gt;declared in the type pool SLIS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : &lt;/P&gt;&lt;P&gt;I. Import :&lt;/P&gt;&lt;P&gt;Et_Events : The event table is returned with all possible CALLBACK events &lt;/P&gt;&lt;P&gt;for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV. &lt;/P&gt;&lt;P&gt;II. Export :&lt;/P&gt;&lt;P&gt;I_List_type : &lt;/P&gt;&lt;P&gt;0 = simple list REUSE_ALV_LIST_DISPLAY &lt;/P&gt;&lt;P&gt;1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY &lt;/P&gt;&lt;P&gt;2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND &lt;/P&gt;&lt;P&gt;3 = hierarchical-sequential block list &lt;/P&gt;&lt;P&gt;REUSE_ALV_BLOCK_LIST_HS_APPEND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I. it_list_commentary : internal table with the headings of the type slis_t_listheader.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This internal table has three fields :&lt;/P&gt;&lt;P&gt;Typ : &amp;#145;H&amp;#146; &amp;#150; header, &amp;#145;S&amp;#146; &amp;#150; selection , &amp;#145;A&amp;#146; - action&lt;/P&gt;&lt;P&gt;Key : only when typ is &amp;#145;S&amp;#146;.&lt;/P&gt;&lt;P&gt;Info : the text to be printed&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : same as reuse_alv_list_display&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an example for simple list.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. BLOCK REPORT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is used to have multiple lists continuously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important functions used in this report are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. REUSE_ALV_BLOCK_LIST_INIT&lt;/P&gt;&lt;P&gt;B. REUSE_ALV_BLOCK_LIST_APPEND&lt;/P&gt;&lt;P&gt;C. REUSE_ALV_BLOCK_LIST_HS_APPEND&lt;/P&gt;&lt;P&gt;D. REUSE_ALV_BLOCK_LIST_DISPLAY&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;A. REUSE_ALV_BLOCK_LIST_INIT &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters: &lt;/P&gt;&lt;P&gt;I. I_CALLBACK_PROGRAM &lt;/P&gt;&lt;P&gt;II. I_CALLBACK_PF_STATUS_SET &lt;/P&gt;&lt;P&gt;III. I_CALLBACK_USER_COMMAND &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module is used to set the default gui status etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;B. REUSE_ALV_BLOCK_LIST_APPEND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Export : &lt;/P&gt;&lt;P&gt;I. is_layout : layout settings for block &lt;/P&gt;&lt;P&gt;II. it_fieldcat : field catalog &lt;/P&gt;&lt;P&gt;III. i_tabname : internal table name with output data &lt;/P&gt;&lt;P&gt;IV. it_events : internal table with all possible events&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tables :&lt;/P&gt;&lt;P&gt;i. t_outtab : internal table with output data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module adds the data to the block. &lt;/P&gt;&lt;P&gt;Repeat this function for all the different blocks to be displayed one after the other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C. REUSE_ALV_BLOCK_LIST_HS_APPEND&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module is used for hierarchical sequential blocks. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D. REUSE_ALV_BLOCK_LIST_DISPLAY &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters : All the parameters are optional. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This function module display the list with data appended by the above function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Hierarchical reports : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hierarchical sequential list output.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function module is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. REUSE_ALV_HIERSEQ_LIST_DISPLAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters: &lt;/P&gt;&lt;P&gt;I. Export: &lt;/P&gt;&lt;P&gt;i. I_CALLBACK_PROGRAM &lt;/P&gt;&lt;P&gt;ii. I_CALLBACK_PF_STATUS_SET &lt;/P&gt;&lt;P&gt;iii. I_CALLBACK_USER_COMMAND &lt;/P&gt;&lt;P&gt;iv. IS_LAYOUT &lt;/P&gt;&lt;P&gt;v. IT_FIELDCAT &lt;/P&gt;&lt;P&gt;vi. IT_EVENTS &lt;/P&gt;&lt;P&gt;vii. i_tabname_header : Name of the internal table in the program containing the &lt;/P&gt;&lt;P&gt;output data of the highest hierarchy level.&lt;/P&gt;&lt;P&gt;viii. i_tabname_item : Name of the internal table in the program containing the &lt;/P&gt;&lt;P&gt;output data of the lowest hierarchy level.&lt;/P&gt;&lt;P&gt;ix. is_keyinfo : This structure contains the header and item table field &lt;/P&gt;&lt;P&gt;names which link the two tables (shared key). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;II. Tables&lt;/P&gt;&lt;P&gt;i. t_outtab_header : Header table with data to be output&lt;/P&gt;&lt;P&gt;ii. t_outtab_item : Name of the internal table in the program containing the &lt;/P&gt;&lt;P&gt;output data of the lowest hierarchy level. &lt;/P&gt;&lt;P&gt;slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using &amp;#145;REUSE_ALV_FIELDCATALOG_MERGE&amp;#146;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Important Attributes :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. col_pos : position of the column&lt;/P&gt;&lt;P&gt;B. fieldname : internal fieldname&lt;/P&gt;&lt;P&gt;C. tabname : internal table name&lt;/P&gt;&lt;P&gt;D. ref_fieldname : fieldname (dictionary)&lt;/P&gt;&lt;P&gt;E. ref_tabname : table (dictionary)&lt;/P&gt;&lt;P&gt;F. key(1) : column with key-color&lt;/P&gt;&lt;P&gt;G. icon(1) : icon&lt;/P&gt;&lt;P&gt;H. symbol(1) : symbol&lt;/P&gt;&lt;P&gt;I. checkbox(1) : checkbox&lt;/P&gt;&lt;P&gt;J. just(1) : (R)ight (L)eft (C)ent.&lt;/P&gt;&lt;P&gt;K. do_sum(1) : sum up&lt;/P&gt;&lt;P&gt;L. no_out(1) : (O)blig.(X)no out&lt;/P&gt;&lt;P&gt;M. outputlen : output length&lt;/P&gt;&lt;P&gt;N. seltext_l : long key word&lt;/P&gt;&lt;P&gt;O. seltext_m : middle key word&lt;/P&gt;&lt;P&gt;P. seltext_s : short key word&lt;/P&gt;&lt;P&gt;Q. reptext_ddic : heading (ddic)&lt;/P&gt;&lt;P&gt;R. ddictxt(1) : (S)hort (M)iddle (L)ong&lt;/P&gt;&lt;P&gt;S. datatype : datatype&lt;/P&gt;&lt;P&gt;T. hotspot(1) : hotspot &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the sample report&lt;/P&gt;&lt;P&gt;report ZRGRIRNA no standard page heading&lt;/P&gt;&lt;P&gt;line-count 65&lt;/P&gt;&lt;P&gt;line-size 255&lt;/P&gt;&lt;P&gt;message-id mm.&lt;/P&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;GR IR Detail 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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : The output has to be displayed&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;in the ALV Grid format with the Selection *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;screen appearing on the output. In The Output *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Subtotals for Vendor, Plant, Period, Material,*&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Valuation Class, Purchase Order,Cost Center, *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Cost Element and Receipt Date are displayed *&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;after sorting the data by same fields. *&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;Declaration for Tables&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;tables: t001, " Company Codes&lt;/P&gt;&lt;P&gt;t001w, " Plants/Branches&lt;/P&gt;&lt;P&gt;lfa1, " Vendor Master&lt;/P&gt;&lt;P&gt;ska1, " GL Account Master&lt;/P&gt;&lt;P&gt;mara, " Material Master&lt;/P&gt;&lt;P&gt;mbew, " Material Valuation&lt;/P&gt;&lt;P&gt;ekko, " PO Header Data&lt;/P&gt;&lt;P&gt;cska, " Cost Elements&lt;/P&gt;&lt;P&gt;csks, " Cost Centers&lt;/P&gt;&lt;P&gt;bsis, " GL Accounts: Open Items Data&lt;/P&gt;&lt;P&gt;bkpf. " Accounting Doc: Header Data&lt;/P&gt;&lt;P&gt;&lt;/P&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;Type-pools&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;Type pools for ALV display&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;type-pools : slis.&lt;/P&gt;&lt;P&gt;&lt;/P&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;Global variables&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;data: g_repid like sy-repid,&lt;/P&gt;&lt;P&gt;g_exit type c,&lt;/P&gt;&lt;P&gt;g_events type slis_t_event,&lt;/P&gt;&lt;P&gt;g_list_top_of_page type slis_t_listheader,&lt;/P&gt;&lt;P&gt;g_exit_caused_by_caller,&lt;/P&gt;&lt;P&gt;g_exit_caused_by_user type slis_exit_by_user,&lt;/P&gt;&lt;P&gt;g_top_of_page type slis_formname value 'TOP_OF_PAGE',&lt;/P&gt;&lt;P&gt;g_variant like disvariant,&lt;/P&gt;&lt;P&gt;g_save.&lt;/P&gt;&lt;P&gt;&lt;/P&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;Declaration for Constants&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;constants : c_x type c value 'X', " Flag&lt;/P&gt;&lt;P&gt;c_c type c value 'C', " Flag&lt;/P&gt;&lt;P&gt;c_l type c value 'L', " Flag&lt;/P&gt;&lt;P&gt;c_a type c value 'A', " Line Type&lt;/P&gt;&lt;P&gt;c_h type c value 'H', " Dr/Cr&lt;/P&gt;&lt;P&gt;c_s type c value 'S', " Line Type&lt;/P&gt;&lt;P&gt;c_mkpf(4) type c value 'MKPF'. " Table&lt;/P&gt;&lt;P&gt;&lt;/P&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;Declaration of Internal Tables&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;Internal Table for BSIS Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_bsis occurs 0,&lt;/P&gt;&lt;P&gt;bukrs like bsis-bukrs, " Company Code&lt;/P&gt;&lt;P&gt;hkont like bsis-hkont, " GR IR Account&lt;/P&gt;&lt;P&gt;gjahr like bsis-gjahr, " Fiscal Year&lt;/P&gt;&lt;P&gt;belnr like bsis-belnr, " Acc Document&lt;/P&gt;&lt;P&gt;buzei like bsis-buzei, " Item No&lt;/P&gt;&lt;P&gt;budat like bsis-budat, " Receipt Date(Posting)&lt;/P&gt;&lt;P&gt;monat like bsis-monat, " Period&lt;/P&gt;&lt;P&gt;end of i_bsis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for BSEG Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_bseg occurs 0,&lt;/P&gt;&lt;P&gt;bukrs like bsis-bukrs, " Company Code&lt;/P&gt;&lt;P&gt;belnr like bsis-belnr, " Acc Document&lt;/P&gt;&lt;P&gt;buzei like bsis-buzei, " Item No&lt;/P&gt;&lt;P&gt;gjahr like bsis-gjahr, " Fiscal Year&lt;/P&gt;&lt;P&gt;shkzg like bseg-shkzg, " Dr/Cr Indicator&lt;/P&gt;&lt;P&gt;lifnr like bseg-lifnr, " Vendor Code&lt;/P&gt;&lt;P&gt;matnr like bseg-matnr, " Material No&lt;/P&gt;&lt;P&gt;ebeln like bseg-ebeln, " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp like bseg-ebelp, " PO Item&lt;/P&gt;&lt;P&gt;werks like bseg-werks, " Plant&lt;/P&gt;&lt;P&gt;menge like bseg-menge, " PO Quantity&lt;/P&gt;&lt;P&gt;meins like bseg-meins, " UOM&lt;/P&gt;&lt;P&gt;dmbtr like bseg-dmbtr, " Amount in Local Currency&lt;/P&gt;&lt;P&gt;wrbtr like bseg-wrbtr, " Amount in Trans.Currency&lt;/P&gt;&lt;P&gt;end of i_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for BKPF Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_bkpf occurs 0,&lt;/P&gt;&lt;P&gt;bukrs like bkpf-bukrs, " Company Code&lt;/P&gt;&lt;P&gt;belnr like bkpf-belnr, " Acc Document&lt;/P&gt;&lt;P&gt;gjahr like bkpf-gjahr, " Fiscal Year&lt;/P&gt;&lt;P&gt;waers like bkpf-waers, " Trans. Currency&lt;/P&gt;&lt;P&gt;awkey like bkpf-awkey, " Object Key&lt;/P&gt;&lt;P&gt;awtyp like bkpf-awtyp, " Reference Procedure&lt;/P&gt;&lt;P&gt;end of i_bkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for MSEG Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_mseg occurs 0,&lt;/P&gt;&lt;P&gt;mblnr like mseg-mblnr, " Material Document&lt;/P&gt;&lt;P&gt;mjahr like mseg-mjahr, " Fiscal Year&lt;/P&gt;&lt;P&gt;bwart like mseg-bwart, " Movement Type&lt;/P&gt;&lt;P&gt;matnr like mseg-matnr, " Material No&lt;/P&gt;&lt;P&gt;menge like mseg-menge, " PO Quantity&lt;/P&gt;&lt;P&gt;meins like mseg-meins, " UOM&lt;/P&gt;&lt;P&gt;end of i_mseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for MBEW Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_mbew occurs 0,&lt;/P&gt;&lt;P&gt;matnr like mbew-matnr, " Material No&lt;/P&gt;&lt;P&gt;werks like mbew-bwkey, " Plant&lt;/P&gt;&lt;P&gt;bklas like mbew-bklas, " Valuation Class&lt;/P&gt;&lt;P&gt;end of i_mbew.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for EKPO Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_ekpo occurs 0,&lt;/P&gt;&lt;P&gt;ebeln like ekpo-ebeln, " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp like ekpo-ebelp, " PO Item&lt;/P&gt;&lt;P&gt;matnr like ekpo-matnr, " Material No&lt;/P&gt;&lt;P&gt;txz01 like ekpo-txz01, " Material Text&lt;/P&gt;&lt;P&gt;end of i_ekpo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for EKKN Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_ekkn occurs 0,&lt;/P&gt;&lt;P&gt;ebeln like ekkn-ebeln, " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp like ekkn-ebelp, " PO Item&lt;/P&gt;&lt;P&gt;kostl like ekkn-kostl, " Cost Center&lt;/P&gt;&lt;P&gt;sakto like ekkn-sakto, " Cost Element&lt;/P&gt;&lt;P&gt;end of i_ekkn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for LFA1 Table data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_lfa1 occurs 0,&lt;/P&gt;&lt;P&gt;lifnr like lfa1-lifnr, " Vendor&lt;/P&gt;&lt;P&gt;name1 like lfa1-name1, " Name&lt;/P&gt;&lt;P&gt;end of i_lfa1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declaration of Output Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of i_final occurs 0,&lt;/P&gt;&lt;P&gt;lifnr like lfa1-lifnr, " Vendor&lt;/P&gt;&lt;P&gt;werks like bseg-werks, " Plant&lt;/P&gt;&lt;P&gt;monat like bsis-monat, " Period&lt;/P&gt;&lt;P&gt;matnr like mara-matnr, " Material Number&lt;/P&gt;&lt;P&gt;bklas like mbew-bklas, " Val Class&lt;/P&gt;&lt;P&gt;ebeln like bseg-ebeln, " PO&lt;/P&gt;&lt;P&gt;kostl like ekkn-kostl, " Cost Center&lt;/P&gt;&lt;P&gt;sakto like ekkn-sakto, " Cost Element&lt;/P&gt;&lt;P&gt;budat like bsis-budat, " Rec. Date&lt;/P&gt;&lt;P&gt;name1 like lfa1-name1, " Vendor Name&lt;/P&gt;&lt;P&gt;belnr like bsis-belnr, " FI Document&lt;/P&gt;&lt;P&gt;bwart like mseg-bwart, " Movement Type&lt;/P&gt;&lt;P&gt;txz01 like ekpo-txz01, " Material Text&lt;/P&gt;&lt;P&gt;menge like bseg-menge, " Quantity&lt;/P&gt;&lt;P&gt;meins like bseg-meins, " UOM&lt;/P&gt;&lt;P&gt;dmbtr like bseg-dmbtr, " Local Amount&lt;/P&gt;&lt;P&gt;wrbtr like bseg-wrbtr, " Tran.Amount&lt;/P&gt;&lt;P&gt;waers like bkpf-waers, " Tran.Currency&lt;/P&gt;&lt;P&gt;status type c, " Material Status&lt;/P&gt;&lt;P&gt;end of i_final.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table to hold field catgory data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: i_fldcat type slis_t_fieldcat_alv. " Table - field catgory&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table to hold Sort/Subtotals criteria data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: i_sort type slis_t_sortinfo_alv. " Table - sort/Subtotals&lt;/P&gt;&lt;P&gt;&lt;/P&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;Structure&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;data: x_layout type slis_layout_alv, " Structure-layout&lt;/P&gt;&lt;P&gt;x_fldcat like line of i_fldcat, " Structure-field catagory&lt;/P&gt;&lt;P&gt;x_sort like line of i_sort. " Structure-Sort/Subtotals&lt;/P&gt;&lt;P&gt;&lt;/P&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;Selection screen&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;selection-screen : begin of block b1 with frame title text-000.&lt;/P&gt;&lt;P&gt;parameters:&lt;/P&gt;&lt;P&gt;p_bukrs like t001-bukrs obligatory, " Company Code&lt;/P&gt;&lt;P&gt;p_grira like ska1-saknr default '0241101000' obligatory. " Account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options:&lt;/P&gt;&lt;P&gt;s_budat for bkpf-budat, " Posting Date&lt;/P&gt;&lt;P&gt;s_werks for t001w-werks, " Plant&lt;/P&gt;&lt;P&gt;s_lifnr for lfa1-lifnr, " Vendor&lt;/P&gt;&lt;P&gt;s_matnr for mara-matnr, " Material Number&lt;/P&gt;&lt;P&gt;s_kostl for csks-kostl, " Cost Center&lt;/P&gt;&lt;P&gt;s_kstar for cska-kstar, " Cost Element&lt;/P&gt;&lt;P&gt;s_ebeln for ekko-ebeln, " Purchase Order&lt;/P&gt;&lt;P&gt;s_monat for bsis-monat. " Period&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen skip.&lt;/P&gt;&lt;P&gt;parameters:&lt;/P&gt;&lt;P&gt;p_incmt as checkbox default 'X',&lt;/P&gt;&lt;P&gt;p_incnm as checkbox default 'X'.&lt;/P&gt;&lt;P&gt;&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;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;Initialization&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;initialization.&lt;/P&gt;&lt;P&gt;g_repid = sy-repid.&lt;/P&gt;&lt;P&gt;perform layout_init using x_layout.&lt;/P&gt;&lt;P&gt;perform eventtab_build using g_events[].&lt;/P&gt;&lt;P&gt;g_variant-report = g_repid.&lt;/P&gt;&lt;P&gt;g_save = 'A'.&lt;/P&gt;&lt;P&gt;&lt;/P&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;At selection screen&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;at selection-screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Selection Screen Fields&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform validate_screen.&lt;/P&gt;&lt;P&gt;&lt;/P&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;Start of selection&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;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read Data from Database Tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform read_data.&lt;/P&gt;&lt;P&gt;&lt;/P&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;End of selection&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;end-of-selection.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Build layout report layout.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform populate_layout_stucture.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Perform build_field_catalog and Sort Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform build_field_catalog.&lt;/P&gt;&lt;P&gt;perform build_sort_totals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;List Header for Top-Of-Page&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform comment_build using g_list_top_of_page[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call list viewer function module&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;perform call_list_viewer .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;****************&lt;STRONG&gt;Form - Routines&lt;/STRONG&gt;**************************************&lt;/P&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;Form : layout_init&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Form to Build layout for list display&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 layout_init using rs_layout type slis_layout_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rs_layout-detail_popup = c_x.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&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;Form : Eventtab_build&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Registration of events to happen during list display&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 eventtab_build using rt_events type slis_t_event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Registration of events to happen during list display&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: ls_event type slis_alv_event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_EVENTS_GET'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;i_list_type = 0&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;et_events = rt_events.&lt;/P&gt;&lt;P&gt;read table rt_events with key name = slis_ev_top_of_page&lt;/P&gt;&lt;P&gt;into ls_event.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;move g_top_of_page to ls_event-form.&lt;/P&gt;&lt;P&gt;append ls_event to rt_events.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "eventtab_build&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form : top_of_page&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;*&lt;/P&gt;&lt;P&gt;form top_of_page.&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_COMMENTARY_WRITE'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;I_LOGO = 'ENJOYSAP_LOGO'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;it_list_commentary = g_list_top_of_page.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form validate_screen&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;Validation of Selection Screen fields&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 validate_screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Company Code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear t001.&lt;/P&gt;&lt;P&gt;if not p_bukrs is initial.&lt;/P&gt;&lt;P&gt;select single bukrs&lt;/P&gt;&lt;P&gt;into t001-bukrs&lt;/P&gt;&lt;P&gt;from t001&lt;/P&gt;&lt;P&gt;where bukrs eq p_bukrs.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Company Code'(012).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of GL Account (GR/IR)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear ska1.&lt;/P&gt;&lt;P&gt;if not p_grira is initial.&lt;/P&gt;&lt;P&gt;select saknr&lt;/P&gt;&lt;P&gt;into ska1-saknr&lt;/P&gt;&lt;P&gt;from ska1&lt;/P&gt;&lt;P&gt;up to 1 rows&lt;/P&gt;&lt;P&gt;where saknr eq p_grira.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid GR/IR Account'(013).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Vendor Code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear lfa1.&lt;/P&gt;&lt;P&gt;if not s_lifnr[] is initial.&lt;/P&gt;&lt;P&gt;select single lifnr&lt;/P&gt;&lt;P&gt;into lfa1-lifnr&lt;/P&gt;&lt;P&gt;from lfa1&lt;/P&gt;&lt;P&gt;where lifnr in s_lifnr.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Vendor'(001).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Plant Code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear t001w.&lt;/P&gt;&lt;P&gt;if not s_werks[] is initial.&lt;/P&gt;&lt;P&gt;select single werks&lt;/P&gt;&lt;P&gt;into t001w-werks&lt;/P&gt;&lt;P&gt;from t001w&lt;/P&gt;&lt;P&gt;where werks in s_werks.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Plant'(014).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Material Code&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear mara.&lt;/P&gt;&lt;P&gt;if not s_matnr[] is initial.&lt;/P&gt;&lt;P&gt;select single matnr&lt;/P&gt;&lt;P&gt;into mara-matnr&lt;/P&gt;&lt;P&gt;from mara&lt;/P&gt;&lt;P&gt;where matnr in s_matnr.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Material'(015).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Purchase Order&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear ekko.&lt;/P&gt;&lt;P&gt;if not s_ebeln[] is initial.&lt;/P&gt;&lt;P&gt;select single ebeln&lt;/P&gt;&lt;P&gt;into ekko-ebeln&lt;/P&gt;&lt;P&gt;from ekko&lt;/P&gt;&lt;P&gt;where ebeln in s_ebeln.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Purchase Order'(016).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Cost Center&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear csks.&lt;/P&gt;&lt;P&gt;if not s_kostl[] is initial.&lt;/P&gt;&lt;P&gt;select kostl&lt;/P&gt;&lt;P&gt;into csks-kostl&lt;/P&gt;&lt;P&gt;from csks&lt;/P&gt;&lt;P&gt;up to 1 rows&lt;/P&gt;&lt;P&gt;where kostl in s_kostl.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Cost Center'(017).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Validation of Cost Element&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear cska.&lt;/P&gt;&lt;P&gt;if not s_kstar[] is initial.&lt;/P&gt;&lt;P&gt;select kstar&lt;/P&gt;&lt;P&gt;into cska-kstar&lt;/P&gt;&lt;P&gt;from cska&lt;/P&gt;&lt;P&gt;up to 1 rows&lt;/P&gt;&lt;P&gt;where kstar in s_kstar.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;message e899 with 'Enter Valid Cost Element'(018).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "validate_screen&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 read_data&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;Read the Data from the database Tables&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 read_data.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Accounting Documents for the GR/IR Account Entered on&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Selection Screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_bsis.&lt;/P&gt;&lt;P&gt;refresh i_bsis.&lt;/P&gt;&lt;P&gt;select bukrs " Company Code&lt;/P&gt;&lt;P&gt;hkont " GR IR Account&lt;/P&gt;&lt;P&gt;gjahr " Fiscal Year&lt;/P&gt;&lt;P&gt;belnr " Acc Document&lt;/P&gt;&lt;P&gt;buzei " Item No&lt;/P&gt;&lt;P&gt;budat " Receipt Date(Posting)&lt;/P&gt;&lt;P&gt;monat " Period&lt;/P&gt;&lt;P&gt;into table i_bsis&lt;/P&gt;&lt;P&gt;from bsis&lt;/P&gt;&lt;P&gt;where bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;and hkont = p_grira&lt;/P&gt;&lt;P&gt;and budat in s_budat&lt;/P&gt;&lt;P&gt;and monat in s_monat .&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 i899 with 'No data found'(043).&lt;/P&gt;&lt;P&gt;g_exit = c_x.&lt;/P&gt;&lt;P&gt;stop.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_bsis by bukrs hkont gjahr belnr buzei.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Vendor,PO,Material,Qty details from BSEG Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if not i_bsis[] is initial.&lt;/P&gt;&lt;P&gt;clear i_bseg.&lt;/P&gt;&lt;P&gt;refresh i_bseg.&lt;/P&gt;&lt;P&gt;select bukrs " Company Code&lt;/P&gt;&lt;P&gt;belnr " Acc Document&lt;/P&gt;&lt;P&gt;buzei " Item No&lt;/P&gt;&lt;P&gt;gjahr " Fiscal Year&lt;/P&gt;&lt;P&gt;shkzg " Dr/Cr Indicator&lt;/P&gt;&lt;P&gt;lifnr " Vendor Code&lt;/P&gt;&lt;P&gt;matnr " Material No&lt;/P&gt;&lt;P&gt;ebeln " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp " PO Item&lt;/P&gt;&lt;P&gt;werks " Plant&lt;/P&gt;&lt;P&gt;menge " PO Quantity&lt;/P&gt;&lt;P&gt;meins " UOM&lt;/P&gt;&lt;P&gt;dmbtr " Amount in Local Currency&lt;/P&gt;&lt;P&gt;wrbtr " Amount in Trans.Currency&lt;/P&gt;&lt;P&gt;into table i_bseg&lt;/P&gt;&lt;P&gt;from bseg&lt;/P&gt;&lt;P&gt;for all entries in i_bsis&lt;/P&gt;&lt;P&gt;where bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;and belnr = i_bsis-belnr&lt;/P&gt;&lt;P&gt;and gjahr = i_bsis-gjahr&lt;/P&gt;&lt;P&gt;and buzei = i_bsis-buzei&lt;/P&gt;&lt;P&gt;and lifnr in s_lifnr&lt;/P&gt;&lt;P&gt;and werks in s_werks&lt;/P&gt;&lt;P&gt;and matnr in s_matnr&lt;/P&gt;&lt;P&gt;and ebeln in s_ebeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_bseg by bukrs belnr buzei gjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Select the Trans.Currency from BKPF Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_bkpf.&lt;/P&gt;&lt;P&gt;refresh i_bkpf.&lt;/P&gt;&lt;P&gt;select bukrs " Company Code&lt;/P&gt;&lt;P&gt;belnr " Acc Document&lt;/P&gt;&lt;P&gt;gjahr " Fiscal Year&lt;/P&gt;&lt;P&gt;waers " Trans. Currency&lt;/P&gt;&lt;P&gt;awkey " Object Key&lt;/P&gt;&lt;P&gt;awtyp " Reference Procedure&lt;/P&gt;&lt;P&gt;into table i_bkpf&lt;/P&gt;&lt;P&gt;from bkpf&lt;/P&gt;&lt;P&gt;for all entries in i_bsis&lt;/P&gt;&lt;P&gt;where bukrs = p_bukrs&lt;/P&gt;&lt;P&gt;and belnr = i_bsis-belnr&lt;/P&gt;&lt;P&gt;and gjahr = i_bsis-gjahr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;sort i_bkpf by bukrs belnr gjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Quantity and UOM of Material from MSEG Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if not i_bkpf[] is initial.&lt;/P&gt;&lt;P&gt;clear i_mseg.&lt;/P&gt;&lt;P&gt;refresh i_mseg.&lt;/P&gt;&lt;P&gt;select mblnr " Material Document&lt;/P&gt;&lt;P&gt;mjahr " Fiscal Year&lt;/P&gt;&lt;P&gt;bwart " Movement Type&lt;/P&gt;&lt;P&gt;matnr " Material No&lt;/P&gt;&lt;P&gt;menge " PO Quantity&lt;/P&gt;&lt;P&gt;meins " UOM&lt;/P&gt;&lt;P&gt;into table i_mseg&lt;/P&gt;&lt;P&gt;from mseg&lt;/P&gt;&lt;P&gt;for all entries in i_bkpf&lt;/P&gt;&lt;P&gt;where mblnr = i_bkpf-awkey(10).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;sort i_mseg by mblnr mjahr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Material And Description from EKPO Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not i_bseg[] is initial.&lt;/P&gt;&lt;P&gt;clear i_ekpo.&lt;/P&gt;&lt;P&gt;refresh i_ekpo.&lt;/P&gt;&lt;P&gt;select ebeln " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp " PO Item&lt;/P&gt;&lt;P&gt;matnr " Material No&lt;/P&gt;&lt;P&gt;txz01 " Material Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;into table i_ekpo&lt;/P&gt;&lt;P&gt;from ekpo&lt;/P&gt;&lt;P&gt;for all entries in i_bseg&lt;/P&gt;&lt;P&gt;where ebeln = i_bseg-ebeln&lt;/P&gt;&lt;P&gt;and ebelp = i_bseg-ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_ekpo by ebeln ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Valuation Class from MBEW Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_mbew.&lt;/P&gt;&lt;P&gt;refresh i_mbew.&lt;/P&gt;&lt;P&gt;select matnr " Material No&lt;/P&gt;&lt;P&gt;bwkey " Plant&lt;/P&gt;&lt;P&gt;bklas " Valuation Class&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;into table i_mbew&lt;/P&gt;&lt;P&gt;from mbew&lt;/P&gt;&lt;P&gt;for all entries in i_bseg&lt;/P&gt;&lt;P&gt;where matnr = i_bseg-matnr&lt;/P&gt;&lt;P&gt;and bwkey = i_bseg-werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_mbew by matnr werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Cost Center and Cost Element of the PO from EKKN Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_ekkn.&lt;/P&gt;&lt;P&gt;refresh i_ekkn.&lt;/P&gt;&lt;P&gt;select ebeln " Purchase Order&lt;/P&gt;&lt;P&gt;ebelp " PO Item&lt;/P&gt;&lt;P&gt;kostl " Cost Center&lt;/P&gt;&lt;P&gt;sakto " Cost Element&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;into table i_ekkn&lt;/P&gt;&lt;P&gt;from ekkn&lt;/P&gt;&lt;P&gt;for all entries in i_bseg&lt;/P&gt;&lt;P&gt;where ebeln = i_bseg-ebeln&lt;/P&gt;&lt;P&gt;and ebelp = i_bseg-ebelp&lt;/P&gt;&lt;P&gt;and kostl in s_kostl&lt;/P&gt;&lt;P&gt;and sakto in s_kstar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_ekkn by ebeln ebelp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the Vendor Name&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;clear i_lfa1.&lt;/P&gt;&lt;P&gt;refresh i_lfa1.&lt;/P&gt;&lt;P&gt;select lifnr " Vendor&lt;/P&gt;&lt;P&gt;name1 " Name&lt;/P&gt;&lt;P&gt;into table i_lfa1&lt;/P&gt;&lt;P&gt;from lfa1&lt;/P&gt;&lt;P&gt;for all entries in i_bseg&lt;/P&gt;&lt;P&gt;where lifnr = i_bseg-lifnr.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;sort i_lfa1 by lifnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Move the data to Final Output Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;loop at i_bsis.&lt;/P&gt;&lt;P&gt;i_final-belnr = i_bsis-belnr. " FI Document&lt;/P&gt;&lt;P&gt;i_final-monat = i_bsis-monat. " Period&lt;/P&gt;&lt;P&gt;i_final-budat = i_bsis-budat. " Rec. Date&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Transaction Currency from BKPF Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_bkpf with key bukrs = i_bsis-bukrs&lt;/P&gt;&lt;P&gt;belnr = i_bsis-belnr&lt;/P&gt;&lt;P&gt;gjahr = i_bsis-gjahr&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-waers = i_bkpf-waers. " Tran.Currency&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Movement Type for all Material Related&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Documents from MSEG Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if i_bkpf-awtyp = c_mkpf.&lt;/P&gt;&lt;P&gt;read table i_mseg with key mblnr = i_bkpf-awkey(10)&lt;/P&gt;&lt;P&gt;mjahr = i_bkpf-awkey+10(4).&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-bwart = i_mseg-bwart. " Movement Type&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read Vendor, Plant, PO Document, Local And Trans.Amounts&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from BSEG Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_bseg with key bukrs = i_bsis-bukrs&lt;/P&gt;&lt;P&gt;belnr = i_bsis-belnr&lt;/P&gt;&lt;P&gt;gjahr = i_bsis-gjahr&lt;/P&gt;&lt;P&gt;buzei = i_bsis-buzei&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-lifnr = i_bseg-lifnr. " Vendor&lt;/P&gt;&lt;P&gt;i_final-werks = i_bseg-werks. " Plant&lt;/P&gt;&lt;P&gt;i_final-ebeln = i_bseg-ebeln. " PO&lt;/P&gt;&lt;P&gt;i_final-dmbtr = i_bseg-dmbtr. " Local Amount&lt;/P&gt;&lt;P&gt;i_final-wrbtr = i_bseg-wrbtr. " Tran.Amount&lt;/P&gt;&lt;P&gt;i_final-menge = i_bseg-menge. " Quantity&lt;/P&gt;&lt;P&gt;i_final-meins = i_bseg-meins. " UOM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For Credit Indicator(SHKZG = H) amounts should be (-)ve&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if i_bseg-shkzg = c_h.&lt;/P&gt;&lt;P&gt;i_final-dmbtr = i_final-dmbtr * -1.&lt;/P&gt;&lt;P&gt;i_final-wrbtr = i_final-wrbtr * -1.&lt;/P&gt;&lt;P&gt;i_final-menge = i_final-menge * -1.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Material and its Description from EKPO Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_ekpo with key ebeln = i_bseg-ebeln&lt;/P&gt;&lt;P&gt;ebelp = i_bseg-ebelp&lt;/P&gt;&lt;P&gt;matnr = i_bseg-matnr&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-matnr = i_ekpo-matnr. " Material Number&lt;/P&gt;&lt;P&gt;i_final-txz01 = i_ekpo-txz01. " Material Text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate the Material Status depending on the Input Checkbox&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;On Selection Screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if not i_ekpo-matnr is initial.&lt;/P&gt;&lt;P&gt;i_final-status = c_x.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the PO related Cost Element and Cost Centers&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from EKKN Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_ekkn with key ebeln = i_bseg-ebeln&lt;/P&gt;&lt;P&gt;ebelp = i_bseg-ebelp&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-kostl = i_ekkn-kostl. " Cost Center&lt;/P&gt;&lt;P&gt;i_final-sakto = i_ekkn-sakto. " Cost Element&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Valuation Class from MBEW Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_mbew with key matnr = i_bseg-matnr&lt;/P&gt;&lt;P&gt;werks = i_bseg-werks&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-bklas = i_mbew-bklas. " Val Class&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Read the Vendor Name from LFA1 Internal Table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;read table i_lfa1 with key lifnr = i_bseg-lifnr&lt;/P&gt;&lt;P&gt;binary search.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;i_final-name1 = i_lfa1-name1. " Vendor Name&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;append i_final.&lt;/P&gt;&lt;P&gt;clear i_final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort i_final by lifnr werks monat matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Depending on the check Box Selected display the data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if p_incmt = c_x and p_incnm ne c_x.&lt;/P&gt;&lt;P&gt;delete i_final where matnr eq space.&lt;/P&gt;&lt;P&gt;elseif p_incnm = c_x and p_incmt ne c_x.&lt;/P&gt;&lt;P&gt;delete i_final where matnr ne space.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. "Read Data&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form : populate_layout_stucture&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Populating the layout structure&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 populate_layout_stucture.&lt;/P&gt;&lt;P&gt;clear x_layout .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Layout properties&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;x_layout-zebra = c_x.&lt;/P&gt;&lt;P&gt;x_layout-detail_popup = c_x.&lt;/P&gt;&lt;P&gt;x_layout-detail_initial_lines = c_x.&lt;/P&gt;&lt;P&gt;x_layout-colwidth_optimize = c_x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " populate_layout_stucture&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form : build_field_catalog&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Building the field catalog data&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_field_catalog.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_FIELDCATALOG_MERGE'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;i_program_name = g_repid&lt;/P&gt;&lt;P&gt;i_internal_tabname = 'I_FINAL'&lt;/P&gt;&lt;P&gt;i_inclname = g_repid&lt;/P&gt;&lt;P&gt;changing&lt;/P&gt;&lt;P&gt;ct_fieldcat = i_fldcat&lt;/P&gt;&lt;P&gt;exceptions&lt;/P&gt;&lt;P&gt;inconsistent_interface = 1&lt;/P&gt;&lt;P&gt;program_error = 2&lt;/P&gt;&lt;P&gt;others = 3.&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Getting the Header text for the coloums&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;loop at i_fldcat into x_fldcat where fieldname = 'LIFNR' or&lt;/P&gt;&lt;P&gt;fieldname = 'NAME1' or&lt;/P&gt;&lt;P&gt;fieldname = 'WERKS' or&lt;/P&gt;&lt;P&gt;fieldname = 'MONAT' or&lt;/P&gt;&lt;P&gt;fieldname = 'MATNR' or&lt;/P&gt;&lt;P&gt;fieldname = 'BKLAS' or&lt;/P&gt;&lt;P&gt;fieldname = 'EBELN' or&lt;/P&gt;&lt;P&gt;fieldname = 'KOSTL' or&lt;/P&gt;&lt;P&gt;fieldname = 'SAKTO' or&lt;/P&gt;&lt;P&gt;fieldname = 'BUDAT' or&lt;/P&gt;&lt;P&gt;fieldname = 'BELNR' or&lt;/P&gt;&lt;P&gt;fieldname = 'BWART' or&lt;/P&gt;&lt;P&gt;fieldname = 'TXZ01' or&lt;/P&gt;&lt;P&gt;fieldname = 'MENGE' or&lt;/P&gt;&lt;P&gt;fieldname = 'MEINS' or&lt;/P&gt;&lt;P&gt;fieldname = 'DMBTR' or&lt;/P&gt;&lt;P&gt;fieldname = 'WRBTR' or&lt;/P&gt;&lt;P&gt;fieldname = 'WAERS' or&lt;/P&gt;&lt;P&gt;fieldname = 'STATUS'.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'LIFNR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Vendor'(003).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Vendor'(003).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Vendor'(003).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Vendor'(003).&lt;/P&gt;&lt;P&gt;x_fldcat-inttype = c_c.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'NAME1'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Vendor Name'(002).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Vendor Name'(002).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Vendor Name'(002).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Vendor Name'(002).&lt;/P&gt;&lt;P&gt;x_fldcat-inttype = c_c.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'WERKS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Plant'(010).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Plant'(010).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Plant'(010).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Plant'(010).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'MONAT'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Period'(011).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Period'(011).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Period'(011).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Period'(011).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'MATNR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Material'(004).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Material'(004).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Material'(004).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Material'(004).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'BKLAS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Valuation Class'(009).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Valuation Class'(009).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Valuation Class'(009).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Valuation Class'(009).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'EBELN'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Purchase Order'(005).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Purchase Order'(005).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Purchase Order'(005).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Purchase Order'(005).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'KOSTL'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Cost Center'(006).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Cost Center'(006).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Cost Center'(006).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Cost Center'(006).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'SAKTO'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Cost Element'(007).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Cost Element'(007).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Cost Element'(007).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Cost Element'(007).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'BUDAT'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Receipt Date'(008).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Receipt Date'(008).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Receipt Date'(008).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Receipt Date'(008).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'BELNR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Acc.Document'(100).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Acc.Document'(100).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Acc.Document'(100).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Acc.Document'(100).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'BWART'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Movement Type'(101).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Movement Type'(101).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Movement Type'(101).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Movement Type'(101).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'TXZ01'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Material Text'(102).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Material Text'(102).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Material Text'(102).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Material Text'(102).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'MENGE'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Quantity'(103).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Quantity'(103).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Quantity'(103).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Quantity'(103).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;x_fldcat-do_sum = c_x.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'MEINS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'UOM'(104).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'UOM'(104).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'UOM'(104).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'UOM'(104).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'DMBTR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Amount in Local Curr'(105).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Amount in Local Curr'(105).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Amount in Local Curr'(105).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Amount in Local Curr'(105).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;x_fldcat-do_sum = c_x.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'WRBTR'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Amount in Trans.Curr'(106).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Amount in Trans.Curr'(106).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Amount in Trans.Curr'(106).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Amount in Trans.Curr'(106).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;x_fldcat-do_sum = c_x.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'WAERS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Trans.Currency'(107).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Trans.Currency'(107).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Trans.Currency'(107).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Trans.Currency'(107).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if x_fldcat-fieldname = 'STATUS'.&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_l = 'Material Status'(019).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_m = 'Material Status'(019).&lt;/P&gt;&lt;P&gt;x_fldcat-seltext_s = 'Material Status'(019).&lt;/P&gt;&lt;P&gt;x_fldcat-reptext_ddic = 'Material Status'(019).&lt;/P&gt;&lt;P&gt;x_fldcat-ddictxt = c_l.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;modify i_fldcat from x_fldcat index sy-tabix.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_field_catalog&lt;/P&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;Form : build_sort_totals&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : Building the Criteria for Sort/Subtotals&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_sort_totals.&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'LIFNR'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 1.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'WERKS'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 2.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'MONAT'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 3.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'MATNR'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 4.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'BKLAS'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 5.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'EBELN'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 6.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'KOSTL'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 7.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'SAKTO'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 8.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;x_sort-fieldname = 'BUDAT'.&lt;/P&gt;&lt;P&gt;x_sort-tabname = 'I_FINAL'.&lt;/P&gt;&lt;P&gt;x_sort-spos = 9.&lt;/P&gt;&lt;P&gt;x_sort-up = c_x.&lt;/P&gt;&lt;P&gt;x_sort-subtot = c_x.&lt;/P&gt;&lt;P&gt;append x_sort to i_sort.&lt;/P&gt;&lt;P&gt;clear x_sort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " build_sort_totals&lt;/P&gt;&lt;P&gt;&lt;/P&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;Form : comment_build&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : This form is used to display the Report Header(ALV)&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;*&lt;/P&gt;&lt;P&gt;form comment_build using lt_top_of_page type&lt;/P&gt;&lt;P&gt;slis_t_listheader.&lt;/P&gt;&lt;P&gt;data: l_line type slis_listheader,&lt;/P&gt;&lt;P&gt;l_heading1 like rs38m-repti,&lt;/P&gt;&lt;P&gt;l_date(10), l_time(8).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear l_line.&lt;/P&gt;&lt;P&gt;l_heading1 = 'GR/IR DETAIL REPORT'(021).&lt;/P&gt;&lt;P&gt;g_repid = sy-repid.&lt;/P&gt;&lt;P&gt;write sy-uzeit to l_time.&lt;/P&gt;&lt;P&gt;write sy-datum to l_date.&lt;/P&gt;&lt;P&gt;l_line-typ = c_h.&lt;/P&gt;&lt;P&gt;move l_heading1 to l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear l_line.&lt;/P&gt;&lt;P&gt;l_line-typ = c_s.&lt;/P&gt;&lt;P&gt;concatenate 'System:'(023) sy-sysid&lt;/P&gt;&lt;P&gt;'Date:'(024) l_date&lt;/P&gt;&lt;P&gt;' Time:'(025)&lt;/P&gt;&lt;P&gt;l_time into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate 'Report:'(026) g_repid&lt;/P&gt;&lt;P&gt;' User:'(027) sy-uname into&lt;/P&gt;&lt;P&gt;l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;l_line-typ = c_a.&lt;/P&gt;&lt;P&gt;move 'SELECTION CRITERIA:'(028) to l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Company Code : '(029)&lt;/P&gt;&lt;P&gt;p_bukrs into l_line-info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' GR/IR Account: '(030)&lt;/P&gt;&lt;P&gt;p_grira into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Posting Date : '(032) s_budat-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_budat-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Plant : '(033) s_werks-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_werks-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Vendor: '(034) s_lifnr-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_lifnr-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Material: '(035) s_matnr-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_matnr-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Cost Center : '(036) s_kostl-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_kostl-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Cost Element: '(037) s_kstar-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_kstar-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Purchase Order: '(038) s_ebeln-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_ebeln-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Period : '(039) s_monat-low&lt;/P&gt;&lt;P&gt;' To: '(031) s_monat-high into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate ' Include Material Items: '(040)&lt;/P&gt;&lt;P&gt;p_incmt into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;concatenate ' Include Non-Material Items: '(041)&lt;/P&gt;&lt;P&gt;p_incnm into l_line-info.&lt;/P&gt;&lt;P&gt;append l_line to lt_top_of_page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&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;Form : call_list_viewer&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Description : This form is used to display the grid through ALV&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 call_list_viewer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;exporting&lt;/P&gt;&lt;P&gt;i_callback_program = g_repid&lt;/P&gt;&lt;P&gt;is_layout = x_layout&lt;/P&gt;&lt;P&gt;it_fieldcat = i_fldcat[]&lt;/P&gt;&lt;P&gt;i_default = c_x&lt;/P&gt;&lt;P&gt;it_sort = i_sort[]&lt;/P&gt;&lt;P&gt;i_save = g_save&lt;/P&gt;&lt;P&gt;is_variant = g_variant&lt;/P&gt;&lt;P&gt;it_events = g_events[]&lt;/P&gt;&lt;P&gt;importing&lt;/P&gt;&lt;P&gt;e_exit_caused_by_caller = g_exit_caused_by_caller&lt;/P&gt;&lt;P&gt;es_exit_caused_by_user = g_exit_caused_by_user&lt;/P&gt;&lt;P&gt;tables&lt;/P&gt;&lt;P&gt;t_outtab = i_final&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;write: / 'Problem in calling the ALV report'(042).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform. " call_list_view&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 06:14:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528173#M572939</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T06:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: ALV</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528174#M572940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;The important function modules are &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a. Reuse_alv_list_display:This is the function module which prints the data.&lt;/P&gt;&lt;P&gt;b. Reuse_alv_fieldcatalog_merge:his function module is used to &lt;/P&gt;&lt;P&gt;populate a fieldcatalog which is essential to display the data in ALV.&lt;/P&gt;&lt;P&gt;c. Reuse_alv_events_get:Returns table of possible events for a list type &lt;/P&gt;&lt;P&gt;d. Reuse_alv_commentary_write:This is used in the Top-of-page event to print the headings and other comments for the list.&lt;/P&gt;&lt;P&gt;e. Reuse_alv_grid_display:A new function in 4.6 version, to display the results in grid rather than as a preview.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;blocked list:&amp;lt;/b&amp;gt;  :&lt;/P&gt;&lt;P&gt;This is used to have multiple lists continuously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The important functions used in this report are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A. REUSE_ALV_BLOCK_LIST_INIT&lt;/P&gt;&lt;P&gt;B. REUSE_ALV_BLOCK_LIST_APPEND&lt;/P&gt;&lt;P&gt;C. REUSE_ALV_BLOCK_LIST_HS_APPEND&lt;/P&gt;&lt;P&gt;D. REUSE_ALV_BLOCK_LIST_DISPLAY&lt;/P&gt;&lt;P&gt;Hirarcial list :&lt;/P&gt;&lt;P&gt;if u want to display daat hirarchialy we use this.&lt;/P&gt;&lt;P&gt;for example if u want tp print header data and corresponding items we use this&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2007 09:24:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv/m-p/2528174#M572940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-19T09:24:18Z</dc:date>
    </item>
  </channel>
</rss>

