ABAP - Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  Open SQL →  Open SQL - Reads →  SELECT clauses → 

SELECT - FIELDS

Syntax

... FIELDS select_clause ...

Effect

The addition FIELDS must prefix the SELECT clause select_clause of a query, if this clause is listed after the FROM clause. If the SELECT clause select_clause is listed in front of the FROM clause, then FIELDS cannot be specified.

Example

Two SELECT statements with identical values and different arrangements of the SELECT and FROM clauses.

SELECT FROM scarr
       FIELDS carrid, carrname
       ORDER BY carrid
       INTO TABLE @DATA(result1).

SELECT carrid, carrname
       FROM scarr
       ORDER BY carrid
       INTO TABLE @DATA(result2).

ASSERT result1 = result2.