<?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 Issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466431#M219648</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;  Make sure the top portion of the keys are always populated. In your case the fields S_VRSIO, S_VKORG, S_SPBUP can be blank. If it is not populated then populate those ranges. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;       ssour EQ space &lt;/P&gt;&lt;P&gt;       AND vrsio IN s_vrsio &lt;/P&gt;&lt;P&gt;       AND spmon EQ '000000' &lt;/P&gt;&lt;P&gt;       AND sptag EQ '00000000' &lt;/P&gt;&lt;P&gt;       AND spwoc EQ '000000' &lt;/P&gt;&lt;P&gt;       AND vkorg IN s_vkorg &lt;/P&gt;&lt;P&gt;       AND spbup IN s_spbup &lt;/P&gt;&lt;P&gt;       AND pkunag EQ r_kunnr-low&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, create an index on the customer field if it always has a value in the select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Aug 2006 19:05:00 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-08T19:05:00Z</dc:date>
    <item>
      <title>Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466426#M219643</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;The following Statement takes a lot of time..any suggestions on Improvement.&lt;/P&gt;&lt;P&gt;I cant use FOR ALL ENTRIES since i need the duplicate entries as well...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT r_kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    DELETE r_kdgrp WHERE NOT low IN s_kdgrp.&lt;/P&gt;&lt;P&gt;    DELETE r_bzirk WHERE NOT low IN s_bzirk.&lt;/P&gt;&lt;P&gt;    CHECK r_kdgrp[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;    CHECK r_bzirk[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     SELECT vbeln vkorg pkunag kdgrp bzirk pkunrg           &lt;/P&gt;&lt;P&gt;            matnr posnr kzwi3 kzwi4 kzwi5                   &lt;/P&gt;&lt;P&gt;     APPENDING TABLE t_s502                                 &lt;/P&gt;&lt;P&gt;     FROM s502&lt;/P&gt;&lt;P&gt;     WHERE ssour  EQ space                                   &lt;/P&gt;&lt;P&gt;      AND vrsio  IN s_vrsio                                 &lt;/P&gt;&lt;P&gt;      AND spmon  EQ '000000'                               &lt;/P&gt;&lt;P&gt;      AND sptag  EQ '00000000'                             &lt;/P&gt;&lt;P&gt;      AND spwoc  EQ '000000'                               &lt;/P&gt;&lt;P&gt;      AND vkorg  IN s_vkorg                                &lt;/P&gt;&lt;P&gt;       AND spbup  IN s_spbup                                  &lt;/P&gt;&lt;P&gt;      AND pkunag EQ r_kunnr-low                             &lt;/P&gt;&lt;P&gt;      AND kdgrp  IN r_kdgrp                                 &lt;/P&gt;&lt;P&gt;      AND bzirk  IN r_bzirk                                &lt;/P&gt;&lt;P&gt;       AND vbeln  IN s_vbeln&lt;/P&gt;&lt;P&gt;       AND matnr  IN s_matnr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 18:02:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466426#M219643</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T18:02: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/1466427#M219644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have that table in my system, but please make sure that the WHERE clause fields are in the same exact order as the key in the S502 table.&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>Mon, 07 Aug 2006 18:05:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466427#M219644</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-07T18:05: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/1466428#M219645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DELETE r_kdgrp WHERE NOT low IN s_kdgrp.&lt;/P&gt;&lt;P&gt;DELETE r_bzirk WHERE NOT low IN s_bzirk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT vbeln vkorg pkunag kdgrp bzirk pkunrg &lt;/P&gt;&lt;P&gt;matnr posnr kzwi3 kzwi4 kzwi5 &lt;/P&gt;&lt;P&gt;APPENDING TABLE t_s502 &lt;/P&gt;&lt;P&gt;FROM s502&lt;/P&gt;&lt;P&gt;WHERE ssour EQ space &lt;/P&gt;&lt;P&gt;AND vrsio IN s_vrsio &lt;/P&gt;&lt;P&gt;AND spmon EQ '000000' &lt;/P&gt;&lt;P&gt;AND sptag EQ '00000000' &lt;/P&gt;&lt;P&gt;AND spwoc EQ '000000' &lt;/P&gt;&lt;P&gt;AND vkorg IN s_vkorg &lt;/P&gt;&lt;P&gt;AND spbup IN s_spbup &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;AND pkunag in r_kunnr&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;AND kdgrp IN r_kdgrp &lt;/P&gt;&lt;P&gt;AND bzirk IN r_bzirk &lt;/P&gt;&lt;P&gt;AND vbeln IN s_vbeln&lt;/P&gt;&lt;P&gt;AND matnr IN s_matnr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the above code.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 18:07:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466428#M219645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T18:07: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/1466429#M219646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rich and Ravi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ll try the code and keep you posted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Brain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Aug 2006 18:48:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466429#M219646</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-07T18:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466430#M219647</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 have tried the code, but it dint improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rich,  the order in the where clause is the same as in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wat else can be done to improve the performance...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to let you all know the number of entries in the table are more than 200 million.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Brain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Aug 2006 18:34:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466430#M219647</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-08T18:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466431#M219648</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;  Make sure the top portion of the keys are always populated. In your case the fields S_VRSIO, S_VKORG, S_SPBUP can be blank. If it is not populated then populate those ranges. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;       ssour EQ space &lt;/P&gt;&lt;P&gt;       AND vrsio IN s_vrsio &lt;/P&gt;&lt;P&gt;       AND spmon EQ '000000' &lt;/P&gt;&lt;P&gt;       AND sptag EQ '00000000' &lt;/P&gt;&lt;P&gt;       AND spwoc EQ '000000' &lt;/P&gt;&lt;P&gt;       AND vkorg IN s_vkorg &lt;/P&gt;&lt;P&gt;       AND spbup IN s_spbup &lt;/P&gt;&lt;P&gt;       AND pkunag EQ r_kunnr-low&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise, create an index on the customer field if it always has a value in the select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Aug 2006 19:05:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466431#M219648</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-08T19:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466432#M219649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, why are you doing the following part of the code in the loop. You can do that outside the loop as these lines don't seem to be dependent on the loop record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE r_kdgrp WHERE NOT low IN s_kdgrp.&lt;/P&gt;&lt;P&gt;DELETE r_bzirk WHERE NOT low IN s_bzirk.&lt;/P&gt;&lt;P&gt;CHECK r_kdgrp[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;CHECK r_bzirk[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, instead of looping at r_kunnr, why can't you use it with IN clause as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DELETE r_kdgrp WHERE NOT low IN s_kdgrp.
