zl程序教程

您现在的位置是:首页 >  其他

当前栏目

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

SAP 一个 例子 View 具体 Extension 4HANA cds
2023-09-14 09:03:07 时间

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

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

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

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

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

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.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":