Showing results for 
Search instead for 
Did you mean: 

When to use Define View Entity / Define View ?

In the context of RAP, we are using "define root view entity" for main projection CDS View as well as Main Interface CDS View, as that is the main entity of the business object.

For the remaining composition views, we are using "define view entity" without root keyword, as that is not the top most entity of the business object.. This much I have understood.
But In our company, we are using remaining all dependent cds views which are used for value helps, for getting texts...etc, using "define view" with out even entity....

I read few blogs and got basic differences between "define view entity" and "define view", as one got ddic view, for other no need.

But when exactly we need to use define view / define view entity ?

Can we use for all cds views.... define view entity , except root view ?

Kindly share your knowledge on this.

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)



CDS View Entity can be defined using both DEFINE VIEW and DEFINE VIEW ENTITY, here DEFINE VIEW ENTITY is the latest version of DEFINE VIEW. It provides a lot of improvement than DEFINE VIEW such as stricter check, no annotation for Client Handling, Only one name and artifact, and no longer time for activation of complex view hierarchies.

As for the questions:

1. When exactly we need to use define view / define view entity?

It all depends on the feature and functionality you want to use, DEFINE VIEW ENTITY being the latest one will provide a much greater set of addition and continue to improve and will continue to improve.

2. Can we use for all cds views.... define view entity , except root view ?

Yes, you can use DEFINE VIEW ENTITY for all CDS views, but you cannot create CDS View Entity with the same name as an existing CDS DDIC-based View at the same time. You may also get some issue while migrating you older view to the new one as DEFINE VIEW ENTITY is continuing to improve and may have some compatibility issue.

Please refer to this blog for more understanding -

0 Kudos

Hai basantmhr,

Thanks for the answer.

Now from your answer, I take it that, as Define View Entity is the latest & better than Define View.
I can use define view entity for all my cds views from now on.



Yes, you can use DEFINE VIEW ENTITY, but as described in the blog attached, you might have some incompatibility issue during migration from DEFINE VIEW to DEFINE VIEW ENTITY, I would really suggest that you assess the things(if any incompatibility issue) before moving completely to DEFINE VIEW ENTITY.

Active Contributor
0 Kudos
Product and Topic Expert
Product and Topic Expert
0 Kudos

Yes, the usage of CDS view entities - instead of CDS DDIC-based views - is recommended on SAP BTP ABAP environment (aka Steampunk) and on-premise starting with SAP S/4HANA 2020.

  • CDS view entities --> DEFINE VIEW ENTITY [recommended]
  • CDS DDIC-based views --> DEFINE VIEW

More blogs on ABAP CDS can be found here.