Ansicht
Dokumentation

ABENCDS_SELECT_STATEMENT_V1 - CDS SELECT STATEMENT V1

ABENCDS_SELECT_STATEMENT_V1 - CDS SELECT STATEMENT V1

Vendor Master (General Section)   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

- DDIC-Based View, SELECT

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


Effect

The SELECT statement defines a query performed on the data sources specified in data_source for a CDS DDIC-based view, as part of the statement DEFINE VIEW. Possible data sources are DDIC database tables, DDIC database views, or other non-SQL CDS entities.

  • 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 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.

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.






BAL_S_LOG - Application Log: Log header data   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 6310 Date: 20240425 Time: 095150     sap01-206 ( 57 ms )