<?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 Performance issue .. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752368#M1303435</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;I am having a performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it_coepd1 is having around 50000 records with condition abwst = '09' and for every record of this Outer loop there are Twice the No of Records in the Inner loop for both it_coepd &amp;amp; it_coep i.e 1,00,000 records.&lt;/P&gt;&lt;P&gt;We need to delete the Records matching the condition...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly tell me which of the blow code gives better performance..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;LOOP AT it_coepd1 INTO w_coepd where abwst EQ '09'.&lt;/P&gt;&lt;P&gt;      loop at it_coepd where kokrs = w_coepd-kokrs and&lt;/P&gt;&lt;P&gt;                             belnr = w_coepd-belnr and&lt;/P&gt;&lt;P&gt;                             buzei = w_coepd-buzei.&lt;/P&gt;&lt;P&gt;         delete it_coepd.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;      loop at it_coep where kokrs = w_coepd-kokrs and&lt;/P&gt;&lt;P&gt;                            belnr = w_coepd-belnr and&lt;/P&gt;&lt;P&gt;                            buzei = w_coepd-buzei.&lt;/P&gt;&lt;P&gt;         delete it_coep.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;LOOP AT it_coepd1 INTO w_coepd where abwst EQ '09'.&lt;/P&gt;&lt;P&gt;        DELETE it_coepd WHERE kokrs = w_coepd-kokrs&lt;/P&gt;&lt;P&gt;                          AND belnr = w_coepd-belnr&lt;/P&gt;&lt;P&gt;                          AND buzei = w_coepd-buzei.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        DELETE it_coep WHERE kokrs = w_coepd-kokrs&lt;/P&gt;&lt;P&gt;                         AND belnr = w_coepd-belnr&lt;/P&gt;&lt;P&gt;                          AND buzei = w_coepd-buzei.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message - The correct response was to try it before asking the forum - thread locked&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Jun 10, 2009 9:39 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2009 06:14:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-06-10T06:14:12Z</dc:date>
    <item>
      <title>Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752368#M1303435</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;I am having a performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it_coepd1 is having around 50000 records with condition abwst = '09' and for every record of this Outer loop there are Twice the No of Records in the Inner loop for both it_coepd &amp;amp; it_coep i.e 1,00,000 records.&lt;/P&gt;&lt;P&gt;We need to delete the Records matching the condition...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly tell me which of the blow code gives better performance..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;LOOP AT it_coepd1 INTO w_coepd where abwst EQ '09'.&lt;/P&gt;&lt;P&gt;      loop at it_coepd where kokrs = w_coepd-kokrs and&lt;/P&gt;&lt;P&gt;                             belnr = w_coepd-belnr and&lt;/P&gt;&lt;P&gt;                             buzei = w_coepd-buzei.&lt;/P&gt;&lt;P&gt;         delete it_coepd.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;      loop at it_coep where kokrs = w_coepd-kokrs and&lt;/P&gt;&lt;P&gt;                            belnr = w_coepd-belnr and&lt;/P&gt;&lt;P&gt;                            buzei = w_coepd-buzei.&lt;/P&gt;&lt;P&gt;         delete it_coep.&lt;/P&gt;&lt;P&gt;      endloop.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&lt;/P&gt;&lt;P&gt;LOOP AT it_coepd1 INTO w_coepd where abwst EQ '09'.&lt;/P&gt;&lt;P&gt;        DELETE it_coepd WHERE kokrs = w_coepd-kokrs&lt;/P&gt;&lt;P&gt;                          AND belnr = w_coepd-belnr&lt;/P&gt;&lt;P&gt;                          AND buzei = w_coepd-buzei.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        DELETE it_coep WHERE kokrs = w_coepd-kokrs&lt;/P&gt;&lt;P&gt;                         AND belnr = w_coepd-belnr&lt;/P&gt;&lt;P&gt;                          AND buzei = w_coepd-buzei.&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message - The correct response was to try it before asking the forum - thread locked&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Jun 10, 2009 9:39 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 06:14:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752368#M1303435</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T06:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752369#M1303436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;why not check it for ur self.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data:
  W_RUNTIME1 TYPE I,
  W_RUNTIME2 TYPE I,
  W_RUNTIME3 TYPE I,
  W_RUNTIME4 TYPE I.
get RUN TIME FIELD w_runtime1.
 LOOP AT it_coepd1 INTO w_coepd where abwst EQ '09'.
loop at it_coepd where kokrs = w_coepd-kokrs and
belnr = w_coepd-belnr and
buzei = w_coepd-buzei.
delete it_coepd.
endloop.
loop at it_coep where kokrs = w_coepd-kokrs and
belnr = w_coepd-belnr and
buzei = w_coepd-buzei.
delete it_coep.
endloop.
Endloop.
get RUN TIME FIELD w_runtime2.

w_runtime2 = w_runtime2 - w_runtime1.
write w_runtime2.

get RUN TIME FIELD w_runtime3.
LOOP AT it_coepd1 INTO w_coepd where abwst EQ '09'.
DELETE it_coepd WHERE kokrs = w_coepd-kokrs
AND belnr = w_coepd-belnr
AND buzei = w_coepd-buzei.

