<?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 tuning in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789916#M1121902</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi jaya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your code  is:&lt;/P&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;I have a code of the following type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select from table into i_tab where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;loop at i_tab assigning &amp;lt;field-symbol&amp;gt;&lt;/P&gt;&lt;P&gt;read i_tab with &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;execute some actions&amp;gt; &lt;/P&gt;&lt;P&gt;read i_tab with &amp;lt;condition2&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;execute actions&amp;gt;&lt;/P&gt;&lt;P&gt;....................&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT TAB1.&lt;/P&gt;&lt;P&gt;      READ TABLE TAB2 WITH KEY K = TAB1-K &lt;/P&gt;&lt;P&gt;CHECK SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Run Time (Micro Seconds) 9,682&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join two internal tables using key/binary search&lt;/P&gt;&lt;P&gt;Note: In this example, TAB2 is sorted by K in ascending order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LOOP AT TAB1.&lt;/P&gt;&lt;P&gt;      READ TABLE TAB2 WITH KEY K = TAB1-K BINARY SEARCH.&lt;/P&gt;&lt;P&gt;             CHECK SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Run Time (Micro Seconds) 9,751&lt;/STRONG&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;So,you can clearly see the difference between two,&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Meena&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Dec 2008 12:56:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-03T12:56:20Z</dc:date>
    <item>
      <title>Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789906#M1121892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moved to correct forum by moderator.  Please also use a meaningful subject in future&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;I have a code of the following type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select from table into i_tab where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;loop at i_tab assigning &amp;lt;field-symbol&amp;gt;&lt;/P&gt;&lt;P&gt;read i_tab  with &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;  &amp;lt;execute some actions&amp;gt; &lt;/P&gt;&lt;P&gt;read i_tab with &amp;lt;condition2&amp;gt;&lt;/P&gt;&lt;P&gt; &amp;lt;execute actions&amp;gt;&lt;/P&gt;&lt;P&gt;....................&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but this is taking a lot of time.&lt;/P&gt;&lt;P&gt;If the number of records is more then it is looping through the records, reading the table, executing action  for each and every record.&lt;/P&gt;&lt;P&gt;So the performance is poor.&lt;/P&gt;&lt;P&gt;Can someone suggest alternative ways ? &lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chithra.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matt on Dec 3, 2008 1:48 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 11:01:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789906#M1121892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T11:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789907#M1121893</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;Try to code like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select from table into &lt;STRONG&gt;table&lt;/STRONG&gt; i_tab where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;loop at i_tab assigning &amp;lt;field-symbol&amp;gt; where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;                                      and /or    &amp;lt;condition2&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;execute some actions&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;execute actions2&amp;gt;&lt;/P&gt;&lt;P&gt;....................&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rajat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 11:03:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789907#M1121893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T11:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789908#M1121894</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 you used binary search in read stmt.&lt;/P&gt;&lt;P&gt;If no, do remember to sort the fields also...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Krishna...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 11:04:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789908#M1121894</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T11:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789909#M1121895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;If you want the program to look at every record all you can do is loop and within that you do the stuff.&lt;/P&gt;&lt;P&gt;If you dont want the program to look at every record based on some field then you can use atnew.&lt;/P&gt;&lt;P&gt;dont forget to sort  if you want to use atnew.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: BrightSide on Dec 3, 2008 11:06 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 11:05:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789909#M1121895</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T11:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789910#M1121896</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;I haven't understand your requirement..why ur looping the i_tab table and again in that reading the same table i_tab...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anywayz according to your posted code i can suggest the following code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After select stmt....find out the total no.of records in that table....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose 5 records then write the logic as follows :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do 5 times.&lt;/P&gt;&lt;P&gt;read table i_tab with condition 1 and condition 2&lt;/P&gt;&lt;P&gt;do ur action.&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use binary search to read the table but b4 that sort the table...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rohan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rohan on Dec 3, 2008 12:08 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 11:07:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789910#M1121896</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T11:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789911#M1121897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jayachitra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to loop through all the records that has been selected, then i dont think you can find any alternative.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont think you need to use READ at first place. You are looping in itab and reading the same table inside. Instead you can directly use CASE statement or IF...ELSE condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is required, then Possible performance tuning technique for this could be as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Try to restrict as many records as possible when you are selecting the records.&lt;/P&gt;&lt;P&gt;2. Also when you are Reading a table, use &lt;STRONG&gt;BINARY SEARCH&lt;/STRONG&gt;. Before entering the loop, use &lt;STRONG&gt;SORT&lt;/STRONG&gt; the table that you want to read. This would increase the performance in terms of READ statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 11:08:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789911#M1121897</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T11:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789912#M1121898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jaya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Do it this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Data:
  count type i value 1.

