<?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: Performance for select from view in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719888#M631000</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kishore, &lt;/P&gt;&lt;P&gt;Previous replies are correct. To enhance your join query do not use view, since it won't reduce the run time. &lt;/P&gt;&lt;P&gt;First of all, we need the exact fields for your query,  &lt;/P&gt;&lt;P&gt;and then find the index in tables that match your selection criteria at most, &lt;/P&gt;&lt;P&gt;and then consider to break up your code into separate select statements,&lt;/P&gt;&lt;P&gt;begin with querying the header table (ekko), then ekpo and ekbe.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the program would be looks like : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ebeln ( your fields here ) from ekko &lt;/P&gt;&lt;P&gt;      where .... ( selection criteria here ) &lt;/P&gt;&lt;P&gt;      into table it_ebeln .&lt;/P&gt;&lt;P&gt;if it_ebeln[] is not initial. &lt;/P&gt;&lt;P&gt;  select ebeln ebelp ( your fields here ) from ekpo&lt;/P&gt;&lt;P&gt;     for all entries in it_ekko &lt;/P&gt;&lt;P&gt;     where ebeln eq it_ekko-ebeln and ( selection criteria here )&lt;/P&gt;&lt;P&gt;     into table it_ekpo .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select ebeln ( your fields here ) from ekbe&lt;/P&gt;&lt;P&gt;     for all entries in it_ekko &lt;/P&gt;&lt;P&gt;     where ebeln eq it_ekko-ebeln and ( selection criteria here )&lt;/P&gt;&lt;P&gt;     into table it_ekbe .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif. " it_ebeln&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_ekko.&lt;/P&gt;&lt;P&gt;  loop at it_ekpo and it_ekbe to assign expected data into your output &lt;/P&gt;&lt;P&gt;endloop. " it_ekko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 26 Aug 2007 15:02:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-26T15:02:11Z</dc:date>
    <item>
      <title>Performance for select from view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719882#M630994</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;    There is a select from a view (for ekko, ekpo, ekbe tables) which taking long time, some times going to dump which trying to fetch 20,00,000 recirds from database view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;view has created because selects are taking long time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to fine tune.&lt;/P&gt;&lt;P&gt;Means which one either view takes long time of any other way to replace view select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kishore&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Aug 2007 11:31:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719882#M630994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-21T11:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Performance for select from view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719883#M630995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what do you want to know!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A view is nothing differnt than a join, i.e. a not faster than  a select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;20.000 records from large tables will never be fast, you can only do it as fast as possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tell use the statement, the where clause and the indices of the table which you think are appropriate, then you can start a discussion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 07:53:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719883#M630995</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-22T07:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Performance for select from view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719884#M630996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;U use view or join, the performance will depend on the indexes accessed.&lt;/P&gt;&lt;P&gt;Ideally start with the table which will filter out minimum records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 07:41:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719884#M630996</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T07:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Performance for select from view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719885#M630997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What are the fields you are searching by in the WHERE block?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The performance depends on whether the fields are key or index fields and how you are specifying them.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How many records are you expecting to be selected for processing?  All 20,000,000 or only a much smaller subset?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;inefficient use of access to the tables can vary the runtime from a few minutes to many hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Post more details to the forum for more detailed answers on suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 08:41:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719885#M630997</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T08:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Performance for select from view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719886#M630998</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;reward if usefull&lt;/P&gt;&lt;P&gt;Improve performance of SELECT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This tip has been copied from SearchSap.com&lt;/P&gt;&lt;P&gt;Tip submitted by: Ben Meijs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you all know, it is important to use as many key fields as possible in WHERE clauses of SELECT &lt;/P&gt;&lt;P&gt;statements. Sometimes you are not sure about the value of some key&lt;/P&gt;&lt;P&gt;fields. They seem to be empty (Initial value) but you are afraid to use this in your ABAP coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using the option GE (greater equal) in your coding can improve your performance considerably &lt;/P&gt;&lt;P&gt;without the risk of table lines not being selected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZZBM_SELECT_1 .&lt;/P&gt;&lt;P&gt;TABLES: S001.&lt;/P&gt;&lt;P&gt;CONSTANTS: SSOUR_INI  LIKE S001-SSOUR VALUE   IS INITIAL,&lt;/P&gt;&lt;P&gt;VRSIO_INI  LIKE S001-VRSIO VALUE   IS INITIAL,&lt;/P&gt;&lt;P&gt;SPMON_INI  LIKE S001-SPMON VALUE   IS INITIAL,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SPTAG_INI  LIKE S001-SPTAG VALUE   IS INITIAL,&lt;/P&gt;&lt;P&gt;SPWOC_INI  LIKE S001-SPWOC VALUE   IS INITIAL,&lt;/P&gt;&lt;P&gt;SPBUP_INI  LIKE S001-SPBUP VALUE   IS INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: TA_S001 TYPE STANDARD TABLE OF S001.&lt;/P&gt;&lt;P&gt;DATA: WA_S001 TYPE S001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS:&lt;/P&gt;&lt;P&gt;SO_SPTAG   FOR S001-SPTAG OBLIGATORY,&lt;/P&gt;&lt;P&gt;SO_KUNNR   FOR S001-KUNNR OBLIGATORY,&lt;/P&gt;&lt;P&gt;SO_VKORG   FOR S001-VKORG OBLIGATORY,&lt;/P&gt;&lt;P&gt;SO_VTWEG   FOR S001-VTWEG OBLIGATORY,&lt;/P&gt;&lt;P&gt;SO_SPART   FOR S001-SPART OBLIGATORY,&lt;/P&gt;&lt;P&gt;SO_MATNR   FOR S001-MATNR OBLIGATORY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT        * FROM  S001&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTO TABLE TA_S001&lt;/P&gt;&lt;P&gt;WHERE  SSOUR  GE SSOUR_INI     "Greater Equal initial value&lt;/P&gt;&lt;P&gt;AND    VRSIO  GE VRSIO_INI     "   idem&lt;/P&gt;&lt;P&gt;AND    SPMON  GE SPMON_INI     "   idem&lt;/P&gt;&lt;P&gt;AND    SPTAG  IN SO_SPTAG&lt;/P&gt;&lt;P&gt;AND    SPWOC  GE SPWOC_INI     "   idem&lt;/P&gt;&lt;P&gt;AND    SPBUP  GE SPBUP_INI     "   idem&lt;/P&gt;&lt;P&gt;AND    KUNNR  IN SO_KUNNR&lt;/P&gt;&lt;P&gt;AND    VKORG  IN SO_VKORG&lt;/P&gt;&lt;P&gt;AND    VTWEG  IN SO_VTWEG&lt;/P&gt;&lt;P&gt;AND    SPART  IN SO_SPART&lt;/P&gt;&lt;P&gt;AND    MATNR  IN SO_MATNR.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 12:03:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719886#M630998</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T12:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Performance for select from view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719887#M630999</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;Package size in SELECT statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Package size can be used to retreive a spcific number of records at a time. This can be used if you &lt;/P&gt;&lt;P&gt;for example only want tofinish  processing a limited amount of data at a time due to lack of memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exampel below  read 50 records at a time from VBAK into an internal table, and selects the &lt;/P&gt;&lt;P&gt;corresponding entries from vbap into an internal table. Then the two internal tables can be &lt;/P&gt;&lt;P&gt;processed, and the next 50 records from VBAk can be read. remeber to reinitialize tha tables before &lt;/P&gt;&lt;P&gt;the next read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the usage of SELECT - ENDSELECT !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  z_test                        .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:&lt;/P&gt;&lt;P&gt;BEGIN OF t_vbak,&lt;/P&gt;&lt;P&gt;vbeln LIKE vbak-vbeln,&lt;/P&gt;&lt;P&gt;erdat LIKE vbak-erdat,&lt;/P&gt;&lt;P&gt;END OF t_vbak,&lt;/P&gt;&lt;P&gt;BEGIN OF t_vbap,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;posnr  LIKE vbap-posnr,&lt;/P&gt;&lt;P&gt;matnr  LIKE vbap-matnr,&lt;/P&gt;&lt;P&gt;meins  LIKE vbap-meins,&lt;/P&gt;&lt;P&gt;END OF t_vbap,&lt;/P&gt;&lt;P&gt;BEGIN OF t_report,&lt;/P&gt;&lt;P&gt;vbeln LIKE vbak-vbeln,&lt;/P&gt;&lt;P&gt;erdat LIKE vbak-erdat,&lt;/P&gt;&lt;P&gt;posnr  LIKE vbap-posnr,&lt;/P&gt;&lt;P&gt;matnr  LIKE vbap-matnr,&lt;/P&gt;&lt;P&gt;meins  LIKE vbap-meins,&lt;/P&gt;&lt;P&gt;END OF t_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;li_vbak   TYPE t_vbak OCCURS 0,&lt;/P&gt;&lt;P&gt;l_vbak    TYPE  t_vbak,&lt;/P&gt;&lt;P&gt;li_vbap   TYPE t_vbap OCCURS 0,&lt;/P&gt;&lt;P&gt;l_vbap    TYPE t_vbap,&lt;/P&gt;&lt;P&gt;li_report TYPE t_report OCCURS 0,&lt;/P&gt;&lt;P&gt;l_report  TYPE t_report.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT vbeln erdat&lt;/P&gt;&lt;P&gt;FROM vbak&lt;/P&gt;&lt;P&gt;INTO TABLE li_vbak PACKAGE SIZE 50.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT posnr matnr meins&lt;/P&gt;&lt;P&gt;FROM vbap&lt;/P&gt;&lt;P&gt;INTO TABLE li_vbap&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN li_vbak&lt;/P&gt;&lt;P&gt;WHERE vbeln = li_vbak-vbeln.&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Now you have the two internal tables li_vbak and liÆ_vbap filled with data.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Do something with the data - remember to reinitialize internal tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;All of the  product names here are trademarks of their respective companies.  The site &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.sap.com/www.allsaplinks.com" target="test_blank"&gt;www.allsaplinks.com&lt;/A&gt; no way affiliated with SAP AG. We have made every effort for the content &lt;/P&gt;&lt;P&gt;integrity.  Information used on this site is at your own risk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 12:18:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719887#M630999</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T12:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Performance for select from view</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719888#M631000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kishore, &lt;/P&gt;&lt;P&gt;Previous replies are correct. To enhance your join query do not use view, since it won't reduce the run time. &lt;/P&gt;&lt;P&gt;First of all, we need the exact fields for your query,  &lt;/P&gt;&lt;P&gt;and then find the index in tables that match your selection criteria at most, &lt;/P&gt;&lt;P&gt;and then consider to break up your code into separate select statements,&lt;/P&gt;&lt;P&gt;begin with querying the header table (ekko), then ekpo and ekbe.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the program would be looks like : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ebeln ( your fields here ) from ekko &lt;/P&gt;&lt;P&gt;      where .... ( selection criteria here ) &lt;/P&gt;&lt;P&gt;      into table it_ebeln .&lt;/P&gt;&lt;P&gt;if it_ebeln[] is not initial. &lt;/P&gt;&lt;P&gt;  select ebeln ebelp ( your fields here ) from ekpo&lt;/P&gt;&lt;P&gt;     for all entries in it_ekko &lt;/P&gt;&lt;P&gt;     where ebeln eq it_ekko-ebeln and ( selection criteria here )&lt;/P&gt;&lt;P&gt;     into table it_ekpo .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select ebeln ( your fields here ) from ekbe&lt;/P&gt;&lt;P&gt;     for all entries in it_ekko &lt;/P&gt;&lt;P&gt;     where ebeln eq it_ekko-ebeln and ( selection criteria here )&lt;/P&gt;&lt;P&gt;     into table it_ekbe .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif. " it_ebeln&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_ekko.&lt;/P&gt;&lt;P&gt;  loop at it_ekpo and it_ekbe to assign expected data into your output &lt;/P&gt;&lt;P&gt;endloop. " it_ekko&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Aug 2007 15:02:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-for-select-from-view/m-p/2719888#M631000</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-26T15:02:11Z</dc:date>
    </item>
  </channel>
</rss>

