Ansicht
Dokumentation
ABENCDS_F1_SELECT_STATEMENT - CDS F1 SELECT STATEMENT
Fill RESBD Structure from EBP Component Structure SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3upThis documentation is copyright by SAP AG.
- SELECT
SELECT $[DISTINCT$] ${ select_list
FROM data_source
$[
association1 association2 ...$]
$[composition1 composition2 ...$]
$[to_parent_assoc$] $}
$| ${ FROM data_source
$[association1 association2 ...$]
$[composition1 composition2 ...$]
$[to_parent_assoc$] $}
${select_list$}
$[clauses$]
Effect
The SELECT statement defines a query performed on the data sources specified in data_source for a CDS view, as part of the statement DEFINE VIEW. Possible data sources are DDIC database tables, DDIC database views, or other non-abstract CDS entities.
- 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.
- composition1, composition2, ... define CDS compositions for the current SELECT statement. These CDS compositions can be accessed in select_list using path expressions.
- to_parent_assoc defines the CDS-to-parent associations for the current SELECT statement. These associations can be accessed 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.
Both forms of the code have the same semantics. Curly brackets { } must be used in the second variant to set select_list.
The optional additions clauses are SELECT clauses that enable conditions, groupings, and union sets to be specified or created.
Example
The CDS view business_partner_role defined here is a view of an existing CDS view business_partner. An element bp_role is defined in the SELECT list and given the comment Business partner role. Any duplicate values of the element are removed using DISTINCT.
-
@AbapCatalog.sqlViewName: 'BPA_ROLE_VW'
define view business_partner_role as
select distinct
from business_partner
${ business_partner.role //Business partner role
$}
The CDS view business_partner_role can be addressed in ABAP programs using , for example:
- SELECT * FROM business_partner_role INTO TABLE @itab ...
The addition DISTINCT of SELECT is no longer needed in this case.
ABAP Short Reference General Data in Customer Master
This documentation is copyright by SAP AG.
Length: 8565 Date: 20240426 Time: 194759 sap01-206 ( 87 ms )