<?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: 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/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791760#M1310049</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using for all entries instead of join as in ur query in ur where clause u are using non-key fields and not all the key fields are there in where clause...so join will reduce performance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Jul 2009 09:00:56 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-07-03T09:00:56Z</dc:date>
    <item>
      <title>SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791755#M1310044</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:23:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791755#M1310044</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T08:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791756#M1310045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using select....endselect if u can fetch ur data in an internal table and instead of doing ORDER BY in select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use SORT itab by DESCENDING.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 08:49:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791756#M1310045</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T08:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791757#M1310046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep I tried that too, select from ltap into internal table, SORT it descdending by tanum. Then I loop and check with LAGP table.&lt;/P&gt;&lt;P&gt;But the problem is during fetching the records from LTAP into internal table. It still takes much time.(3 minutes for 10K records).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 08:55:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791757#M1310046</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T08:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791758#M1310047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your code you are using Select Endselect,to avoid performence issue we should not use this statement untill it is really very necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the statement&lt;/P&gt;&lt;P&gt;Selet (fields) from database table into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so you can use the below code for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT single  ltap&lt;SUB&gt;tanum ltap&lt;/SUB&gt;nlpla ltap~wdatu &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INTO table itab&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FROM ltap INNER JOIN lagp&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 08:57:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791758#M1310047</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T08:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791759#M1310048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm.. actually I need to use the SELECT n ENDSELECT because of UP TO 1 ROWS.&lt;/P&gt;&lt;P&gt;I need to use UP TO 1 ROWS because i select the LTAP not using key fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 08:59:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791759#M1310048</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T08:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791760#M1310049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using for all entries instead of join as in ur query in ur where clause u are using non-key fields and not all the key fields are there in where clause...so join will reduce performance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:00:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791760#M1310049</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791761#M1310050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep I tried that too like below. But the performance is better if I use INNER JOIN than FOR ALL ENTRIES.&lt;/P&gt;&lt;P&gt;The problem is when select from the LTAP table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used OPEN CURSOR statement also. And limit the ltap record by 50 but still takes much time accessing LTAP table. Weird!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I even have used MAX GROUP BY in my above INNER JOIN statemen to replace the GROUP BY DESCENDING, but it returned me incorrect result maybe because of the INNER JOIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT tanum nlpla wdatu lgnum nltyp INTO TABLE t_ltap&lt;/P&gt;&lt;P&gt;    WHERE lgnum = ls_9001_scrn-lgnum&lt;/P&gt;&lt;P&gt;      AND pquit = 'X'&lt;/P&gt;&lt;P&gt;      AND matnr = ls_9001_scrn-matnr&lt;/P&gt;&lt;P&gt;      AND lgort = ls_9001_scrn-lgort&lt;/P&gt;&lt;P&gt;      AND nltyp = ls_9001_scrn-nltyp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF t_ltap[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt; SORT t_ltap DESCENDING BY lgnum nltyp nlpla tanum.&lt;/P&gt;&lt;P&gt; DELETE ADJACENT DUPLICATES FROM t_ltap COMPARING lgnum nltyp nlpla.&lt;/P&gt;&lt;P&gt; SORT t_ltap DESCENDING BY tanum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT lgpla INTO TABLE lt_lgap&lt;/P&gt;&lt;P&gt;   FROM lagp FOR ALL ENTRIES IN t_ltap&lt;/P&gt;&lt;P&gt;   WHERE blablabla&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:10:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791761#M1310050</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791762#M1310051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use into corresponding fields of table instead of into table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:22:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791762#M1310051</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791763#M1310052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope, INTO CORRESPONDING slower than INTO TABLE because it transfer the value by the name of the fields while INTO TABLE is by the sequence of the fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:25:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791763#M1310052</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791764#M1310053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ans also see the order in which you are selecting fields from LTAP it should be:- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select &lt;STRONG&gt;lgnum tanum wdatu nltyp&lt;/STRONG&gt; from ltab and so on&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:28:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791764#M1310053</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791765#M1310054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ORDER BY clause directly put a load on Database.&lt;/P&gt;&lt;P&gt;SO never use order by ever in your queries.&lt;/P&gt;&lt;P&gt;Instead always use sort itab by field names.&lt;/P&gt;&lt;P&gt;Secondly Try to minimise the where clause conditions during fetching data in a query.&lt;/P&gt;&lt;P&gt;instead delete them depending upon the conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds,&lt;/P&gt;&lt;P&gt;Anil&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:28:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791765#M1310054</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791766#M1310055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep! But I cant avoid to use sorting in database layer. Tried sort in application server as well. But the problem not during sort&lt;/P&gt;&lt;P&gt;but during access to LTAP table.&lt;/P&gt;&lt;P&gt;Yes that is the minimum where clause conditions I could use otherwise the records selection could be 3,4 times more.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:32:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791766#M1310055</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791767#M1310056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;did u try to change the order in your select query...............bcoz of it performance becomes slow keep it according to the order defined in table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:34:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791767#M1310056</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791768#M1310057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep! Tried that too, but it dont improve at all. I checked the ST05, the response is about the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 09:35:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791768#M1310057</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T09:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT from LTAP table takes much time (Sort in Database layer)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791769#M1310058</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;In your original select:-&lt;/P&gt;&lt;P&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;&lt;/P&gt;&lt;P&gt;in where clause use :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE &lt;/P&gt;&lt;P&gt;ltap~lgnum = ls_9001_scrn-lgnum&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 lagp~skzue = ' '&lt;/P&gt;&lt;P&gt; AND ltap~lgort = ls_9001_scrn-to_lgort&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;&lt;/P&gt;&lt;P&gt;since there is already an index 'M' defined in the syatem with lgnum,pquit &amp;amp; matnr as the key. If still not satisfied you may have to think about creating a secondary index via SE11 with fields appearing in your 'where' clause as the key. ( obviously in the same order i.e. lgnum,pquit,matnr,skzue,lgort,nltyp )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raju Chitale&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2009 10:13:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-ltap-table-takes-much-time-sort-in-database-layer/m-p/5791769#M1310058</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-07-03T10:13:41Z</dc:date>
    </item>
  </channel>
</rss>