DELETE r_bzirk WHERE NOT low IN s_bzirk.

CHECK r_kdgrp[] IS NOT INITIAL.
CHECK r_bzirk[] IS NOT INITIAL.

SELECT vbeln vkorg  pkunag kdgrp
       bzirk pkunrg matnr  posnr
       kzwi3 kzwi4  kzwi5 INTO TABLE t_s502
                          FROM s502
                         WHERE ssour  EQ space
                           AND vrsio  IN s_vrsio
                           AND spmon  EQ '000000'
                           AND sptag  EQ '00000000'
                           AND spwoc  EQ '000000'
                           AND vkorg  IN s_vkorg
                           AND spbup  IN s_spbup
                           &amp;lt;b&amp;gt;AND pkunag IN r_kunnr&amp;lt;/b&amp;gt;
                           AND kdgrp  IN r_kdgrp
                           AND bzirk  IN r_bzirk
                           AND vbeln  IN s_vbeln
                           AND matnr  IN s_matnr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like this is a custom infostructure. If you are having so many millions of records, then you have to make sure that the key fields are passed in the WHERE clause. Do a SQL trace and see if it is doing an index search or sequential search. If any of the fields in the above WHERE clause are non-key fields, then remove them from the WHERE clause and delete the unwanted records after the select. Something like this, assuming VBELN and MATNR are non-key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT vbeln vkorg  pkunag kdgrp
       bzirk pkunrg matnr  posnr
       kzwi3 kzwi4  kzwi5 INTO TABLE t_s502
                          FROM s502
                         WHERE ssour  EQ space
                           AND vrsio  IN s_vrsio
                           AND spmon  EQ '000000'
                           AND sptag  EQ '00000000'
                           AND spwoc  EQ '000000'
                           AND vkorg  IN s_vkorg
                           AND spbup  IN s_spbup
                           AND pkunag IN r_kunnr
                           AND kdgrp  IN r_kdgrp
                           AND bzirk  IN r_bzirk.

DELETE t_s502 WHERE NOT ( vbeln  IN s_vbeln AND
                          matnr  IN s_matnr ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Aug 2006 19:10:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/1466432#M219649</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-08T19:10:20Z</dc:date>
    </item>
  </channel>
</rss>

