Skip to content

ABAP Keyword Documentation →  ABAP Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Views →  ABAP CDS - DDL Statements →  ABAP CDS - DEFINE VIEW →  ABAP CDS - SELECT 

ABAP CDS - SELECT, select_list

Other versions: 7.31 | 7.40 | 7.54

Syntax


... { element1 ,
element2, ... } 
  |   * ...

Effect

Defines the elements of a CDS view in ABAP CDS. The elements can be specified as follows:

  • In a comma-separated list, elements can be defined by specifying element1, element2 (...and so on).
  • * can be used to define all fields and associations of the data source of the CDS view as elements. If a different CDS view is the data source, the associations of the SELECT list of the view are currently not made into elements of the current CDS view. The asterisk * cannot be specified if the current CDS view contains joins or union sets when the data source is specified.

The names of the elements of a CDS view are either

  • the predefined names of the elements,
  • alternative element names specified using AS, or

These names are also the names of the view fields of the CDS database view and the corresponding rules that must be kept.


Example

The following CDS view sales_order is a view of database table snwd_so. Three elements - so_id, currency_code and gross_amount - are defined for this view.

@AbapCatalog.sqlViewName: 'SALES_ORDER_VW'
define view sales_order as
  select from snwd_so
    { key so_id,
          @Semantics.currencyCode currency_code,
          @Semantics.amount.currencyCode: 'currency_code' gross_amount }


Example

The following CDS view sales_order is a view of all the fields of database snwd_so. Accessing the CDS view has the same effect as when the database itself is accessed.

@AbapCatalog.sqlViewName: 'SALES_ORDER_VW'
define view sales_order as
  select from snwd_so
         { * }

Continue

ABAP CDS - SELECT, element