DELETE it_coep WHERE kokrs = w_coepd-kokrs
AND belnr = w_coepd-belnr
AND buzei = w_coepd-buzei.
Endloop
get RUN TIME FIELD w_runtime4.
w_runtime4 = w_runtime4 - w_runtime3.
write w_runtime4.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the above code to check the performance urself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also suggest u to take a look at implementing parallel cursor technique in ur code to improve ur performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see this thread for help&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="586144"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kartik Tarla on Jun 10, 2009 11:57 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Kartik Tarla on Jun 10, 2009 11:58 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 06:26:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752369#M1303436</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T06:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752370#M1303437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can find it yourself using SE30 transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Tips and tricks in application toolbar in SE30.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Post your code and see the measure runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess the second will give you the better performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 06:29:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752370#M1303437</guid>
      <dc:creator>GauthamV</dc:creator>
      <dc:date>2009-06-10T06:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752371#M1303438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use  inernal table of type sorted or hashed for large no of data&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : it_temp_coepd like sorted table of it_coepd  with non-unique key kokrs belnr buzei.&lt;/P&gt;&lt;P&gt;now move data &lt;/P&gt;&lt;P&gt;it_temp_coepd[] = it_coepd[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now process on it_temp_coepd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regars,&lt;/P&gt;&lt;P&gt;Alpesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alpesh on Jun 10, 2009 12:01 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 06:31:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752371#M1303438</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T06:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752372#M1303439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Forget the cursor technique it is nowhere described for the general case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normal LOOPs and READs are absolutely suifficient.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You programm is automatically fine, if you switch the second loop to a sorted table, i.e.&lt;/P&gt;&lt;P&gt;a table with an index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without index is MUST be slow!!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to optimize LOOP WHERE on standard tables can be found here, section 3,&lt;/P&gt;&lt;P&gt;READ BINARY SEARCH,  LOOP FROM INDEX and EXIT condfition !!!!!!&lt;/P&gt;&lt;P&gt;Measurements on internal tables: Reads and Loops:&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/09/12/runtimes-of-reads-and-loops-on-internal-tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also for the delete use it with index, store tabix = sy-tabix after the loop.&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, 10 Jun 2009 06:39:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752372#M1303439</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T06:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752373#M1303440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this code will be very fast.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: lv_index type sy-index,
        lv_index2 type sy-index,
        lv_index3 type sy-index.

sort it_coepd1 by abwst kokrs belnr  buzei.
sort it_coepd by abwst kokrs belnr  buzei.
sort it_coep rom by abwst kokrs belnr  buzei.

read table it_coepd1 
into w_coepd 
with key abwst EQ '09' binary search.
 lv_index  = sy-tabix.

LOOP AT it_coepd1 INTO w_coepd from lv_index.
if w_coepd-abwst = '09'.
loop at it_coepd from lv_index1.

if kokrs ne w_coepd-kokrs or belnr ne w_coepd-belnr or 
buzei ne w_coepd-buzei.
lv_index1 = sy-tabix.
exit.
endif.
delete it_coepd.
endloop.

loop at it_coep rom lv_index1.
if kokrs ne w_coepd-kokrs ne belnr = w_coepd-belnr ne
buzei = w_coepd-buzei.
lv_index2 = sy-tabix.
exit.
endif.
delete it_coep.
endloop.

endif.
Endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check this link for more.&lt;/P&gt;&lt;P&gt;[http://nafran.blogspot.com/2009/05/best-way-to-code-nested-loops-sap.html|http://nafran.blogspot.com/2009/05/best-way-to-code-nested-loops-sap.html]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nafran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 08:18:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752373#M1303440</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T08:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752374#M1303441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;This code is fast, but it is not correct!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT it_coepd1 INTO w_coepd from lv_index.
if w_coepd-abwst = '09'.
loop at it_coepd from lv_index1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use not three condition but only one:&lt;/P&gt;&lt;P&gt;itab1&lt;/P&gt;&lt;P&gt;a&lt;/P&gt;&lt;P&gt;b&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;d&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2&lt;/P&gt;&lt;P&gt;a&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;d&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As value c is missing in itab1, it will never continue!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also the three sorts are not necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sorted or hashed table are the BEST SOLUTIONS!, the optimization with the binary search is&lt;/P&gt;&lt;P&gt;the other solution. There is no need for additional solutions.&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, 10 Jun 2009 10:41:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752374#M1303441</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T10:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752375#M1303442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Edited by: Matt on Jun 10, 2009 1:18 PM - removed rude reply&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 10:50:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752375#M1303442</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T10:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752376#M1303443</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 be polite in all communications.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 11:21:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752376#M1303443</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-06-10T11:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue ..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752377#M1303444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;for every record of this Outer loop there are Twice the No of Records in the Inner loop for both it_coepd &amp;amp; it_coep&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i think this clears everything. sry if my early post was Uncivil.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but ppl do understand that a person having lesser points does not mean his dum or he cant write wiki's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nafran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2009 11:38:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/5752377#M1303444</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-10T11:38:14Z</dc:date>
    </item>
  </channel>
</rss>

