It is possible to define an extend view for a CDS query view to extend the query. However, in the extend view, only query elements are allowed. That is, what you can directly define in a CDS view of annotation @Analytics.query:true, it can also put into its extend view.
Metadata can be extended in infoprovider CDS only when base CDS has @Metadata.allowExtensions: true.
For query defined as below:
The query gets result as below:
By define a extend view for ZGL_QT2, a constant (as a formula) can be added into the query result:
Query result of 2CZGL_QT2V now:
Key figure, formula, restricted measures...etc can be added in an extend view for query CDS. But to add more characteristics into the underlying data model should be done in the infoprovider CDS views.
Attention: the extend view (ZGL_QT2_EXT) is just a sub object depends on the main view (ZGL_QT2). It can't work independently as a CDS entity. That is, the objects added in the extend view actually exists in the main view as append fields.
After activation, we could see the DDIC structure of ZGL_QT2V as below:
In this way, users can extend delivered SAP content CDS views for customizing.