
Since kernel release 7.83, CDS projection views are available in different flavors, specified using the syntax statement PROVIDER CONTRACT. Each flavor has a different feature set and different syntax checks. This blog post describes the available types of CDS projection views and where to find further details.
Types of CDS projection views
CDS projection views are the top-most layer of a CDS data model. They expose data of an underlying CDS data model for a dedicated use case. They correspond to consumption views that make up the C-layer in the Virtual Data Model (VDM) that is used within S/4HANA.
Different kinds of CDS projection views are available. Each comes with its own feature set and its own syntax checks, designed for a dedicated purpose. The type of projection view is specified using the syntax statement PROVIDER CONTRACT.
The following types of CDS projection views are currently available:
Type | Available since |
CDS transactional query |
|
CDS analytical query |
|
CDS transactional interface |
|
No contract |
|
CDS transactional queries are intended for modeling the projection layer of a RAP business object in the context of the ABAP RESTful Application Programming Model (RAP). They represent the top-most layer of a CDS data model and have the purpose to prepare data for a particular use case.
Role of a CDS projection view of type transactional query in a RAP business service:
Example
@EndUserText.label: 'CDS projection view, REDEFINED ASSOC'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define root view entity DEMO_CDS_PV_PARENT
provider contract transactional_query
as projection on DEMO_CDS_VIEW_PARENT
redefine association _child
redirected to composition child DEMO_CDS_PV_CHILD
{
key Id,
Int1,
/* Associations */
_child.Int1 as field_exposure
}
Further details
CDS analytical queries are designed for modeling analytical queries within a CDS data model. The projected entity must be an analytical cube view and the feature set is restricted to the capabilities of the runtime of the analytical engine. CDS projection views of type analytical query improve on the previous version of CDS analytical queries (DEFINE VIEW).
Example
@AccessControl.authorizationCheck: #NOT_ALLOWED
define transient view entity DEMO_CDS_ANALYTIC_CASE
provider contract analytical_query
as projection on DEMO_CDS_CUBE_VIEW
{
so_key,
currency_sum,
//selection-related case expression
@Semantics.amount.currencyCode: 'currency_sum'
case when lifecycle_status between 'A' and 'B'
then amount_sum else null end as QuantityAB,
//formula-related case expression
@Aggregation.default: #FORMULA
case
when created_on = $session.system_date
then abap.int8'200'
else abap.int8'700'
end as formula_demo
}
where created_on = $session.system_date
Further details
CDS transactional interfaces are intended to serve as stable public interface, for example in a RAP extensibility scenario. To represent a released API, transactional interfaces need to be released under a release contract, for example C0 or C1. The feature set is restricted to projection elements from the underlying projected entity. No new associations, virtual elements, or fields can be defined.
Position of a CDS transactional interface in a CDS data model:
Example
@EndUserText.label: 'CDS transactional interface'
@AccessControl.authorizationCheck: #NOT_REQUIRED
define root view entity DEMO_CDS_TRANS_INTERFACE_ROOT
provider contract transactional_interface
as projection on DEMO_CDS_PURCH_DOC_M
{
key PurchaseDocument,
Description,
Status,
Priority,
/* Associations */
_PurchaseDocumentItem:
redirected to DEMO_CDS_TRANS_INTERFACE_CHILD
}
Further details
If no provider contract is specified…
Further details
Questions, comments, or further details required? Use the Comments section below. Discussions are welcome.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |