<?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 problem of asset selection statement. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-of-asset-selection-statement/m-p/7329910#M1538024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys quick question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT a~bukrs
           a~anln1
           b~anln2
           a~anlkl
           a~aktiv
           a~txt50
           a~lvtnr
           b~afabe
           b~afabg
           b~ndjar
           b~ndper
           INTO TABLE it_anla
           FROM anla AS a
           INNER JOIN anlb AS b
           ON a~bukrs EQ b~bukrs
           AND a~anln1 EQ b~anln1
           WHERE a~bukrs IN s_bukrs
           AND a~anln1 IN s_anln1
           AND a~anln2 EQ '0000'
           AND a~anlkl IN s_anlkl
           AND a~aktiv EQ '00000000'
           AND a~lvtnr IN s_lvtnr
           AND b~afabe EQ 01.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have a select statement which is filtered by capitalization date which is the field AKTIV. This select alone has 450 thousand hits. Having an ANLN2 = 0 and AKTIV  = blank/no date means that the asset group is no longer active. &lt;/P&gt;&lt;P&gt;Now for another scenario I have to retrieve table ANLA again excluding all the Main Asset Number/ANLN1 found on that table. &lt;/P&gt;&lt;P&gt;Is there a way to select by doing it only once?&lt;/P&gt;&lt;P&gt;I tried to pass all the anln1 to a range table but the program dumps. I think the range table can't handle too many entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Retrieving all the entries from the DB then processing it takes longer.&lt;/P&gt;&lt;P&gt;I tried to delete the table using a loop but it takes to long as it process the table every loop.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_anla WHERE anln2 EQ '0000' AND aktiv EQ '0000000'.
      DELETE it_anla WHERE bukrs EQ it_anla-bukrs AND anln1 EQ it_anla-anln1.
    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Sep 21, 2010 5:39 PM - &lt;STRONG&gt;please use code tags&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Sep 2010 14:53:06 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-09-21T14:53:06Z</dc:date>
    <item>
      <title>performance problem of asset selection statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-of-asset-selection-statement/m-p/7329910#M1538024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys quick question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT a~bukrs
           a~anln1
           b~anln2
           a~anlkl
           a~aktiv
           a~txt50
           a~lvtnr
           b~afabe
           b~afabg
           b~ndjar
           b~ndper
           INTO TABLE it_anla
           FROM anla AS a
           INNER JOIN anlb AS b
           ON a~bukrs EQ b~bukrs
           AND a~anln1 EQ b~anln1
           WHERE a~bukrs IN s_bukrs
           AND a~anln1 IN s_anln1
           AND a~anln2 EQ '0000'
           AND a~anlkl IN s_anlkl
           AND a~aktiv EQ '00000000'
           AND a~lvtnr IN s_lvtnr
           AND b~afabe EQ 01.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have a select statement which is filtered by capitalization date which is the field AKTIV. This select alone has 450 thousand hits. Having an ANLN2 = 0 and AKTIV  = blank/no date means that the asset group is no longer active. &lt;/P&gt;&lt;P&gt;Now for another scenario I have to retrieve table ANLA again excluding all the Main Asset Number/ANLN1 found on that table. &lt;/P&gt;&lt;P&gt;Is there a way to select by doing it only once?&lt;/P&gt;&lt;P&gt;I tried to pass all the anln1 to a range table but the program dumps. I think the range table can't handle too many entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Retrieving all the entries from the DB then processing it takes longer.&lt;/P&gt;&lt;P&gt;I tried to delete the table using a loop but it takes to long as it process the table every loop.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_anla WHERE anln2 EQ '0000' AND aktiv EQ '0000000'.
      DELETE it_anla WHERE bukrs EQ it_anla-bukrs AND anln1 EQ it_anla-anln1.
    ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Sep 21, 2010 5:39 PM - &lt;STRONG&gt;please use code tags&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 14:53:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-of-asset-selection-statement/m-p/7329910#M1538024</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-21T14:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: performance problem of asset selection statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-of-asset-selection-statement/m-p/7329911#M1538025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN __default_attr="green" __jive_macro_name="color"&gt;Moderator message - Welcome to SCN
            
If the range table for anln1 is large and contains distinct values, you can try using it in a FOR ALL ENTRIES construct rather than IN.

Rob&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Sep 2010 16:03:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-of-asset-selection-statement/m-p/7329911#M1538025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-09-21T16:03:49Z</dc:date>
    </item>
  </channel>
</rss>

