cancel
Showing results for 
Search instead for 
Did you mean: 

SAP ABAP CDS @VDM.viewType usage.

prince_joshi
Explorer
0 Kudos

Hello Experts,

I have below query regarding SAP ABAP CDS (core data services) VDM (virtual data models) types:

I read the article "https://blogs.sap.com/2017/10/09/abap-core-data-services-part-2virtual-data-model-types/" where the types of VDM views are explained.

We know that Basic views are built on top of DB tables, composite views are on top of basic view and consumption views are on top of composite views. But there are no error/warning messages pop's up when we don't follow these rules.

For example: I created below ABAP CDS view with @VDM.viewType: #CONSUMPTION where I am directly fetching from DB table 'DFKKINVBILL_I' & CDS view is getting activated.

Above I am directly hitting DB table for data access & it is activated(that means it can be used in Fiori application for data access). So, how come VDM view type matter's in the development? It is working for @VDM.viewType: #CONSUMPTION.

Is it like VDM types are just design patterns? that we should always develop ABAP CDS views in this way-> DB table-> Basic views->composite views->consumption views?

Also, I have seen a ABAP CDS view which was developed without using any VDMtypes annotation and only used annotation was "@OData.publish: true". Using this CDS view the Fiori app(Fiori List view) was accessible on Fiori launchpad. So, here also how come VDM types actually making difference?

Or is it just that we wanted to keep our DB table access separated from external sources (Fiori or BI tools) and other reason?

Regards,
Prince

Accepted Solutions (1)

Accepted Solutions (1)

ClausB
Active Participant
0 Kudos

It is only a classification of your CDS-Views. At the moment, it has no impact on your runtime.

According to the documentation it is only interpreted internally by SAP. But of course it is also good for your own structuring

https://help.sap.com/viewer/cc0c305d2fab47bd808adcad3ca7ee9d/7.5.9/en-US/efe9c80fc6ba4db692e08340c91...

Answers (5)

Answers (5)

Former Member
0 Kudos

In my experience @VDM.viewType: #CONSUMPTION does matters other wise it can not be used in analytics to release as API state C1. May be I am unable to undestand something but w/o these and the analytics query true it can not be used though in ADT you can run the CDS but that is half the story.

Regards,

Prasenjit

0 Kudos

Hi,

prince joshi,

when you active your cds view by providing @vdm.view type :#consumption in basic view it won't show warning or error message but first we have to know why this annotation are used. annotations are used in order to depict different properties of cds views.e.g. types of data, size of data,etc..

basic view will always have master data sometimes truncational data but composite view is used for joining between master and transaction data .

by specifying @vdm.viewtype it will be helpful for others who will see to your cds view what you have used for eg in basic view we just fetch data , in composite view we do joining or any other operation, in consumption view we consume data based on composite view .

gasparerdelyi
Active Participant
0 Kudos

There are no syntax errors or warnings for not following the rules, but there are static code checks reported (in SAP Code Insperctor for example).

Pavan_Golesar
Active Participant
0 Kudos

Hi prince.joshi,

That's a valid question,

@VDM.viewType:

This annotation has absolutely NO impact on the behavior or output of the CDS view rather.

However its Best Practices to mark @VDM annotation for CDS views. Looking at this annotations, one can figure out everything about the CDS view. it just show below features;

1.What kind of data CDS view expose or What's the category of CDS view.

@VDM annotation is further broken down into the type of views. There are 4 type of CDS views can be developed;

-BASIC

Basic CDS views are developed to expose the Master Data like Customer Master, Material MAster, Business Partner etc. They consume the physical SAP tables to read data. They are also called INTERFACE views and for naming standards SAP use ‘I’ in between of the view name : *_I_*

-COMPOSITE:

These views are configures as an Association of Master data sets OR Master data and Transactional data. They can consume Basic Views or other Composite views to read data. For naming standards, SAP use ‘CO’ in between of the view name: *_CO_*

-CONSUMPTION

These views are created as the last layer of CDS analytical Model. These are the final views ready for consumption by the UI tools – Bex, Lumira, Webi, Analysis for Office etc. to be accessed by business users in the from of a report. These views can consume all other Basic or Composite Views to read data and create a final data set to be fed into the UI tools for reports based on business requirements. For naming standards, SAP start the view name with ‘C’: C_*

-PRIVATE

These views are private to SAP and must not be Used or Created by anyone other than SAP. SAP can change their configuration without any notice to the customers. For naming standards, SAP start the view name with ‘P’: P_*


Thanks

Pavan Golesar

Former Member
0 Kudos

Sorry for my limited knowledge and still I wish to comment that this type matters in case of #CONSUMPTION because otherwise the SAC wont be able to use it and even you can not release it as API state(C1) for SAC

prince_joshi
Explorer
0 Kudos

Hi horst.keller,

Could you please put some light on the above query.

Regards,
Prince