<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to create hashed table in runtime in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436348#M545005</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hI,&lt;/P&gt;&lt;P&gt;   Hashed tables&lt;/P&gt;&lt;P&gt;This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index. &lt;/P&gt;&lt;P&gt;The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always &lt;/P&gt;&lt;P&gt;have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for &lt;/P&gt;&lt;P&gt;processing large amounts of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COLUMN1 TYPE I,&lt;/P&gt;&lt;P&gt;COLUMN2 TYPE I,&lt;/P&gt;&lt;P&gt;COLUMN3 TYPE I,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB TYPE HASHED TABLE OF SPFLI&lt;/P&gt;&lt;P&gt;WITH UNIQUE KEY CARRID CONNID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table object ITAB has the type hashed table, a line type corresponding to the flat structure SPFLI from the ABAP Dictionary, and a &lt;/P&gt;&lt;P&gt;unique key with the key fields CARRID and CONNID. The internal table ITAB can be regarded as an internal template for the database table &lt;/P&gt;&lt;P&gt;SPFLI. It is therefore particularly suitable for working with data from this database table as long as you only access it using the key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD IF HELPFUL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raghavendra.D.S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Jul 2007 08:21:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-04T08:21:31Z</dc:date>
    <item>
      <title>how to create hashed table in runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436346#M545003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi experts&lt;/P&gt;&lt;P&gt;how to create hashed table in runtime, please give me the coading style.&lt;/P&gt;&lt;P&gt;please help me.&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;subhasis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 04:32:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436346#M545003</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T04:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to create hashed table in runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436347#M545004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Subhasis ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; search in this link , it may be helpful :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35de358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ranjita&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 04:52:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436347#M545004</guid>
      <dc:creator>former_member196299</dc:creator>
      <dc:date>2007-07-04T04:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to create hashed table in runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436348#M545005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hI,&lt;/P&gt;&lt;P&gt;   Hashed tables&lt;/P&gt;&lt;P&gt;This is the most appropriate type for any table where the main operation is key access. You cannot access a hashed table using its index. &lt;/P&gt;&lt;P&gt;The response time for key access remains constant, regardless of the number of table entries. Like database tables, hashed tables always &lt;/P&gt;&lt;P&gt;have a unique key. Hashed tables are useful if you want to construct and use an internal table which resembles a database table or for &lt;/P&gt;&lt;P&gt;processing large amounts of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES VECTOR TYPE HASHED TABLE OF I WITH UNIQUE KEY TABLE LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF LINE,&lt;/P&gt;&lt;P&gt;COLUMN1 TYPE I,&lt;/P&gt;&lt;P&gt;COLUMN2 TYPE I,&lt;/P&gt;&lt;P&gt;COLUMN3 TYPE I,&lt;/P&gt;&lt;P&gt;END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA ITAB TYPE HASHED TABLE OF SPFLI&lt;/P&gt;&lt;P&gt;WITH UNIQUE KEY CARRID CONNID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table object ITAB has the type hashed table, a line type corresponding to the flat structure SPFLI from the ABAP Dictionary, and a &lt;/P&gt;&lt;P&gt;unique key with the key fields CARRID and CONNID. The internal table ITAB can be regarded as an internal template for the database table &lt;/P&gt;&lt;P&gt;SPFLI. It is therefore particularly suitable for working with data from this database table as long as you only access it using the key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD IF HELPFUL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raghavendra.D.S&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 08:21:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436348#M545005</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T08:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to create hashed table in runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436349#M545006</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;Have alook at the code, and pls reward points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use Hashed Tables to Improve Performance :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report zuseofhashedtables.&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Program: ZUseOfHashedTables                                        **&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Author: XXXXXXXXXXXXXXXXXX                                 **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;                                                                   **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Versions: 4.6b - 4.6c                                              **&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Notes:                                                             **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;    this program shows how we can use hashed tables to improve     **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;    the responce time.                                             **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;    It shows,                                                      **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;       1. how to declare hashed tables                             **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;       2. a cache-like technique to improve access to master data  **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;       3. how to collect data using hashed tables                  **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;       4. how to avoid deletions of unwanted data                  **&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Results: the test we run read about 31000 rows from mkpf, 150000   **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         rows from mseg, 500 rows from makt and 400 from lfa1.     **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         it filled ht_lst with 24500 rows and displayed them in    **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         alv grid format.                                          **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;                                                                   **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         It needed about 65 seconds to perform this task (with     **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         all the db buffers empty)                                 **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;                                                                   **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         The same program with standard tables needed 140 seconds  **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         to run with the same recordset and with buffers filled in **&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Objetive: show a list that consists of  all the material movements **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         '101' - '901' for a certain range of dates in mkpf-budat. **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;the columns to be displayed are:                                   **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mkpf-budat,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mkpf-mblnr,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mseg-lifnr,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         lfa1-name1,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mkpf-xblnr,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mseg-zeile                                                **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mseg-charg,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mseg-matnr,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         makt-maktx,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mseg-erfmg,                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         mseg-erfme.                                               **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;or show a sumary list by matnr - menge                             **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;                                                                   **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;You'll have to create a pf-status called vista -                   **&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;See form set_pf_status for details                                 **&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;tables used -&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;tables: mkpf,&lt;/P&gt;&lt;P&gt;        mseg,&lt;/P&gt;&lt;P&gt;        lfa1,&lt;/P&gt;&lt;P&gt;        makt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;global hashed tables used&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;data: begin of wa_mkpf, "header&lt;/P&gt;&lt;P&gt;      mblnr like mkpf-mblnr,&lt;/P&gt;&lt;P&gt;      mjahr like mkpf-mjahr,&lt;/P&gt;&lt;P&gt;      budat like mkpf-budat,&lt;/P&gt;&lt;P&gt;      xblnr like mkpf-xblnr,&lt;/P&gt;&lt;P&gt;      end of wa_mkpf.&lt;/P&gt;&lt;P&gt;data: ht_mkpf like hashed table of wa_mkpf&lt;/P&gt;&lt;P&gt;      with unique key mblnr mjahr&lt;/P&gt;&lt;P&gt;      with header line.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;data: begin of wa_mseg, " line items&lt;/P&gt;&lt;P&gt;      mblnr like mseg-mblnr,&lt;/P&gt;&lt;P&gt;      mjahr like mseg-mjahr,&lt;/P&gt;&lt;P&gt;      zeile like mseg-zeile,&lt;/P&gt;&lt;P&gt;      bwart like mseg-bwart,&lt;/P&gt;&lt;P&gt;      charg like mseg-charg,&lt;/P&gt;&lt;P&gt;      matnr like mseg-matnr,&lt;/P&gt;&lt;P&gt;      lifnr like mseg-lifnr,&lt;/P&gt;&lt;P&gt;      erfmg like mseg-erfmg,&lt;/P&gt;&lt;P&gt;      erfme like mseg-erfme,&lt;/P&gt;&lt;P&gt;      end of wa_mseg.&lt;/P&gt;&lt;P&gt;data ht_mseg like hashed table of wa_mseg&lt;/P&gt;&lt;P&gt;      with unique key mblnr mjahr zeile&lt;/P&gt;&lt;P&gt;      with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;cache structure for lfa1 records&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;data: begin of wa_lfa1,&lt;/P&gt;&lt;P&gt;      lifnr like lfa1-lifnr,&lt;/P&gt;&lt;P&gt;      name1 like lfa1-name1,&lt;/P&gt;&lt;P&gt;      end of wa_lfa1.&lt;/P&gt;&lt;P&gt;data ht_lfa1 like hashed table of wa_lfa1&lt;/P&gt;&lt;P&gt;      with unique key lifnr&lt;/P&gt;&lt;P&gt;      with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;cache structure for material related data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;data: begin of wa_material,&lt;/P&gt;&lt;P&gt;      matnr like makt-matnr,&lt;/P&gt;&lt;P&gt;      maktx like makt-maktx,&lt;/P&gt;&lt;P&gt;      end of wa_material.&lt;/P&gt;&lt;P&gt;data: ht_material like hashed table of wa_material&lt;/P&gt;&lt;P&gt;        with unique key matnr&lt;/P&gt;&lt;P&gt;        with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;result table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;data: begin of wa_lst, "&lt;/P&gt;&lt;P&gt;      budat like mkpf-budat,&lt;/P&gt;&lt;P&gt;      mblnr like mseg-mblnr,&lt;/P&gt;&lt;P&gt;      lifnr like mseg-lifnr,&lt;/P&gt;&lt;P&gt;      name1 like lfa1-name1,    &lt;/P&gt;&lt;P&gt;      xblnr like mkpf-xblnr,&lt;/P&gt;&lt;P&gt;      zeile like mseg-zeile,&lt;/P&gt;&lt;P&gt;      charg like mseg-charg,&lt;/P&gt;&lt;P&gt;      matnr like mseg-matnr,&lt;/P&gt;&lt;P&gt;      maktx like makt-maktx,&lt;/P&gt;&lt;P&gt;      erfmg like mseg-erfmg,&lt;/P&gt;&lt;P&gt;      erfme like mseg-erfme,&lt;/P&gt;&lt;P&gt;      mjahr like mseg-mjahr,&lt;/P&gt;&lt;P&gt;      end of wa_lst.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: ht_lst like hashed table of wa_lst&lt;/P&gt;&lt;P&gt;        with unique key mblnr mjahr zeile&lt;/P&gt;&lt;P&gt;        with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of wa_lst1, " sumary by material&lt;/P&gt;&lt;P&gt;      matnr like mseg-matnr,&lt;/P&gt;&lt;P&gt;      maktx like makt-maktx,&lt;/P&gt;&lt;P&gt;      erfmg like mseg-erfmg,&lt;/P&gt;&lt;P&gt;      erfme like mseg-erfme,&lt;/P&gt;&lt;P&gt;      end of wa_lst1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: ht_lst1 like hashed table of wa_lst1&lt;/P&gt;&lt;P&gt;        with unique key matnr&lt;/P&gt;&lt;P&gt;        with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;structures for alv grid display.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;itabs&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;type-pools: slis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_lst            like standard table of wa_lst with header line,&lt;/P&gt;&lt;P&gt;      it_fieldcat_lst   type slis_t_fieldcat_alv with header line,&lt;/P&gt;&lt;P&gt;      it_sort_lst       type slis_t_sortinfo_alv,&lt;/P&gt;&lt;P&gt;      it_lst1           like standard table of wa_lst1 with header line,&lt;/P&gt;&lt;P&gt;      it_fieldcat_lst1  type slis_t_fieldcat_alv with header line,&lt;/P&gt;&lt;P&gt;      it_sort_lst1      type slis_t_sortinfo_alv.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;structures&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;data: wa_sort         type slis_sortinfo_alv,&lt;/P&gt;&lt;P&gt;      ls_layout       type slis_layout_alv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;global varialbes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: g_lines type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: g_repid like sy-repid,&lt;/P&gt;&lt;P&gt;      ok_code       like sy-ucomm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;selection-screen&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"text: Dates:&lt;/P&gt;&lt;P&gt;select-options: so_budat for mkpf-budat default sy-datum.&lt;/P&gt;&lt;P&gt;"text: Material numbers.&lt;/P&gt;&lt;P&gt;select-options: so_matnr for mseg-matnr.&lt;/P&gt;&lt;P&gt;selection-screen uline.&lt;/P&gt;&lt;P&gt;selection-screen skip 1.&lt;/P&gt;&lt;P&gt;"Text: show summary by material.&lt;/P&gt;&lt;P&gt;parameters: gp_bymat as checkbox default ''.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;  perform get_data.&lt;/P&gt;&lt;P&gt;  perform show_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;P&gt;&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 get_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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      ........                                                      *&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 get_data.&lt;/P&gt;&lt;P&gt;        select mblnr mjahr budat xblnr&lt;/P&gt;&lt;P&gt;            into table ht_mkpf&lt;/P&gt;&lt;P&gt;           from mkpf&lt;/P&gt;&lt;P&gt;          where budat in so_budat. " make use of std index.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;have we retrieved data from mkpf?&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;  describe table ht_mkpf lines g_lines.&lt;/P&gt;&lt;P&gt;  if g_lines &amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;if true then retrieve all related records from mseg.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Doing this way we make sure that the access is by primary key&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;of mseg.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;The reason is that is faster to filter them in memory&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;than to allow the db server to do it.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;    select mblnr mjahr zeile bwart charg&lt;/P&gt;&lt;P&gt;             matnr lifnr erfmg erfme&lt;/P&gt;&lt;P&gt;      into table ht_mseg&lt;/P&gt;&lt;P&gt;      from mseg&lt;/P&gt;&lt;P&gt;        for all entries in ht_mkpf&lt;/P&gt;&lt;P&gt;     where mblnr = ht_mkpf-mblnr&lt;/P&gt;&lt;P&gt;       and mjahr = ht_mkpf-mjahr.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;fill t_lst or t_lst1 according to user's choice.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;  if gp_bymat = ' '.&lt;/P&gt;&lt;P&gt;    perform fill_ht_lst.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    perform fill_ht_lst1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form fill_ht_lst.&lt;/P&gt;&lt;P&gt;  refresh ht_lst.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Example: how to discard unwanted data in an efficient way.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;  loop at ht_mseg.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  filter unwanted data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.&lt;/P&gt;&lt;P&gt;    check ht_mseg-matnr in so_matnr.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  read header line.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    read table ht_mkpf with table key mblnr = ht_mseg-mblnr&lt;/P&gt;&lt;P&gt;    mjahr = ht_mseg-mjahr.&lt;/P&gt;&lt;P&gt;    clear ht_lst.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; * note : this may be faster if you specify field by field.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    move-corresponding ht_mkpf to ht_lst.&lt;/P&gt;&lt;P&gt;    move-corresponding ht_mseg to ht_lst.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    perform read_lfa1 using ht_mseg-lifnr changing ht_lst-name1.&lt;/P&gt;&lt;P&gt;    perform read_material using ht_mseg-matnr changing ht_lst-maktx.&lt;/P&gt;&lt;P&gt;    insert table ht_lst.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form fill_ht_lst1.&lt;/P&gt;&lt;P&gt;  refresh ht_lst1.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Example: how to discard unwanted data in an efficient way.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;         hot to simulate a collect in a faster way&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;  loop at ht_mseg.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  filter unwanted data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    check ht_mseg-bwart = '101' or ht_mseg-bwart = '901'.&lt;/P&gt;&lt;P&gt;    check ht_mseg-matnr in so_matnr.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; * note : this may be faster if you specify field by field.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    read table ht_lst1 with table key matnr = ht_mseg-matnr&lt;/P&gt;&lt;P&gt;    transporting erfmg.&lt;/P&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0. " if matnr doesn't exist in sumary table&lt;/P&gt;&lt;P&gt;    " insert a new record&lt;/P&gt;&lt;P&gt;      ht_lst1-matnr = ht_mseg-matnr.&lt;/P&gt;&lt;P&gt;      perform read_material using ht_mseg-matnr changing ht_lst1-maktx.&lt;/P&gt;&lt;P&gt;      ht_lst1-erfmg = ht_mseg-erfmg.&lt;/P&gt;&lt;P&gt;      ht_lst1-erfme = ht_mseg-erfme.&lt;/P&gt;&lt;P&gt;      insert table ht_lst1.&lt;/P&gt;&lt;P&gt;    else." a record was found.&lt;/P&gt;&lt;P&gt;    " collect erfmg.  To do so, fill in the unique key and add&lt;/P&gt;&lt;P&gt;    " the numeric fields.&lt;/P&gt;&lt;P&gt;      ht_lst1-matnr = ht_mseg-matnr.&lt;/P&gt;&lt;P&gt;      add ht_mseg-erfmg to ht_lst1-erfmg.&lt;/P&gt;&lt;P&gt;      modify table ht_lst1 transporting erfmg.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;implementation of cache for lfa1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;form read_lfa1 using p_lifnr changing p_name1.&lt;/P&gt;&lt;P&gt;        read table ht_lfa1 with table key lifnr = p_lifnr&lt;/P&gt;&lt;P&gt;        transporting name1.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    clear ht_lfa1.&lt;/P&gt;&lt;P&gt;    ht_lfa1-lifnr = p_lifnr.&lt;/P&gt;&lt;P&gt;    select single name1&lt;/P&gt;&lt;P&gt;       into ht_lfa1-name1&lt;/P&gt;&lt;P&gt;      from lfa1&lt;/P&gt;&lt;P&gt;    where lifnr = p_lifnr.&lt;/P&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0. ht_lfa1-name1 = 'n/a in lfa1'. endif.&lt;/P&gt;&lt;P&gt;    insert table ht_lfa1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  p_name1 = ht_lfa1-name1.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;implementation of cache for material data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;form read_material using p_matnr changing p_maktx.&lt;/P&gt;&lt;P&gt;  read table ht_material with table key matnr = p_matnr&lt;/P&gt;&lt;P&gt;  transporting maktx.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    ht_material-matnr = p_matnr.&lt;/P&gt;&lt;P&gt;    select single maktx into  ht_material-maktx&lt;/P&gt;&lt;P&gt;      from makt&lt;/P&gt;&lt;P&gt;     where spras = sy-langu&lt;/P&gt;&lt;P&gt;       and matnr = p_matnr.&lt;/P&gt;&lt;P&gt;    if sy-subrc &amp;lt;&amp;gt; 0. ht_material-maktx = 'n/a in makt'. endif.&lt;/P&gt;&lt;P&gt;    insert table ht_material.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  p_maktx = ht_material-maktx.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;form show_data.&lt;/P&gt;&lt;P&gt;  if gp_bymat = ' '.&lt;/P&gt;&lt;P&gt;    perform show_ht_lst.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    perform show_ht_lst1.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;form show_ht_lst.&lt;/P&gt;&lt;P&gt;  "needed because the FM can't use a hashed table.&lt;/P&gt;&lt;P&gt;  it_lst[] = ht_lst[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  perform fill_layout using 'full display'&lt;/P&gt;&lt;P&gt;                       changing ls_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  perform fill_columns_lst.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; perform sort_lst.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  g_repid = sy-repid.&lt;/P&gt;&lt;P&gt;  call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            i_callback_program       = g_repid&lt;/P&gt;&lt;P&gt;            i_callback_pf_status_set = 'SET_PF_STATUS'&lt;/P&gt;&lt;P&gt;            is_layout                = ls_layout&lt;/P&gt;&lt;P&gt;            it_fieldcat              = it_fieldcat_lst[]&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           it_sort                  = it_sort_lst&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       tables&lt;/P&gt;&lt;P&gt;            t_outtab                 = it_lst&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            program_error            = 1&lt;/P&gt;&lt;P&gt;            others                   = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;form show_ht_lst1.&lt;/P&gt;&lt;P&gt;  "needed because the FM can't use a hashed table.&lt;/P&gt;&lt;P&gt;  it_lst1[] = ht_lst1[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  perform fill_layout using 'Sumary by matnr'&lt;/P&gt;&lt;P&gt;                       changing ls_layout.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  perform fill_columns_lst1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; perform sort_lst.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  g_repid = sy-repid.&lt;/P&gt;&lt;P&gt;  call function 'REUSE_ALV_GRID_DISPLAY'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;            i_callback_program       = g_repid&lt;/P&gt;&lt;P&gt;            i_callback_pf_status_set = 'SET_PF_STATUS'&lt;/P&gt;&lt;P&gt;            is_layout                = ls_layout&lt;/P&gt;&lt;P&gt;            it_fieldcat              = it_fieldcat_lst1[]&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           it_sort                  = it_sort_lst&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       tables&lt;/P&gt;&lt;P&gt;            t_outtab                 = it_lst1&lt;/P&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;            program_error            = 1&lt;/P&gt;&lt;P&gt;            others                   = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form fill_layout using p_window_titlebar&lt;/P&gt;&lt;P&gt;               changing cs_layo type slis_layout_alv.&lt;/P&gt;&lt;P&gt;  clear cs_layo.&lt;/P&gt;&lt;P&gt;  cs_layo-window_titlebar        = p_window_titlebar.&lt;/P&gt;&lt;P&gt;  cs_layo-edit                   = 'X'.&lt;/P&gt;&lt;P&gt;  cs_layo-edit_mode              = space.&lt;/P&gt;&lt;P&gt;endform.                    " armar_layout_stock&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form set_pf_status using rt_extab type slis_t_extab.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;create a new status&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;and then select extras -&amp;gt; adjust template -&amp;gt; listviewer&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;  set pf-status 'VISTA'.&lt;/P&gt;&lt;P&gt;endform.        "set_pf_status&lt;/P&gt;&lt;P&gt;define add_lst.&lt;/P&gt;&lt;P&gt;  clear it_fieldcat_lst.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst-fieldname     = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst-outputlen     = &amp;amp;2.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst-ddictxt       = 'L'.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst-seltext_l       = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst-seltext_m       = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst-seltext_m       = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  if &amp;amp;1 = 'MATNR'.&lt;/P&gt;&lt;P&gt;    it_fieldcat_lst-emphasize = 'C111'.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  append it_fieldcat_lst.&lt;/P&gt;&lt;P&gt;end-of-definition.&lt;/P&gt;&lt;P&gt;define add_lst1.&lt;/P&gt;&lt;P&gt;  clear it_fieldcat_lst.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst1-fieldname     = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst1-outputlen     = &amp;amp;2.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst1-ddictxt       = 'L'.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst1-seltext_l       = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst1-seltext_m       = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  it_fieldcat_lst1-seltext_m       = &amp;amp;1.&lt;/P&gt;&lt;P&gt;  append it_fieldcat_lst1.&lt;/P&gt;&lt;P&gt;end-of-definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form fill_columns_lst.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;set columns for output.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  refresh it_fieldcat_lst.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;  add_lst 'BUDAT' 10.&lt;/P&gt;&lt;P&gt;  add_lst   'MBLNR' 10.&lt;/P&gt;&lt;P&gt;  add_lst  'LIFNR' 10.&lt;/P&gt;&lt;P&gt;  add_lst  'NAME1' 35.&lt;/P&gt;&lt;P&gt;  add_lst  'XBLNR' 15.&lt;/P&gt;&lt;P&gt;  add_lst    'ZEILE' 5.&lt;/P&gt;&lt;P&gt;  add_lst    'CHARG' 10.&lt;/P&gt;&lt;P&gt;  add_lst   'MATNR' 18.&lt;/P&gt;&lt;P&gt;  add_lst   'MAKTX' 30.&lt;/P&gt;&lt;P&gt;  add_lst   'ERFMG' 17.&lt;/P&gt;&lt;P&gt;  add_lst   'ERFME' 5.&lt;/P&gt;&lt;P&gt;  add_lst   'MJAHR' 4.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;form fill_columns_lst1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;set columns for output.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  refresh it_fieldcat_lst1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  add_lst1 'MATNR' 18.&lt;/P&gt;&lt;P&gt;  add_lst1 'MAKTX' 30.&lt;/P&gt;&lt;P&gt;  add_lst1 'ERFMG' 17.&lt;/P&gt;&lt;P&gt;  add_lst1 'ERFME' 5..&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ameet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 09:21:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436349#M545006</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T09:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: how to create hashed table in runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436350#M545007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;b&amp;gt;What is use of using HASHED TABLE? &amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;Hashed table is useful when your have to work with very big internal table and to read it with  &lt;/P&gt;&lt;P&gt;"READ TABLE WITH KEY ..."  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The time access is constant !  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Definition of a Hashed Table:&amp;lt;/b&amp;gt;  &lt;/P&gt;&lt;P&gt;"Defines the table as one that is managed with an internal hash procedure. You can imagine a hashed table as a set, whose elements you can address using their unique key. Unlike standard and sorted tables, you cannot access hash tables using an index. All entries in the table must have a unique key.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Access time using the key is constant, regardless of the number of table entries.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can only access a hashed table using the generic key operations or other generic operations (SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM to INSERT itab within a LOOP) are not allowed."  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As long as your records has unique key(s), using hash table will give you a huge performance gain when dealing with large dataset. assuming in your case, 10000 record , and if the key is unique, use hash table.  The main use of hash tables is for looking up fixed information from a key. So if you have a report that has personnel number and you want to display their name, you could use a hash table.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus:  &lt;/P&gt;&lt;P&gt;Code:  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of typ_pernr,  
         pernr  like pa0001-pernr,  
         ename  like pa0001-ename,  
       end   of typ_pernr.  
data: ls_pernr  type typ_pernr,  
      lt_pernr  type&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  &amp;lt;b&amp;gt;hashed table&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;of typ_pernr  with unique key pernr.  
...  
  select pernr ename into table lt_pernr  from pa0001.  
...  
  loop at itab.  
    read table lt_pernr  with table key pernr  =  itab-pernr  
         into ls_pernr.  
    write: ls_pernr-ename, itab-data.  
  endloop. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward  points if it is usefull ......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Girish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2007 09:38:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-hashed-table-in-runtime/m-p/2436350#M545007</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-04T09:38:19Z</dc:date>
    </item>
  </channel>
</rss>

