<?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 Single in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555032#M251471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi suresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single and select upto 1 rows are having their roles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u r retrieving the data using primary key then go for select single and give the entire primary key information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If u r retrieving the data without primary key then go for select upto 1 rows will be a better option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For select single u dont have to use endselect,but for upto 1 rows u should use endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single matnr from mara into v_mara&lt;/P&gt;&lt;P&gt;where = ;;;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr from mara into v_mara&lt;/P&gt;&lt;P&gt;upto 1 rows where =;;;&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Oct 2006 14:41:35 GMT</pubDate>
    <dc:creator>former_member404244</dc:creator>
    <dc:date>2006-10-11T14:41:35Z</dc:date>
    <item>
      <title>Select Single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555026#M251465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gyes,&lt;/P&gt;&lt;P&gt;  What is the difference between &amp;lt;b&amp;gt;Select Single&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;Select Upto 1 Row&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2006 13:23:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555026#M251465</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-11T13:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Select Single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555027#M251466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Suresh,&lt;/P&gt;&lt;P&gt;difference between select single and select up to 1 row&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1788182"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2006 13:25:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555027#M251466</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-11T13:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Select Single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555028#M251467</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;We are using select single if u have all primary keys. then it is very for good for performance. Otherwise we willuse select upto one row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2006 13:26:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555028#M251467</guid>
      <dc:creator>vadrevu_kk</dc:creator>
      <dc:date>2006-10-11T13:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Select Single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555029#M251468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;delete&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2006 13:28:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555029#M251468</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-11T13:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Select Single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555030#M251469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   select single aand select upto 1 rows return 1 rows&lt;/P&gt;&lt;P&gt;   but select  single is used when we have all keys&lt;/P&gt;&lt;P&gt;   in where clause &lt;/P&gt;&lt;P&gt;    select matnr from marc where matnr = p_matnr&lt;/P&gt;&lt;P&gt;                           and    werks = p_werks.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    else&lt;/P&gt;&lt;P&gt;   select upto 1 row is used if we dont have all keys&lt;/P&gt;&lt;P&gt;   in where clause&lt;/P&gt;&lt;P&gt;    select matnr from marc upto 1 rows where matnr =&lt;/P&gt;&lt;P&gt;    p_matnr&lt;/P&gt;&lt;P&gt;    endselect.&lt;/P&gt;&lt;P&gt;                           &lt;/P&gt;&lt;P&gt;   performance wise select  single is optimum.&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;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2006 13:58:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555030#M251469</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-11T13:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select Single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555031#M251470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi suresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex code&lt;/P&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;Start-Of-Selection. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Data: w_Single type Posnr, &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;&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;&lt;/P&gt;&lt;P&gt;*******************************************&lt;/P&gt;&lt;P&gt;&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 &lt;/P&gt;&lt;P&gt;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, &lt;/P&gt;&lt;P&gt;it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key &lt;/P&gt;&lt;P&gt;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) &lt;/P&gt;&lt;P&gt;you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;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 &lt;/P&gt;&lt;P&gt;are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns &lt;/P&gt;&lt;P&gt;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;&lt;/P&gt;&lt;P&gt;You can refer to the below link..&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm" target="test_blank"&gt;http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls mark points if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2006 14:05:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555031#M251470</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-10-11T14:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select Single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555032#M251471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi suresh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single and select upto 1 rows are having their roles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u r retrieving the data using primary key then go for select single and give the entire primary key information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If u r retrieving the data without primary key then go for select upto 1 rows will be a better option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For select single u dont have to use endselect,but for upto 1 rows u should use endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single matnr from mara into v_mara&lt;/P&gt;&lt;P&gt;where = ;;;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr from mara into v_mara&lt;/P&gt;&lt;P&gt;upto 1 rows where =;;;&lt;/P&gt;&lt;P&gt;endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Oct 2006 14:41:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/1555032#M251471</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2006-10-11T14:41:35Z</dc:date>
    </item>
  </channel>
</rss>

