<?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: reports in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reports/m-p/3496282#M840919</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;A lot of people use the SELECT SINGLE statement to check for the existence of a value in a database. Other people prefer to use the 'UP TO 1 ROWS' variant of the SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what's the difference between using 'SELECT SINGLE' statement as against a 'SELECT .... UP TO 1 ROWS' statement ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're considering the statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE field INTO w_field FROM table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT field INTO w_field FROM table UP TO 1 ROWS. ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then looking at the result, not much apart from the extra ENDSELECT statement. Look at the run time and memory usage and they may be worlds apart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is this ?? The answer is simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get the difference ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, here is a good example, credit for this example goes to Richard Harper, a friend of mine on sapfans.com :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a Ztable called ZDifference with 2 fields in it, MANDT of type MANDT and POSNR of type POSNR. Make sure both of these are keys. Also create a table maintenance dialog for it (SE11-&amp;gt;Utilities-&amp;gt;Table Maintenance Generator). Fill the table with ten rows 000001-000010.&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;IFF&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Mar 2008 09:17:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-10T09:17:05Z</dc:date>
    <item>
      <title>reports</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reports/m-p/3496280#M840917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is the main difference b/w select single and select up to 1 row&lt;/P&gt;&lt;P&gt;plz ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Mar 2008 10:16:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reports/m-p/3496280#M840917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-09T10:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: reports</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reports/m-p/3496281#M840918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.&lt;/P&gt;&lt;P&gt;Mainly: to read data from&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Mar 2008 10:19:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reports/m-p/3496281#M840918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-09T10:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: reports</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reports/m-p/3496282#M840919</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;A lot of people use the SELECT SINGLE statement to check for the existence of a value in a database. Other people prefer to use the 'UP TO 1 ROWS' variant of the SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what's the difference between using 'SELECT SINGLE' statement as against a 'SELECT .... UP TO 1 ROWS' statement ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you're considering the statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE field INTO w_field FROM table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT field INTO w_field FROM table UP TO 1 ROWS. ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then looking at the result, not much apart from the extra ENDSELECT statement. Look at the run time and memory usage and they may be worlds apart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why is this ?? The answer is simple.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get the difference ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, here is a good example, credit for this example goes to Richard Harper, a friend of mine on sapfans.com :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a Ztable called ZDifference with 2 fields in it, MANDT of type MANDT and POSNR of type POSNR. Make sure both of these are keys. Also create a table maintenance dialog for it (SE11-&amp;gt;Utilities-&amp;gt;Table Maintenance Generator). Fill the table with ten rows 000001-000010.&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;IFF&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Mar 2008 09:17:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reports/m-p/3496282#M840919</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-10T09:17:05Z</dc:date>
    </item>
  </channel>
</rss>

