CDS Annotations

CDS: VDS Annotations – VDM.viewType

Annotations enrich the CDS views but can be confusing as well. These series of blogs have my simplified explanation.

VDM.viewType is a header annotation (on top) and used only once in a view. It can have following values:

BASIC, COMPOSITE and CONSUMPTION.

Syntax Use:

@VDM.viewType: #BASIC
OR
@VDM.viewType: #CONSUMPTION

Explanation: Use the value BASIC, when this view is used to fetch the directly from the database table. If you are using the BASIC view(s) to perform some calculation, then use COMPOSITE. If you plan to expose a view to interfaces such as Fiori Apps or other services then use the value CONSUMPTION. If you are selecting values from a View and a database table, then use BASIC.

Example: If I need to show “total open order quantity for a material in plant” then I will fetch data from EKPO first in a basic view. I will create a composite view on top of this basic view to do the calculation. Finally I use the composite view as a base to create a consumption view which will be finally exposed to Fiori App.

What I have experienced that this annotations does not impact the app’s function. Nonetheless, it make senses from readability point of view.

Leave a Reply

Your email address will not be published. Required fields are marked *

error

Enjoy this blog? Please spread the word :)

Follow by Email
Twitter
LinkedIn
LinkedIn
Share