<?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 Limit select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316122#M794307</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to limit the number of results of a SELECT statement like in MySQL?&lt;/P&gt;&lt;P&gt;For example &amp;#150; my select statement will result 100 records and I need only the records from 31 to 60 (I need to extract the second group of 30 records, then I will need the third group of next 30 records and so on&amp;#133;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In MySQL it would be:&lt;/P&gt;&lt;P&gt;SELECT * FROM &amp;lt;my table&amp;gt; LIMIT &amp;lt;limit_start&amp;gt;, &amp;lt;limit_end&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Roy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 03 Feb 2008 15:45:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-03T15:45:25Z</dc:date>
    <item>
      <title>Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316122#M794307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to limit the number of results of a SELECT statement like in MySQL?&lt;/P&gt;&lt;P&gt;For example &amp;#150; my select statement will result 100 records and I need only the records from 31 to 60 (I need to extract the second group of 30 records, then I will need the third group of next 30 records and so on&amp;#133;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In MySQL it would be:&lt;/P&gt;&lt;P&gt;SELECT * FROM &amp;lt;my table&amp;gt; LIMIT &amp;lt;limit_start&amp;gt;, &amp;lt;limit_end&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Roy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 15:45:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316122#M794307</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T15:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316123#M794308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Roy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; that's not possible in the select statement..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have &lt;STRONG&gt;select upto 100 rows&lt;/STRONG&gt; &amp;lt;&amp;lt; which pick &lt;STRONG&gt;first&lt;/STRONG&gt; 100 records which match your where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have package concept as well.. check the help on select..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 16:06:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316123#M794308</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2008-02-03T16:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316124#M794309</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;check this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Keywords&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/40/b54ea14933458e96c736ec03295bfa/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/40/b54ea14933458e96c736ec03295bfa/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Procedure&lt;/P&gt;&lt;P&gt;1.       When you create an SQL statement, insert square brackets in all the places you want a variable entry to be possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.       If you want to formulate a prompt for the dialog window, enter this prompt within the square brackets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to set parameters for queries for the columns Article No. and Unit Price in the Article table, you can set the following parameters among the selection criteria:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT  "Article No.", "Unit Price" FROM "Article"&lt;/P&gt;&lt;P&gt;WHERE  "Article No." &amp;gt; [article number (from)]&lt;/P&gt;&lt;P&gt;AND  "Article No." &amp;lt; [article number (to)]&lt;/P&gt;&lt;P&gt;AND  "Unit Price" &amp;lt;= [upper price limit]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By setting parameters you can also replace entire sections of an SQL statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can formulate a SELECT statement and add a WHERE condition using a parameter:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM USERS [Your WHERE condition]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you specify a comparison value for the data type CHAR, VARCHAR, DATE or TIME, you must enclose the comparison value in single quotation marks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/ee/1c5bebeba711d4aa2800a0c9430730/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/ee/1c5bebeba711d4aa2800a0c9430730/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 16:11:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316124#M794309</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T16:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316125#M794310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks K.P.N,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This does not help me since I don't have such column that I can set a condition of "&amp;gt;" or "&amp;lt;" on it.&lt;/P&gt;&lt;P&gt;The table includes only three columns that are from string type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have other suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the try,&lt;/P&gt;&lt;P&gt;Roy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 16:17:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316125#M794310</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T16:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316126#M794311</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;using sy-index or a sy-tabix is not a bad idea &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can u try that one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 16:35:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316126#M794311</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T16:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316127#M794312</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;The question is if it will give the required results based on the fact that I already have some condition in the Where clause.&lt;/P&gt;&lt;P&gt;I mean that I need to execute the limit condition on the results I get based on the Where clause&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 16:49:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316127#M794312</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-03T16:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316128#M794313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Roy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Package size in SELECT statements&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Package size can be used to retreive a spcific number of records at a time. This can be used if you for example only want tofinish processing a limited amount of data at a time due to lack of memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example below read 50 records at a time from VBAK into an internal table, and selects the corresponding entries from vbap into an internal table. Then the two internal tables can be processed, and the next 50 records from VBAk can be read. remember to reinitialize tha tables before the next read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note the usage of SELECT - ENDSELECT !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT z_test .

