CDS View on View is a concept where a CDS selects from other CDS. It may be a good Idea to create an Exposed association and then create another view(View on View) to select specifically the required fields. This is a good programming practice and enhances clarity with CDS programming!
There is no other special syntax for View on View. It works just like a normal CDS view and can be parameter enabled also.
Good Practice: In what scenario, we like to use CDS View on View?
- It is a good idea to create View on View and use WHERE condition, filters, inbuilt functions on database layer rather than using a where condition in application logic with AS ABAP
- When The second derived CDS is to be directly used by ABAP… it provides clarity to maintenance IT staff.
- This is more use useful when path expressions and/or exposed association make first CDS complex to understand. It is advised to create second with direct mention of fields to be consumed.