Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

what is exact difference b\w select single * and select ...............up

Former Member
0 Kudos

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

9 REPLIES 9

Former Member
0 Kudos

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

former_member2382
Active Participant
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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......