Ansicht
Dokumentation

ABAPSELECT_SHORTREF - SELECT SHORTREF

ABAPSELECT_SHORTREF - SELECT SHORTREF

rdisp/max_wprun_time - Maximum work process run time   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

SELECT

Reference



Syntax

SELECT { { SINGLE [FOR UPDATE] }
       | { [DISTINCT] { }      } }
       { *
       | { {col1|aggregate( [DISTINCT] col1 )} [AS a1]
           {col2|aggregate( [DISTINCT] col2 )} [AS a2]  ... }
       | (column_syntax) }
       FROM { { {dbtab [AS tabalias]}
              | { [(] {dbtab_left [AS tabalias_left]} | join
                      {[INNER] JOIN}|{LEFT [OUTER] JOIN}
                      {dbtab_right [AS tabalias_right] ON join_cond} [)]}
              | (dbtab_syntax) [AS tabalias] }
              [UP TO n ROWS]
              [CLIENT SPECIFIED]
              [BYPASSING BUFFER]
              [CONNECTION {con|(con_syntax)}] }
       { { INTO {[CORRESPONDING FIELDS OF] wa}|(dobj1, dobj2, ...) }
       | { INTO|APPENDING [CORRESPONDING FIELDS OF] TABLE itab
                          [PACKAGE SIZE n] } }
       [ CREATING {  READER|LOCATOR FOR { COLUMNS col1 col2 ... }
                                 | { ALL [OTHER] [BLOB|CLOB] COLUMNS }
                    [READER|LOCATOR FOR ...] }
                | {  (crea_syntax) } ]
       [[FOR ALL ENTRIES IN itab] WHERE sql_cond]
       [GROUP BY {col1 col2 ...}|(column_syntax)]
       [HAVING sql_cond]
       [ORDER BY { {PRIMARY KEY}
                 |{{{col1|a1} [ASCENDING|DESCENDING]}
                   {{col2|a2} [ASCENDING|DESCENDING]}
                   ... }
                 | (column_syntax) }].
  ...
[ENDSELECT.].


Effect

statement. This statement reads data from one or more data sources into data objects. If the result set is not assigned in one step, a loop is opened which is closed using ENDSELECT. This loop provides the results in the target fields.

Additions

Specifying the Rows

  • SINGLE - Defines a single row result set. The result set is multirow by default.

Structure of the result set

  • DISTINCT - Removes duplicate rows from the result set.
  • * - Reads all columns of all data sources.
  • data_source~* - Reads all columns of the specified data source.
  • sql_exp $[AS alias$] - Reads the result of an SQL expression and assigns an alias name alias (optional).

Specifying the Database Tables

  • FROM data_source $[AS tabalias$]
    Specifies a data source data_source. Possible data sources are DDIC database tables, common table expressions, table functions, DDIC views, and non-abstract CDS entities of ABAP Dictionary. Parameters can be passed to CDS entities. Path specifications are possible after common table expressions and CDS views. An internal table can also be specified as a data source.
  • (source_syntax)
    Specifies the data sources as the content of source_syntax.
  • AS tabalias
    Defines an alias name tabalias for the data source.

Specifying a Condition

  • WHERE sql_cond
    Restricts the result set using the condition sql_cond. The condition can consist of different relational expressions.

Specifying a Grouping

  • HAVING sql_cond
    Restricts rows combined in groups in the result set using a condition sql_cond.

Specifying a Set Operator

Specifying a Sort

Specifying the Target Area

  • INTO$|APPENDING TABLE itab $[PACKAGE SIZE n$]
    Specifies an internal table itab as the target area. The result set is read into or attached to the table as a whole or in packages. With the addition NEW, a reference variable is used and an anonymous data object is created.

Specifying Additions

  • OFFSET o
    Reads the rows from the offset o.





General Data in Customer Master   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 14982 Date: 20240416 Time: 202321     sap01-206 ( 130 ms )