<?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: Difference between select single and select upto one row in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701376#M307467</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Logically there is no difference between them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Single and Select Up to one row behaves same. But Technically If we pass all the key fields in where clause, select single is used to improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sreedhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Nov 2006 13:32:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-21T13:32:14Z</dc:date>
    <item>
      <title>Difference between select single and select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701374#M307465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its is simple, but at the movement iam not differenciate "&amp;lt;b&amp;gt;select single and select upto one row",&amp;lt;/b&amp;gt; can any one place clarify my doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regs&lt;/P&gt;&lt;P&gt;Rams&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        ramesh bhavana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 13:28:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701374#M307465</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T13:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single and select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701375#M307466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ex code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
***********
Report Z_Difference 
Message-id 38 
Line-Size 80 
Line-Count 0 
No Standard Page Heading. 
* 
Start-Of-Selection. 
 
Data: w_Single type Posnr, 
t_Rows type standard table of Posnr initial size 0 
with header line. 
* 



select single Posnr 
from zDifference 
into w_Single. 
* 
Select Posnr 
into table t_Rows 
from zDifference 
up to 1 rows 
order by Posnr descending. 
* 
Write :/ 'Select single:', w_Single. 
Skip 1. 
Write :/ 'Up to 1 rows :'. 

Loop at t_Rows. 
Write t_Rows. 
EndLoop.

&lt;/CODE&gt;&lt;/PRE&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 13:31:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701375#M307466</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-11-21T13:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single and select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701376#M307467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Logically there is no difference between them. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Single and Select Up to one row behaves same. But Technically If we pass all the key fields in where clause, select single is used to improve the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sreedhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 13:32:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701376#M307467</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T13:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single and select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701377#M307468</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;primarily select single hits the data base only once and fetches the data at a time, &lt;/P&gt;&lt;P&gt;use select single if u have primary keys in where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a select upto one row will hit the data base twice and fetch a single record this genrally is used when you are searching for a non primary key in the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;generally these are used in validations use select single with check tables for better performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;se se30 u have a button tips and tricks that would be more informative and descriptive i guess!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 13:33:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701377#M307468</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T13:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single and select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701378#M307469</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;Basically they both return the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But one important feature of SELECT UPTO is that it can fetch upto any number of records you want by specifying in the query like &lt;/P&gt;&lt;P&gt;  SELECT * FROM t000 INTO TABLE i_t000 UP TO 10 ROWS. which is not possible in SELECT SINGLE as the result is always 1 or no records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kathirvel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 13:33:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701378#M307469</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T13:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single and select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701379#M307470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single: use when you can give all the priamary keys(so that u can get only one record) in the where condition.&lt;/P&gt;&lt;P&gt;no endselect is required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select up to one rows: use when there is a posibility that there can be many records with ur where condition.&lt;/P&gt;&lt;P&gt;need ot use endselect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Anu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 13:41:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701379#M307470</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T13:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single and select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701380#M307471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interesting results. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT SINGLE * FROM t000 INTO w_t000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;           Execution time in microseconds:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     ABAP                                                       14.727  =  51,0%&lt;/P&gt;&lt;P&gt; Database                                                           42  =   0,1%&lt;/P&gt;&lt;P&gt;   System                                                       14.111  =  48,9%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          0%                  50%                 100%          28.880  = 100,0%&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;  SELECT  * FROM t000 INTO w_t000 UP TO 1 ROWS.&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;               Execution time in microseconds:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         ABAP                                                       13.480  =  90,2%&lt;/P&gt;&lt;P&gt;     Database                                                           40  =   0,3%&lt;/P&gt;&lt;P&gt;       System                                                        1.431  =   9,6%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              0%                  50%                 100%          14.951  = 100,0%&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UP TO 1 ROWS just takes 50% time taken by SELECT SINGLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Kathirvel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2006 13:45:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701380#M307471</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T13:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between select single and select upto one row</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701381#M307472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Ramesh,&lt;/P&gt;&lt;P&gt;Check&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>Tue, 21 Nov 2006 13:47:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difference-between-select-single-and-select-upto-one-row/m-p/1701381#M307472</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-11-21T13:47:49Z</dc:date>
    </item>
  </channel>
</rss>

