cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP CDS View Entity - Joining Table View

SUD_SAP_Acc
Explorer
0 Likes
1,467

Hello *,
I am currently exploring the possibilities of SAP CDS View Entities and trying to replace various SQL statements in our coding with CDS View Entities to improve performance. In doing so, I have encountered several situations where the Open SQL statement (which we are using now) performs JOINs on table views (for example V_EQUI).

So far, I have not been able to integrate a JOIN on the view V_EQUI into a CDS View Entity. When I Use an ABAP CDS View instead, it works perfectly fine. Is it even possibleto JOIN a Table View when I use a CDS View Entity? If so, how can this be achieved?

 

My Examples:

ABAP CDS View (works fine):

define view YCDS_VIEW_TO_CDS as select from equi inner join v_equi on v_equi.equnr = equi.equnr { equi.equnr, v_equi.begru }

CDS View Entity (does not work):

define view entity YCDS_VIEW_TO_ENTITY2 as select from equi inner join v_equi on v_equi.equnr = equi.equnr { equi.equnr, v_equi.begru }

Thank you in advance!

Best Regards

Marius

ABAP Development

 

 

Accepted Solutions (1)

Accepted Solutions (1)

junwu
SAP Champion
SAP Champion

cds is for data modelling, not for performance.

SUD_SAP_Acc
Explorer
0 Likes
Thank you junwu. And if I want to develop a data model that contains the statement mentioned above. Is this possible? Best Regards.
junwu
SAP Champion
SAP Champion
0 Likes
create a view entity to select from your view(v_equi), then use this entity to join other view entity
SUD_SAP_Acc
Explorer
0 Likes
Unfortunately this does not work either. When I type "define view entity YCDS_VIEW_TO_ENTITY2 as select from V_equi { v_equi.begru } " Eclipse tells me that it is not allowed to use objects of type "VIEW" for CDS View Entities. That's why i asked this question to the community.
junwu
SAP Champion
SAP Champion

looks like normal view is not supported.

probably you can create a cds view as workaround

junwu_0-1741021705590.png

 

SUD_SAP_Acc
Explorer
0 Likes
Thank you junwu. Looks like there's still a gap between "old ABAP CDS View" and "CDS View Entity"-Functionality... It's a pity. But I'll try it via ABAP CDS View Functionality.
junwu
SAP Champion
SAP Champion
check if you can use the ddic view( generated by cds view from my screenshot) in your cds view entity.
SUD_SAP_Acc
Explorer
0 Likes
I already checked. It works. Thank you very much! 🙂 Nevertheless, I hope that SAP will eventually offer this functionality for CDS View Entities as well someday...

Answers (0)