ABAP SQL - col
| [data_source|tabalias~]sql_path-element ...
Columns can be specified as elementary SQL expressions in all operand positions in which SQL expressions are possible. However, they can also occur in specific operand positions in which no SQL expressions are possible.
When a column is specified, the actual names of the components must be used for a database table containing an include structure, and not the names of any groups defined in ABAP Dictionary.
specified directly in the clauses of a
SELECT FROM scarr FIELDS carrid, carrname WHERE url = ' ' INTO TABLE @DATA(itab).
Specifies an element of a data source of a
CDS view after a path expression
sql_path. This can be specified
SELECT statements where path expressions can be used and in all places where a column can be specified (unless otherwise indicated).
element closes the path expression (compiled from
CDS associations or
CTE associations) for
which the structure component selector
- is used. This element must be an element of the target data source of the final association in the path.
- Path expressions can be used in the following
- Statements that use the CDS entity to access a CDS view in which the used associations are published for use from outside.
- Statements in a
WITHstatement that follow common table expressions that themselves publish associations using the addition
- If an element is specified after the path expression, this represents a column specified of the join created implicitly for the path expression. Left outer joins
LEFT OUTER JOIN) are created for path expressions in specified columns.
source~can be used to prefix the path expression with the unit from which its first association is published.
- When a column is specified using a path expression, the syntax check is performed in a strict mode, which handles the statement more strictly than the regular syntax check.
SELECT statement accesses the
CDS view demo_cds_assoc_scarr that
publishes a CDS association
_spfli. As its target data source, this CDS association uses a view that publishes the CDS associations
_sflight and _sairport. The columns specified
SELECT statement cover any path expressions created by these CDS associations. See also the associated executable example.
SELECT carrname, \_spfli-connid AS connid, \_spfli\_sairport-name AS name FROM demo_cds_assoc_scarr WHERE carrid = '...' and \_spfli\_sflight-fldate > '20190515' INTO TABLE @DATA(itab).
The column selector
~ can be used to prefix every specified column directly with the name of
the associated data source of a query or of the target of a write (as
data_source or as an alias name
The data source must be specified in the following cases:
- If multiple data sources in an ABAP SQL statement need to be edited and the column name is not unique.
Using the name
scarr of a data source and the alias name
of a different data source in front of the column selector
~ of specified columns.
SELECT FROM scarr INNER JOIN spfli AS connections ON scarr~carrid = connections~carrid FIELDS scarr~carrname, connections~connid WHERE connections~cityfrom = '...' INTO TABLE @DATA(itab).