<?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: Problem : SELECT from LTAP table takes much time (Sort in Database layer) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791366#M1309983</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think in your case going for a max statement will be good and i agree with Siegfried its not selecting one record but selecting all and then returning one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nafran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jul 2009 04:22:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-07-09T04:22:26Z</dc:date>
    <item>
      <title>Problem : SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791361#M1309978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys,&lt;/P&gt;&lt;P&gt;Im having problem with this select statement. It takes much time just to get single record.&lt;/P&gt;&lt;P&gt;The problem is with accessing the LTAP table and the ORDER BY DESCENDING statement.&lt;/P&gt;&lt;P&gt;The objective of this select statement is to get the non blocked storage bin which is used by latest transfer order number.&lt;/P&gt;&lt;P&gt;If the latest transfer order no storage bin is blocked, then it will loop and get the 2nd latest transfer order no's storage bin and &lt;/P&gt;&lt;P&gt;checks whether it blocked or not. It will keep looping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The secondary index has been created but the it still taking much time (3 minutes for 10K records in LTAP)&lt;/P&gt;&lt;P&gt;Secondary Indexes:&lt;/P&gt;&lt;P&gt;a) LTAP_M -&amp;gt;MANDTLGNUM PQUIT MATNR&lt;/P&gt;&lt;P&gt;b)LTAP_L  -&amp;gt;LGNUM PQUIT VLTYP VLPLA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the coding.&lt;/P&gt;&lt;P&gt;******************&lt;STRONG&gt;Start of DEVK9A14JW&lt;/STRONG&gt;**************************&lt;/P&gt;&lt;P&gt;    SELECT ltap&lt;SUB&gt;tanum ltap&lt;/SUB&gt;nlpla ltap~wdatu INTO (ltap-tanum, ltap-nlpla, ltap-wdatu)&lt;/P&gt;&lt;P&gt;          UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;          FROM ltap INNER JOIN lagp                         "DEVK9A15OA&lt;/P&gt;&lt;P&gt;          ON lagp&lt;SUB&gt;lgnum =  ltap&lt;/SUB&gt;lgnum&lt;/P&gt;&lt;P&gt;          AND lagp&lt;SUB&gt;lgtyp =  ltap&lt;/SUB&gt;nltyp&lt;/P&gt;&lt;P&gt;          AND lagp&lt;SUB&gt;lgpla =  ltap&lt;/SUB&gt;nlpla&lt;/P&gt;&lt;P&gt;            WHERE lagp~skzue = ' '&lt;/P&gt;&lt;P&gt;            AND ltap~pquit = 'X'&lt;/P&gt;&lt;P&gt;            AND ltap~matnr = ls_9001_scrn-matnr&lt;/P&gt;&lt;P&gt;            AND ltap~lgort = ls_9001_scrn-to_lgort&lt;/P&gt;&lt;P&gt;            AND ltap~lgnum = ls_9001_scrn-lgnum&lt;/P&gt;&lt;P&gt;            AND ltap~nltyp = ls_9001_scrn-nltyp&lt;/P&gt;&lt;P&gt;      ORDER BY tanum DESCENDING.&lt;/P&gt;&lt;P&gt;     ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;      ls_9001_scrn-nlpla = ltap-nlpla.&lt;/P&gt;&lt;P&gt;      EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;******************&lt;STRONG&gt;End of DEVK9A14JW&lt;/STRONG&gt;**************************&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 08:22:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791361#M1309978</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T08:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem : SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791362#M1309979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try removing the "ORDER BY tanum DESCENDING" addition and use SORT abap statement .&lt;/P&gt;&lt;P&gt;This would decrease Database Lead time&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;A J R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 10:42:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791362#M1309979</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T10:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problem : SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791363#M1309980</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;which of your WHERE conditions are filled? all of them?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
WHERE lagp~skzue = ' '
AND ltap~pquit = 'X'
AND ltap~matnr = ls_9001_scrn-matnr
AND ltap~lgort = ls_9001_scrn-to_lgort
AND ltap~lgnum = ls_9001_scrn-lgnum
AND ltap~nltyp = ls_9001_scrn-nltyp
ORDER BY tanum DESCENDING.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your index... have you tried it like this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it should contain the (selective) fields that are used with = and the TANUM field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 13:08:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791363#M1309980</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2009-07-03T13:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem : SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791364#M1309981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Im having problem with this select statement. It takes much time just to get single record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not true. Together with the ORDER BY the UP TO 1 ROWS does not read 1 record but prepare all records, orders them and return one record, i.e. the largest in sort order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You must check what you need, either you need the largest record, then this can be your only possible solution.&lt;/P&gt;&lt;P&gt;If you need only one recoird then the ORDER BY does not make sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need the single largest record, then sometimes the aggregate function MAX can be an alternative.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did not look at the index support, this can always be a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jul 2009 08:42:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791364#M1309981</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-06T08:42:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem : SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791365#M1309982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I guess you sort descending is used to get the last tanum number.&lt;/P&gt;&lt;P&gt;If so, you could try something like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT MAX( ltap~tanum ) INTO ltap-tanum
FROM ltap INNER JOIN lagp "DEVK9A15OA
ON lagp~lgnum = ltap~lgnum
AND lagp~lgtyp = ltap~nltyp
AND lagp~lgpla = ltap~nlpla
WHERE lagp~skzue = ' '
AND ltap~pquit = 'X'
AND ltap~matnr = ls_9001_scrn-matnr
AND ltap~lgort = ls_9001_scrn-to_lgort
AND ltap~lgnum = ls_9001_scrn-lgnum
AND ltap~nltyp = ls_9001_scrn-nltyp.

SELECT SINGLE ltap~tanum ltap~nlpla ltap~wdatu INTO (ltap-tanum, ltap-nlpla, ltap-wdatu)
FROM ltap
WHERE tanum = ltap-tanum.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope can help you,&lt;/P&gt;&lt;P&gt;Frisoni&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2009 18:43:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791365#M1309982</guid>
      <dc:creator>guilherme_frisoni</dc:creator>
      <dc:date>2009-07-07T18:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problem : SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791366#M1309983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think in your case going for a max statement will be good and i agree with Siegfried its not selecting one record but selecting all and then returning one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nafran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 04:22:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791366#M1309983</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T04:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problem : SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791367#M1309984</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;Remove the join statement within select...endselect.&lt;/P&gt;&lt;P&gt;instead of that fatch the data in the primary table first and then take the data from 2nd table based on condition for For all entries....&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shashi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 04:31:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791367#M1309984</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T04:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem : SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791368#M1309985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Remove the join statement within select...endselect.&lt;/P&gt;&lt;P&gt;&amp;gt; instead of that fatch the data in the primary table first and then take the data from &lt;/P&gt;&lt;P&gt;&amp;gt; 2nd table based on condition for For all entries....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sometimes there is only one comment possible: nonsense !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2009 08:23:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791368#M1309985</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-09T08:23:44Z</dc:date>
    </item>
  </channel>
</rss>

