<?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...endselect statement. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457189#M551042</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hai,&lt;/P&gt;&lt;P&gt;select..endselect acts as a loop to retrieve data from database table.&lt;/P&gt;&lt;P&gt;try this example.&lt;/P&gt;&lt;P&gt;this will retrieve and display rows from kna1 database table.&lt;/P&gt;&lt;P&gt;data:begin of a1 occurs 10,&lt;/P&gt;&lt;P&gt;a(10) type c,&lt;/P&gt;&lt;P&gt;b(10) type c,&lt;/P&gt;&lt;P&gt;end of a1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from kna1 into kna1 up to 10 rows.&lt;/P&gt;&lt;P&gt;write : at / kna1-kunnr, 20 kna1-name1.&lt;/P&gt;&lt;P&gt;end select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at a1;&lt;/P&gt;&lt;P&gt;write: at / a1-a, 20 a1-b.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jul 2007 10:31:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-09T10:31:37Z</dc:date>
    <item>
      <title>select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457178#M551031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi can anybody tell me when we use select..endselect statement. is it good using this statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 05:23:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457178#M551031</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T05:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457179#M551032</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 select .. endselect works as a loop fetching single record for every loop pause..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as you kept a select inside a loop .. you have 2 loops.. going to the database unnecessarily so many times is not a good idea...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead you can write &lt;/P&gt;&lt;P&gt;select * from ztable3 for all entries in itab1 where field4 = itab1-field4.&lt;/P&gt;&lt;P&gt;then ...&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;read table ztable3 with key field4 = itab1-field4.&lt;/P&gt;&lt;P&gt;..move your fields...&lt;/P&gt;&lt;P&gt;append itab2.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do not use select endselect and it affects the performance issue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Priyanka.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 05:34:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457179#M551032</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T05:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457180#M551033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;If the result of the selection is meant to be a table, the data is usually (for further information, see INTO -Klausel ) read line by line within a processing loop introduced by SELECT and concluded by ENDSELECT . For each line read, the processing passes through the loop once. If the result of the selection is meant to be a single record, the closing ENDSELECT is omitted. &lt;/P&gt;&lt;P&gt;SELECT is not concluded by ENDSELECT &lt;/P&gt;&lt;P&gt;if it is a SELECT SINGLE command, &lt;/P&gt;&lt;P&gt;if only aggregate functions appear in the INTO clause or &lt;/P&gt;&lt;P&gt;if the INTO clause INTO TABLE itab or APPENDING TABLE itab does not include the addition PACKAGE SIZE . &lt;/P&gt;&lt;P&gt;don't use select /endselect instead use table incase of multiple records .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2007 07:51:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457180#M551033</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T07:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457181#M551034</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;Select ... endselect is not advisible to use in ABAP program. It will affect ur system performance. Instead use into table internal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr .... from mara into table itab where matnr = p_matnr....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward me if its useful.&lt;/P&gt;&lt;P&gt;&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, 25 Jun 2007 14:36:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457181#M551034</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-25T14:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457182#M551035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the best way to use this statement is when you are using only one access and process of the table. All action is inside the statement. &lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;Select * from table&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;all you need must be inside this statement and not accessing it again.&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;Endselect&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2007 04:25:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457182#M551035</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-27T04:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457183#M551036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;YOU USE SELECT ENDSELECT WHEN YOU WANT TO LOOP THE RECORDS OF A TABLE&lt;/P&gt;&lt;P&gt;BUT YOU ALLREADY LOOP IT EXTERNALLY SO LOOPING A TABLE 2 TIMES IS NOT A GOOD THING IT WILL EFEECT YOUR SYSTEM PERFOMANCE &lt;/P&gt;&lt;P&gt;SO IT'S BETEER TO AVOID IT.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2007 04:52:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457183#M551036</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-27T04:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457184#M551037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I disagree. It all depends on what you want to do. I find the SELECT ... ENDSELECT statement very useful for some purposes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So let's say we have to check for some criterium to determine if a possible problem is a real problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: l_client TYPE syst-mandt.
