天天看点

一个SAP S/4HANA CDS view extension的具体例子

(1) create a CDS view with following source code:

一个SAP S/4HANA CDS view extension的具体例子

Once activated, you see two fields in SQL view as expected.

一个SAP S/4HANA CDS view extension的具体例子

(2) Create another CDS view which extends the view created in step one with additional two fields: PRODUCT_TYPE & UPNAME.

一个SAP S/4HANA CDS view extension的具体例子

Once activated, you will find these two fields are extended via traditional ABAP append structure in SQL view.

一个SAP S/4HANA CDS view extension的具体例子

Consumer does not know whether a field is coming from original extensible view or from extension view, it is completely transparent.

一个SAP S/4HANA CDS view extension的具体例子

The annotation viewEnhancementCategory has following possible values:

#PROJECTION_LIST:

Extensions of the SELECT list and additional associations are allowed; extensions of CDS views whose SELECT lists contain aggregate expressions or have a UNION clause must be permitted using further values

#GROUP_BY:

Aggregated or non-aggregated elements are allowed to be added to a SELECT list with aggregated expressions and the associated extensions of the of the GROUP-BY clause are also permitted; can only be specified together with #PROJECTION_LIST

#UNION:

Extensions of the SELECT list of a CDS view with a UNION clause are allowed; can only be specified together with #PROJECTION_LIST

#NONE:

No extensions allowed; cannot be specified together with other values

If not explicitly specified, the default value #PROJECTION_LIST will be chosen.

Guideline

To avoid confusesness and potential ATC error, default value must always be specified explicitly by developer.