SAP CDS SELECT STATEMENT V1



Get Example source ABAP code based on a different SAP table
  


• { } ABAP_CDS_SELECT_V1
• SELECT ABAP_CDS_DEFINE_VIEW
• DISTINCT ABAP_CDS_SELECT_V1
• FROM ABAP_CDS_SELECT_V1

ABAP_CDS_DDL - DDIC-Based View, SELECT

ABAP_SYNTAX
SELECT $[DISTINCT$] ${ select_list
FROM data_source
$[association1 association2 ...$] $}
$| ${ FROM data_source
$[association1 association2 ...$]
{select_list} $}
$[clauses$]

What does it do?
The SELECT statement defines a query performed on the data sources specified in data_source for a ABAP_CDS_V1_VIEW , as part of the statement DEFINE VIEW. Possible data sources are DDIC database tables, CDS view entities, CDS table functions, CDS hierarchies,
BEGIN_SECTION VERSION 5 OUT DDIC database views,
END_SECTION VERSION 5 OUT or ABAP_CDS_V1_VIEWS .
select_list defines the components read in a list.
association1, association2, ... define CDS associations for the current SELECT statement. These CDS associations can be accessed in data_source and in select_list using path expressions.
DISTINCT removes duplicates from the results list. If DISTINCT is specified, the elements cannot have the type LCHR, LRAW, STRING , RAWSTRING, or GEOM_EWKB. ABAP_NOTE For determining duplicate rows, all columns are considered and not just key fields.
Both variants of the code are equivalent. Curly brackets { } must be used in the second variant before and after the select_list.
The optional addition clauses are SELECT clauses that enable conditions, groupings, and unions.

ABAP_EXAMPLE_VX5
The CDS view demo_cds_scarr_spfli defined here is a view that joins two database tables SCARR and SPFLI.
DDLS DEMO_CDS_SCARR_SPFLI
The CDS view can be addressed in ABAP programs using AB_SQL , for example: SELECT * FROM demo_cds_scarr_spfli INTO TABLE @itab ...
ABAP_EXAMPLE_END