...
IF some-test-that-is-true.
  SELECT mandt
         INTO l_client
         FROM t001
         WHERE bukrs =  l_mydata-bukrs AND
               waers &amp;lt;&amp;gt; l_mydata-waers
    l_error = 'X'.
  ENDSELECT.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This as opposed to selecting into a variable and then checking if something was found. Unfortunately the SELECT statement has no addition similar to TRANSPORTING NO FIELDS for READ TABLE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2007 09:12:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457184#M551037</guid>
      <dc:creator>KjetilKilhavn</dc:creator>
      <dc:date>2007-06-27T09:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457185#M551038</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;Select ... endselect is not recommended if data is huge. u can use this will very small tabls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jogdand M B&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2007 12:22:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457185#M551038</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-28T12:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457186#M551039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Select Endselect statement are mostly used when any arithmetical calculations are performed.(ie...select sum, select max etc...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of applying this in normal data fetch we can use select single which gives better performance when compared to select endselect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2007 04:37:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457186#M551039</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2007-07-06T04:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457187#M551040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;The ENDSELECT statement closes a loop started with SELECT.&lt;/P&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A SELECT command for which the &lt;B&gt;&lt;/B&gt;INTO|APPENDING &lt;A href="CORRESPONDING FIELDS OF"&gt;&lt;/A&gt; TABLE&amp;lt;/b&amp;gt; itab is inserted into an internal table, must be followed by ENDSELECT if the addition PACKAGE SIZE is used. &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For all other SELECT commands, ENDSELECT must be used unless a single line above the addition SINGLE is read after SELECT and unless the columns of the result set are statically specified and contain only aggregate functions without the specification of the addition GROUP BY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Syntax 
SELECT result 
       FROM source 
       INTO|APPENDING target 
       [[FOR ALL ENTRIES IN itab] WHERE sql_cond] 
       [GROUP BY group] [HAVING group_cond] 
       [ORDER BY sort_key]. 
  ... 
[ENDSELECT].&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Effect&lt;/P&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT is an Open-SQL-statement for reading data from one or several database tables into data objects. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The select statement reads a result set (whose structure is determined in result) from the database tables specified in source, and assigns the data from the result set to the data objects specified in target. You can restrict the result set using the WHERE addition. The addition GROUP BY compresses several database rows into a single row of the result set. The addition HAVING restricts the compressed rows. The addition ORDER BY sorts the result set. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The data objects specified in target must match the result set result. This means that the result set is either assigned to the data objects in one step, or by row, or by packets of rows. In the second and third case, the SELECT statement opens a loop, which which must be closed using ENDSELECT. For every loop pass, the SELECT-statement assigns a row or a packet of rows to the data objects specified in target. If the last row was assigned or if the result set is empty, then SELECT branches to ENDSELECT . A database cursor is opened implicitly to process a SELECT-loop, and is closed again when the loop is ended. You can end the loop using the statements from section leave loops. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Up to the INTO resp. APPENDING addition, the entries in the SELECTstatement define which data should be read by the database in which form. This requirement is translated in the database interface for the database system´s programming interface and is then passed to the database system. The data are read in packets by the database and are transported to the current application server by the database server. On the application server, the data are transferred to the ABAP program´s data objects in accordance with the data specified in the INTO and APPENDING additions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward  points if it is usefull ...&lt;/P&gt;&lt;P&gt;Girish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2007 06:03:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457187#M551040</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-06T06:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457188#M551041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran Reddy,&lt;/P&gt;&lt;P&gt;I Think Girish Kumar Answer is suitable for your query........&lt;/P&gt;&lt;P&gt;Don't confuse with multipple answers just understand the currect answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;My Advice is to avoid the Select...Endselect it will decrease the performance.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;Go thru the following link for more info on where we use select..endselect statement&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm" target="test_blank"&gt;http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it is useful allocate points &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;&amp;lt;b&amp;gt;Naveen Mutyapu&amp;lt;/b&amp;gt;&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jul 2007 09:24:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457188#M551041</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-06T09:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: select...endselect statement.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457189#M551042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hai,&lt;/P&gt;&lt;P&gt;select..endselect acts as a loop to retrieve data from database table.&lt;/P&gt;&lt;P&gt;try this example.&lt;/P&gt;&lt;P&gt;this will retrieve and display rows from kna1 database table.&lt;/P&gt;&lt;P&gt;data:begin of a1 occurs 10,&lt;/P&gt;&lt;P&gt;a(10) type c,&lt;/P&gt;&lt;P&gt;b(10) type c,&lt;/P&gt;&lt;P&gt;end of a1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from kna1 into kna1 up to 10 rows.&lt;/P&gt;&lt;P&gt;write : at / kna1-kunnr, 20 kna1-name1.&lt;/P&gt;&lt;P&gt;end select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at a1;&lt;/P&gt;&lt;P&gt;write: at / a1-a, 20 a1-b.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2007 10:31:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-endselect-statement/m-p/2457189#M551042</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-09T10:31:37Z</dc:date>
    </item>
  </channel>
</rss>