TYPES:
BEGIN OF t_vbak, vbeln LIKE vbak-vbeln, erdat LIKE vbak-erdat, END OF t_vbak, BEGIN OF t_vbap, posnr LIKE vbap-posnr, matnr LIKE vbap-matnr, meins LIKE vbap-meins, END OF t_vbap, BEGIN OF t_report, vbeln LIKE vbak-vbeln, erdat LIKE vbak-erdat, posnr LIKE vbap-posnr, matnr LIKE vbap-matnr, meins LIKE vbap-meins,
END OF t_report.

DATA:
li_vbak TYPE t_vbak OCCURS 0, l_vbak TYPE t_vbak, li_vbap TYPE t_vbap OCCURS 0, l_vbap TYPE t_vbap, li_report TYPE t_report OCCURS 0, l_report TYPE t_report.

START-OF-SELECTION.
SELECT vbeln erdat FROM vbak INTO TABLE li_vbak PACKAGE SIZE 50. SELECT posnr matnr meins FROM vbap INTO TABLE li_vbap FOR ALL ENTRIES IN li_vbak WHERE vbeln = li_vbak-vbeln. IF sy-subrc = 0.

    * Now you have the two internal tables li_vbak and liÆ_vbap filled with data.
    * Do something with the data &amp;#150; remember to reinitialize internal tables

ENDIF. ENDSELECT.  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Feb 2008 16:59:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316128#M794313</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2008-02-03T16:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316129#M794314</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;First Select your Data From Table into your Internal Table ITAB .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets say u get 100 record .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB WHERE sy-tabix &amp;gt; 30 and sy-tabix &amp;lt; 60 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Place code as per your reqmt here ( loop--endloop ) .&lt;/P&gt;&lt;P&gt;Yopu can populate another table here .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps .&lt;/P&gt;&lt;P&gt;Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2008 02:15:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316129#M794314</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-04T02:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316130#M794315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Praveen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried it and now I am getting the following compilation error:&lt;/P&gt;&lt;P&gt;No component exists with name "SY-TABIX".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the relevant part of my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF ITAB OCCURS 0,&lt;/P&gt;&lt;P&gt;             SPRSL LIKE TSTCT-SPRSL,&lt;/P&gt;&lt;P&gt;             TCODE LIKE TSTCT-TCODE,&lt;/P&gt;&lt;P&gt;             TTEXT LIKE TSTCT-TTEXT,&lt;/P&gt;&lt;P&gt;           END OF ITAB.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;SELECT * FROM TSTCT INTO table ITAB WHERE (where_clause) ORDER BY TCODE ASCENDING.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB WHERE sy-tabix &amp;gt; START_ENTRY and sy-tabix &amp;lt; END_ENTRY.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2008 15:32:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316130#M794315</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-05T15:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316131#M794316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB FROM START_ENTRY TO END_ENTRY.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For further information, Press F1 on LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Feb 5, 2008 10:37 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2008 15:36:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316131#M794316</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-05T15:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Limit select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316132#M794317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Roy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That was my mistake .&lt;/P&gt;&lt;P&gt;Please try like below .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB FROM &amp;lt; INDEX eg 30 &amp;gt; TO &amp;lt; INDEX eg 60 &amp;gt; .&lt;/P&gt;&lt;P&gt;&amp;lt;ur code &amp;gt;&lt;/P&gt;&lt;P&gt;ENDLOOP .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks . Praveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2008 01:42:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/limit-select-statement/m-p/3316132#M794317</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-06T01:42:50Z</dc:date>
    </item>
  </channel>
</rss>

