Documentation View

We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!



BAL Application Log Documentation   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

SELECT, select_clause

Short Reference

... $[DISTINCT$] select_list ...




SELECT clause of a query. The SELECT clause defines the structure of the result set of the SELECT statement. It consists of a SELECT list, which defines the columns of the result set, and an optional addition DISTINCT, which removes duplicative rows from the result set.

The SELECT list select_list can indicate all columns of a data source using * or it defines the individual columns of the result set using an SQL expression. It defines the names of the columns in the result set, using optional or mandatory alias names.


The SELECT clause must either be listed as the first clause after the keyword SELECT, or after the optional addition SINGLE, or after the FROM clause. After the FROM clause, the SELECT clause must be introduced using the addition FIELDS. A FROM clause in front of the SELECT clause supports tools such as the code completion in the ABAP Editor.


SELECT clause after FIELDS, whose SELECT list specifies individual columns as well as aggregate expressions as arguments using SQL expressions.




The addition DISTINCT removes rows that occur more than once in a multirow result set. Here, the entire row content is respected.

The addition DISTINCT must not be used in the following cases:

  • If the addition SINGLE is used.
  • If a column specified in the SELECT list select_list has the type STRING, RAWSTRING, LCHR, LRAW, or GEOM_EWKB.

If DISTINCT is used, the statement SELECT bypasses table buffering.


  • For the addition DISTINCT, it is not important which columns of the result set are key fields of the associated DDIC database tables, views, or CDS entities.
  • The comparison is based on the entire row content, which means that the number of rows in the result set depends on the SELECT list. If, for example, all key fields of a DDIC database table are specified directly as columns in a SELECT list, there can be no rows that occur more than once. The other extreme is the case where a SELECT list contains a single host variable or a single literal. Here, all rows are deleted except one.
  • As a part of the SELECT clause, the addition DISTINCT has an effect before the additions UP TO and OFFSET are evaluated.
  • If DISTINCT is specified, it should be noted that this requires the execution of sort operations in the database system, and the statement SELECT therefore bypasses table buffering.


Output of all destinations to which Lufthansa flies from Frankfurt.

General Material Data   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 4686 Date: 20230207 Time: 100522     sap01-206 ( 77 ms )