<?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: SQL processing in ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113561#M983486</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Avraham,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are right SELECT ... ENDSELECT defines a loop. But the system will fetch the data in blocks of (I believe) 32k size. That means with small tables and few fields SELECT ... ENDSELECT can be preferred over SELECT ... INTO TABLE because no further loop and less memory is needed and the whole content will be fetched with one database access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 29 Jun 2008 14:55:28 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2008-06-29T14:55:28Z</dc:date>
    <item>
      <title>SQL processing in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113559#M983484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm learning ABAP from the book &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Introduction to ABAP/4 Programming for SAP&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;by Gareth M. de Bruyn and Robert W. Lyfareff&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and read now that SQL SELECTs run like loops. I worked with SQL before and didn't have that idea in mind, I wonder if this is something peculiar to ABAP or indeed, in common RDBMS, such as Oracle, it always works like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The book says that the &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;	SELECT * FROM tab [WHERE condition].	
	...	
	ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;functions like a loop - I always thought that the whole result was buffered at once (or at least the first ***** rows for immediate use). Looping for me is a functionality related to Cursors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Excerpt from the book:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SELECT is a looping command, as you can see by the presence of the ENDSELECT command. When a SELECT is issued against a table, it returns all rows of data contained in that table, one at a time. So the first row returned is available for processing during the first pass of the loop. The second row is available during the second pass of the loop, and so on, until all rows have been read from the table.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please leave your comments.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Avraham Kahana on Jun 29, 2008 10:14 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jun 2008 07:12:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113559#M983484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-29T07:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: SQL processing in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113560#M983485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi avraham,&lt;/P&gt;&lt;P&gt;           Yes the statement works like a loop statement.&lt;/P&gt;&lt;P&gt;SELECT * FROM DATABASE TABLE INTO WORK AREA.&lt;/P&gt;&lt;P&gt;   append WORKAREA TO INTERNAL TABLE.&lt;/P&gt;&lt;P&gt; ENDSELECT.&lt;/P&gt;&lt;P&gt;*PROCESSING LOGIC CAN BE WRITTEN INSIDETHE LOOP.&lt;/P&gt;&lt;P&gt;Now i always try to avoid using this statement and instead i use this statement for mass transfer of data to internal table&lt;/P&gt;&lt;P&gt; SELECT * FROM DATABASE TABLE INTO CORRESPONDING FIELDS OF  TABLE (INTERNAL TABLE NAME)&lt;/P&gt;&lt;P&gt;WHERE CONDITION.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;THIS IS BETTER WHEN YOU LOOK IN TERMS OF PERFORMACE WISE.&lt;/P&gt;&lt;P&gt;   regards,&lt;/P&gt;&lt;P&gt;          Varghese&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: varghese oommen on Jun 29, 2008 4:31 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jun 2008 11:00:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113560#M983485</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-29T11:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: SQL processing in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113561#M983486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Avraham,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you are right SELECT ... ENDSELECT defines a loop. But the system will fetch the data in blocks of (I believe) 32k size. That means with small tables and few fields SELECT ... ENDSELECT can be preferred over SELECT ... INTO TABLE because no further loop and less memory is needed and the whole content will be fetched with one database access.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jun 2008 14:55:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113561#M983486</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2008-06-29T14:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: SQL processing in ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113562#M983487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Avraham,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;STRONG&gt;Select-Endselect&lt;/STRONG&gt; just behaves like a looping statement, which fetches the data from database table record by record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But, from the point of performance, this is not a good way to select data from the database table using &lt;STRONG&gt;Select-Endselect&lt;/STRONG&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of going for &lt;STRONG&gt;Select-Endselect&lt;/STRONG&gt;  and writing the data within the loop, we select data from database into an internal table and then write the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code snippet goes as follows and  it is better in performance also:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select * 
  from &amp;lt;dbtab&amp;gt;
  into table itab
 where &amp;lt;condition&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then we go for the display of  the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;Any queries, get back to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandra Sekhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jun 2008 16:15:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-processing-in-abap/m-p/4113562#M983487</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-29T16:15:33Z</dc:date>
    </item>
  </channel>
</rss>

