Difference between Select Single v/s Select Upto 1 rows

This is the question many ABAPer will always thing. What is the difference between ‘select single’ and ‘select upto 1 rows’. Are both same ? NOPE

Even though both will give the same result, the working of these 2 statements are little different.

Select single works best when all primary keys are mentioned in the where condition. Select up to 1 rows will assume all primary keys are not mentioned and will try to use the appropriate database indexes. In select upto 1 rows, the database selects all records satisfying WHERE clause and then returns the first record of the result set. Off course the result will be always same.

So , When to use select single ? When where condition is fully defined ( meaning you have all primary key’s in the where condition ) so that only one unique entry exist. In case where condition is not fully defining, you have to restore to use ‘select up to 1 rows’.