<?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 statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610196#M598703</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;both of them will do the same functionality but select single is better in performance wise to select a single record.&lt;/P&gt;&lt;P&gt;select *...up to 1 rows need endselect whereas select single will not have endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Aug 2007 05:42:08 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-07T05:42:08Z</dc:date>
    <item>
      <title>select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610193#M598700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please tell me the difference between  "Select single* and Select up to 1 row".&lt;/P&gt;&lt;P&gt;Which one gives better performance?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;P&gt;Sailu.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 05:22:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610193#M598700</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T05:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610194#M598701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Difference Between Select Single and Select UpTo One Rows &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;&lt;/P&gt;&lt;P&gt;select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best way to find out is through sql trace or runtime analysis. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS. &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;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;P&gt;&lt;/P&gt;&lt;P&gt;Mainly: to check if entries exist. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points for useful Answers&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 05:23:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610194#M598701</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T05:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610195#M598702</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 real time, &lt;/P&gt;&lt;P&gt;we use select single---- when we are retrieving a field/fields from a table which is/are primary key..&lt;/P&gt;&lt;P&gt;Eg; select single matnr werks from MARC ...........&lt;/P&gt;&lt;P&gt;In above bott MATNR and WERKS are primary Key.. so we are using select single..&lt;/P&gt;&lt;P&gt;Here usng select single gives better performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We use select upto 1 rows when the field/fields retrieving from a table are part of primary key.&lt;/P&gt;&lt;P&gt;Eg: select werks from marc upto 1 rows..... end select.&lt;/P&gt;&lt;P&gt;In above both MATNR and WERKs are primary key but we are retrieving only werks so we use Select upto one rows..&lt;/P&gt;&lt;P&gt;Here usng select upto 1 rows gives better performance..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Performance depends on the type we retrieve.Both statements gives better performance according to their usage&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rewards if useful,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;nazeer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 05:34:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610195#M598702</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T05:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610196#M598703</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;both of them will do the same functionality but select single is better in performance wise to select a single record.&lt;/P&gt;&lt;P&gt;select *...up to 1 rows need endselect whereas select single will not have endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 05:42:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610196#M598703</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T05:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610197#M598704</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 prior to running a large report. Select singles are also used to look up values from a database where that value is going to be constant for the duration of the program run, or the value is being used to validate some user entry. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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;Code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE field &lt;/P&gt;&lt;P&gt;  INTO w_field &lt;/P&gt;&lt;P&gt;  FROM table. &lt;/P&gt;&lt;P&gt;and &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT field &lt;/P&gt;&lt;P&gt;  INTO w_field &lt;/P&gt;&lt;P&gt;  FROM table &lt;/P&gt;&lt;P&gt;UP TO 1 ROWS. &lt;/P&gt;&lt;P&gt;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 memeory 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 or lack of, applies any aggregate, ordering or grouping functions to them and then returns the first record of the resultant 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, then 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;Util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;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Program:       Z_Difference &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Purpose:       A program that demonstrates the difference &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     between SELECT SINGLE and SELECT UP TO n ROWS. &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     This program requires the data table Z_DIFFERENCE &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     to have been created according to the structure &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     outlined in the text above and populated with &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;                     at least 10 records. &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Creation Date: 21/04/2004 &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Requested By: &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Reference Doc: &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Author:        R Harper &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      Modification History: &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Date    Reason                             Transport     Who &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&l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UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Report Z_Difference &lt;/P&gt;&lt;P&gt;       Message-id 38 &lt;/P&gt;&lt;P&gt;       Line-Size  80 &lt;/P&gt;&lt;P&gt;       Line-Count 0 &lt;/P&gt;&lt;P&gt;       No Standard Page Heading. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Start-Of-Selection. &lt;/P&gt;&lt;P&gt;  Data: w_Single type Posnr, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        t_Rows   type standard table of Posnr &lt;/P&gt;&lt;P&gt;                 initial size 0 &lt;/P&gt;&lt;P&gt;                 with header line. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  Select single Posnr &lt;/P&gt;&lt;P&gt;    from zDifference &lt;/P&gt;&lt;P&gt;    into w_Single. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  Select Posnr &lt;/P&gt;&lt;P&gt;    into table t_Rows &lt;/P&gt;&lt;P&gt;    from zDifference &lt;/P&gt;&lt;P&gt;   up to 1 rows &lt;/P&gt;&lt;P&gt;   order by Posnr descending. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   Write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'Select single:', w_Single. &lt;/P&gt;&lt;P&gt;   Skip 1. &lt;/P&gt;&lt;P&gt;   Write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'Up to 1 rows :'. &lt;/P&gt;&lt;P&gt;   Loop at t_Rows. &lt;/P&gt;&lt;P&gt;        Write t_Rows. &lt;/P&gt;&lt;P&gt;   EndLoop.&lt;/P&gt;&lt;P&gt;You should see the output: &lt;/P&gt;&lt;P&gt;Code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select single: 000001 &lt;/P&gt;&lt;P&gt;Up to 1 rows : 000010 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first 'SELECT' statement has selected the first record in the database according to any selection criteria in the 'WHERE' clause. This is what a 'SELECT SINGLE' does. The second 'SELECT' has asked the database to reverse the order of the records before returning the first row of the result. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to be able to do this the database has read the entire table, sort it and then return the first record. If there was no ORDER BY clause then the results would have been identical (ie both '000001') but the second select if given a big enough table to look at would be far slower. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now. This causes a problem in the Extended Program Check in that if the full key is not specified in a 'SELECT SINGLE' you get a message like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quote: &lt;/P&gt;&lt;P&gt;Program: Z_DIFFERENCE Line : 39 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax check warning &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This warning is only displayed in SLIN. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select single Posnr &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;^ &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Messages: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In "SELECT SINGLE ...", the WHERE condition for the key field "POSNR" does not test for equality. Therefore, the single record you are searching for may not be unique. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you haven't specified a full key and your QA person is complaining that your Extended Check has warnings tell him &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Yes. I can get rid of the warning but the program will run slower and consume more memory." &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could always tell him to "Get Lost" but it's always better to have a valid reason before you do that! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward all helpfull answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2007 05:42:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2610197#M598704</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-07T05:42:41Z</dc:date>
    </item>
  </channel>
</rss>

