Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When to use which CDS View type? #9

Open
juliax00 opened this issue Mar 27, 2019 · 2 comments
Open

When to use which CDS View type? #9

juliax00 opened this issue Mar 27, 2019 · 2 comments
Labels
question Further information is requested

Comments

@juliax00
Copy link

Hello everyone,

you write "Use Basic Views instead of direct access to database tables in CDS Views. Create Basic CDS View when you create a new database table and want to access its data in CDS.".

At our company, we are currently defining best practices for our developments - we have two possible approaches:

  1. strict procedure according to the VDM:
    Each application has its own Consumption View, which is based on Composite Views, which are based on Basic Views. Basic Views are based on data base tables.
    It is not allowed to consume data (select in ABAP Coding) directly from Basic Views. For database tables, Basic Views should always be created directly.

  2. basic idea follwing the VDM:
    If only less data is needed that is already available in the Basic Views, an Consumption View does not have to be created (for example: select serial numbers for all equipments). It can be selected directly from the Basic View. So the data consumption does not have to base strictly on Consumption Views.

**What is your opinion on these two scenarios? Please elaborate.
Unfortunately we did not find a SAP source that says that you can / should select from Basic Views. **

Thank you and regards
Julia

@ilyakaznacheev
Copy link
Owner

Hi @juliax00 ,

My opinion is that the consumption views don't not 100% required for such small cases. Thus, for example, if you want to get a material unit, you can just select it from I_Material without creating a specific consumption view.

But on another hand, very rare the app only needs to read some plain data like in the example above. Normally you want to process this data and read some data from other sources. In this case, you can group these reads into a solid model in CDS layer, and then read the data, that 100% fulfills the program needs.

So be reasonable and don't over-complicate the data model, but also try to group a chain of database reads into a single model, that can prepare this data on the DB layer.

@ilyakaznacheev ilyakaznacheev added the question Further information is requested label Oct 7, 2019
@basusoumyajit
Copy link

The idea of 'Consumption View' is it creates a User Consumable/Many other 3rd party consumable view. 'Consumption View' gets process through 'OLAP' engine built withing S4 system and provide different end user formatting option. If your target is to consume the outcome of any view fro a ABAP Code, you don't really need a consumption view.

So to cut sort 'Consumption View' is only required for 'Analytical'/'Reporting' application.

Now come to point why we build COMPOSITE view on top of BASIC View?
There is strict rule that you can not build a Consumption View on top of Basic View. Consumption view joins/(association) multiple basic views keeping all its defined properties(annotation) of each field intact. Where as if you use raw join statement for joining multiple tables/views, you will loose the properties defined for each fields in the lower level view, and you need to redefine them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants