‎2006 Aug 22 7:33 PM
hi everybody
what is the exact difference between select single vbeln and select vbeln
In what situations i should use these select single vbeln or select vbeln
regards
hridhayanjili.
‎2006 Aug 22 7:40 PM
hi
select single is for fetching single record from the database based on the unique keys.
select <field name> is used for selecting a particular field from a table.here your select clause may fetch multiple records but select single will fetch only one record.
i would advice you to read the OPEN SQL document under
Cheers,
Abdul Hakim
mark all useful answers..
‎2006 Aug 22 7:51 PM
"select single vbeln" will extract one and only one sales order number from the DB (based on the conditions in the WHERE clause).
"select vbeln" requires the addition of ENDSELECT and creates a 'selection loop'. This loop will select ALL sales order numbers from the DB (based on the conditions in the WHERE clause).
If you KNOW that need one and only record, SELECT SINGLE is faster of the two... it makes only one trip to the DB. The SELECT... ENDSELECT must make multiple trips to the DB... even if only 1 record exists... this method must make 2 trips to the DB to complete it's execution.
‎2006 Aug 22 8:05 PM
Hrid,
Have your questions been answered? If so, please reward points accordingly and close the thread.
If not, provide more details of your question(s).
Thanks in advance.
‎2006 Aug 22 8:08 PM
Hai
Go through the following Document
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
Regards
Sreeni