<?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: For All Entries causes performance issues. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042489#M86923</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more thing that might help.  Make sure that IT is sorted by ID before doing the select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

* Make sure IT is not empty
check not it[] is initial.

&amp;lt;b&amp;gt;sort it ascending by id.&amp;lt;/b&amp;gt;
 
SELECT * FROM (LF_A) INTO TABLE lt_B
FOR ALL ENTRIES IN it
WHERE id = it-id.



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Dec 2005 22:54:35 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-12-21T22:54:35Z</dc:date>
    <item>
      <title>For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042482#M86916</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 following slect statement causes performance issues&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM (LF_A) INTO TABLE lt_B&lt;/P&gt;&lt;P&gt;           FOR ALL ENTRIES IN it&lt;/P&gt;&lt;P&gt;            WHERE id = it-id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The LF_A has more than 300000 thousand records.Is there any alternative to improve this select call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:11:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042482#M86916</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042483#M86917</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;If your internal table lt_B does not require all the fields of table (LF_A ), then select only the requried fields from the table into internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select &amp;lt;field 1 &amp;gt;&lt;/P&gt;&lt;P&gt;       &amp;lt;field 2 &amp;gt;&lt;/P&gt;&lt;P&gt;       from ( LF_A )&lt;/P&gt;&lt;P&gt;       into table lt_b&lt;/P&gt;&lt;P&gt;       for all entried in it&lt;/P&gt;&lt;P&gt;       where id = lt-id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if there are more than 1 primary keys, then do include them in the where clause of the select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:15:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042483#M86917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042484#M86918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use ranges ! This method will reduce the database access!!!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES MEANS : LOOP .... SELECT ... ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO FOR EACH ID A SELECT WILL BE DONE!!! no performant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;better to use ranges! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data it type XXXX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ranges rg for it-id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it.&lt;/P&gt;&lt;P&gt;rg-low = it.&lt;/P&gt;&lt;P&gt;rg-sign = I&lt;/P&gt;&lt;P&gt;rg-option = EQ&lt;/P&gt;&lt;P&gt;append rg.&lt;/P&gt;&lt;P&gt;check sy-tabix eq 3000.&lt;/P&gt;&lt;P&gt;SELECT * FROM (LF_A) appending TABLE lt_B&lt;/P&gt;&lt;P&gt;WHERE id in rg.&lt;/P&gt;&lt;P&gt;free rg.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;LAST SELECT !!!! for the id not selected&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;if not rg[] is initial.&lt;/P&gt;&lt;P&gt;SELECT * FROM (LF_A) appending TABLE lt_B&lt;/P&gt;&lt;P&gt;WHERE id in rg.&lt;/P&gt;&lt;P&gt;endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: STEPHAN KAMINSKI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: STEPHAN KAMINSKI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:17:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042484#M86918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042485#M86919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Firstly, Is id the primary key in LF_A?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, do you need all the fields from LF_A?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you can do is, have iterations, and in each iteration get records from LF_A based on it_B records(say 1000 records in each iteration) and process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:18:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042485#M86919</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042486#M86920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arunkumar,&lt;/P&gt;&lt;P&gt;  for an exhaustive answer you should specify the index of LF_A table but consifer the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Be sure that internal table "it" must be filled (empty tables in FOR ALL ENTRIES statement means a full table scan in LF_A table: all entries will be selected)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Id field ID is not the primary index, you could define an index to improve select in this table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Try to use ranges instead. Even if FOR ALL ENTRIES statement is more efficient than LOOP...SELECT...ENDLOOP.   Using ranges is a best way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Try to limit the number of fields (use select field1 field2... instead of Select *)&lt;/P&gt;&lt;P&gt;Best Regards, Manuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:20:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042486#M86920</guid>
      <dc:creator>manuel_bassani</dc:creator>
      <dc:date>2005-12-21T10:20:48Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042487#M86921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From ur code i can see that,ur using *.Using * will drastically decreases performance specially to ur case with more than 300000 records.My question is do u need all the fields instead u can guve the field name under select instead * which ll definitely improve ur performance.and whats ur primary key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: manikandan rajendran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 10:24:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042487#M86921</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-21T10:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042488#M86922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Arun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As most of the replies have suggested, try not to use a SELECT *, rather get the necessary fields. One other thing is to make sure that table IT actually has values. If table IT is empty, FOR ALL ENTRIES will retrieve all the records in LF_A! Also depending on whether you are using the primary key (or secondary index) when you hit LF_A will also affect your performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Make sure IT is not empty
check not it[] is initial.

SELECT * FROM (LF_A) INTO TABLE lt_B
FOR ALL ENTRIES IN it
WHERE id = it-id.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 22:24:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042488#M86922</guid>
      <dc:creator>former_member221770</dc:creator>
      <dc:date>2005-12-21T22:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042489#M86923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more thing that might help.  Make sure that IT is sorted by ID before doing the select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

* Make sure IT is not empty
check not it[] is initial.

&amp;lt;b&amp;gt;sort it ascending by id.&amp;lt;/b&amp;gt;
 
SELECT * FROM (LF_A) INTO TABLE lt_B
FOR ALL ENTRIES IN it
WHERE id = it-id.



&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 22:54:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042489#M86923</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-12-21T22:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042490#M86924</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;just want to add that, when using FOR ALL ENTRIES, if you do not give the complete key in SELECT XXXX XXXX fields , duplicate entries will not be picked.. So you must be wary of your SELECT depending on the requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Dec 2005 23:07:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042490#M86924</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2005-12-21T23:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: For All Entries causes performance issues.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042491#M86925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;with 'for all entries' ABAP generates an expanded SQL select which it passes to the database system. The more entries you have in your table the bigger this internal select becomes and the less efficient it is. To stop this occuring you can use the 'package size' addition,&lt;/P&gt;&lt;P&gt;i.e change your select to:&lt;/P&gt;&lt;P&gt;..........&lt;/P&gt;&lt;P&gt;SELECT * FROM (LF_A) appending TABLE lt_B PACKAGE SIZE 1000 &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it&lt;/P&gt;&lt;P&gt;WHERE id = it-id.&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;.............&lt;/P&gt;&lt;P&gt;You can put code within the select clause if it makes sense to process before all the data is retrieved or you can wait until the select is exited and the table is full.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to experiment to find the optimum package size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As others have said:&lt;/P&gt;&lt;P&gt;- sort and remove duplicates from table it&lt;/P&gt;&lt;P&gt;- change * to the actual fields you want to retrieve&lt;/P&gt;&lt;P&gt;- do not allow table it to be empty&lt;/P&gt;&lt;P&gt;- does (lf_A) have to be a variable? a hard-coded table name may be more efficient&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Dec 2005 04:12:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/for-all-entries-causes-performance-issues/m-p/1042491#M86925</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2005-12-22T04:12:13Z</dc:date>
    </item>
  </channel>
</rss>