Describe table t_table lines w_lines.

Do w_lines times.

  READ TABLE t_table INTO wa_table INDEX count.

  If condition...
    &amp;lt;execute some actions&amp;gt; 
  elseif condition...
   &amp;lt;execute some actions&amp;gt; 
  endif.

count = count + 1.
Enddo.&lt;/CODE&gt;&lt;/PRE&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;With luck,&lt;/P&gt;&lt;P&gt;Pritam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 11:26:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789912#M1121898</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T11:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789913#M1121899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Where exactly is your problem. Reading the same table inside the loop is not a good way, but it could be that the select query also is taking lot of time. Did you check the sql trace in ST05 to see how the select is running. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as the loop at itab is concerned, i would do something like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
select from table into i_tab where &amp;lt;condition&amp;gt;
loop at i_tab assigning &amp;lt;field-symbol&amp;gt;

if &amp;lt;condition&amp;gt;  " Here you woould compare the fields of the &amp;lt;field-symbol&amp;gt; with some value
&amp;lt;execute some actions&amp;gt; 

if &amp;lt;condition2&amp;gt; " Here you would compare the fields of the &amp;lt;field-symbol&amp;gt; with some value
&amp;lt;execute actions&amp;gt;
....................
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No need write a Do and End do and read the table inside that loop. Simply loop at itab and check for each condition and execute the actions.&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;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 12:36:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789913#M1121899</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T12:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789914#M1121900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Please use a meaningful subject in future&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 12:49:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789914#M1121900</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-12-03T12:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789915#M1121901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jaya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use BINARY SEARCH in read statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Flavya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 12:52:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789915#M1121901</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T12:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Performance tuning</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789916#M1121902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi jaya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your code  is:&lt;/P&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;I have a code of the following type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select from table into i_tab where &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;loop at i_tab assigning &amp;lt;field-symbol&amp;gt;&lt;/P&gt;&lt;P&gt;read i_tab with &amp;lt;condition&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;execute some actions&amp;gt; &lt;/P&gt;&lt;P&gt;read i_tab with &amp;lt;condition2&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;execute actions&amp;gt;&lt;/P&gt;&lt;P&gt;....................&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT TAB1.&lt;/P&gt;&lt;P&gt;      READ TABLE TAB2 WITH KEY K = TAB1-K &lt;/P&gt;&lt;P&gt;CHECK SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Run Time (Micro Seconds) 9,682&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Join two internal tables using key/binary search&lt;/P&gt;&lt;P&gt;Note: In this example, TAB2 is sorted by K in ascending order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LOOP AT TAB1.&lt;/P&gt;&lt;P&gt;      READ TABLE TAB2 WITH KEY K = TAB1-K BINARY SEARCH.&lt;/P&gt;&lt;P&gt;             CHECK SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Run Time (Micro Seconds) 9,751&lt;/STRONG&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;So,you can clearly see the difference between two,&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Meena&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Dec 2008 12:56:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-tuning/m-p/4789916#M1121902</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-03T12:56:20Z</dc:date>
    </item>
  </channel>
</rss>

