05-17-2007 6:16 AM
what is exact difference b\w select single * and select ...............up to 1 row?
what is the difference b\w 'dat' file and 'asc' file?plz reply me soon
05-17-2007 6:19 AM
hi,
chk this.
ex code
***********
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.
*******************************************
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.
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.
The best way to find out is through sql trace or runtime analysis.
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.
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.
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.
Mainly: to read data from
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.
Mainly: to check if entries exist.
You can refer to the below link..
http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm
rgds
Reshma
05-17-2007 6:19 AM
We must use primary keys in select single ... whereas in select upto.. it not recommanded.
Select single should be use in loop endloop..
Regards,
Parvez
05-17-2007 6:23 AM
Hi Usha,
Any where in ABAP. If u r providing full primary key then go for SELECT SINGLE.
ofherwise UP TO 1 ROWS best as performence wise,
rgds
Deepak
05-17-2007 6:27 AM
hi usha,
what is exact difference b\w select single * and select ...............up to 1 row?
what is the difference b\w 'dat' file and 'asc' file?plz reply me soon
1. select single will fetch all records from database table and will display the required record for us based on the condition given.
ii. select single doesnt need end select keyword
2. select upto fetches only required records from databse and display for us.
ii. select up to needs endselect statement.
dat format: can be useful for only text file formats
asc: used for ascii file formats
if helpful reward some points.
with regards,
suresh babu aluri.
05-17-2007 6:43 AM
Hai,
<b>Difference Between Select Single and Select UpTo One Rows</b>
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.
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.
The best way to find out is through sql trace or runtime analysis.
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.
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.
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.
Mainly: to read data from
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.
<b>Difference Between DAT file & ASC file</b>
'ASC' :
ASCII format. The table is transferred as text. The conversion exits are
carried out. The output format additionally depends on the parameters
CODEPAGE, TRUNC_TRAILING_BLANKS, and TRUNC_TRAILING_BLANKS_EOL.
'DAT' :
Column-by-column transfer. With this format, the data is transferred as
with ASC text. However, no conversion exists are carried out and the
columns are separated by tab characters. This format creates files that
can be uploaded again with gui_upload or ws_upload.
Regards,
Padmam.
05-17-2007 7:01 AM
hi,
if there exists at least one row of a database
table or view with a certain condition, use the Select ... Up To 1
Rows statement instead of a Select-Endselect-loop with an Exit.
If all primary key fields are supplied in the Where condition you
can even use Select Single.
Select Single requires one communication with the database system,
whereas Select-Endselect needs two.
Regards
Gaurav
05-17-2007 7:37 AM
Select single will hit the database only once where as select upto one row can hit the database more than once.
in selkect single we have to specify the primary key where as in the select upto one row there is no need for specifying primary key
05-17-2007 9:11 AM
HI,
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.
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.
The best way to find out is through sql trace or runtime analysis.
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.
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.
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.
Mainly: to read data from
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.
Hope this helps.
Reward if helpful.
Regards,
Sipra
05-17-2007 9:37 AM
Hi,
Difference Between Select Single and Select UpTo One Rows
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.
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.
The best way to find out is through sql trace or runtime analysis.
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.
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.
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.
Mainly: to read data from
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.
Mainly: to check if entries exist.
Reward All Helpfull Answers......