cancel
Showing results for 
Search instead for 
Did you mean: 

Consume Custom Entity in another CDS view

0 Kudos

Hi Everyone,

I have developed a ABAP class to fetch the data from custom entity. I want to consume the custom entity in another CDS view. I am facing problem when I associate the custom entity type to another cds, getting error saying. Association "_xxxx" of entity "zzzz" cannot be used where _xxxx is my alias (as name) and zzzz is my custom entity.

I am associating to the custom entity type as I would to other CDS view.

Could you please help me out

0 Kudos

Hello Urvashi

Are you still having this issue ? How it was resolved ?

Regards

Lamia

Accepted Solutions (0)

Answers (2)

Answers (2)

Andre_Fischer
Product and Topic Expert
Product and Topic Expert

You cannot use a custom entity as a data source.

I assume that in your CDS view you are using a statement such as _XXXX.<field from custom entity>.

What you can do is to have a normal association and you navigate from the CDS view to the custom entity.

I ran into this problem a while ago myself when preparing the openSAP course.

Unfortunately the error message is a bit misleading.

0 Kudos

Hi Andre Fisher

I'm having the same issue but not sure what is meant by normal assocation and navigate from the CDS view to the custom entity ?

Does it means that it's not possible at all to consume the custom entity from another CDS view via association ?

Regards

Lamia

EricXie
Advisor
Advisor
0 Kudos

Hi Lamia,

I think what Andre meant is instead of picking the field of custom entity in your view, you need to expose the whole custom entity as an association.

Then access the fields of your custom entity via association in your oData service.

If that's not the way you want, you could take look at the concept of virtual element, which allows you to write abap code to calculate field value within your CDS view.

Best Regards,

Eric

0 Kudos

I recently created a custom entity to solve a complex query. It worked great and I am a fan of the custom entity. Unfortunately I couldn't employ it, as the use case was for an SAC live connection query. My understanding is that custom entities can only be exposed and consumed as OData services, and OData is not compatible with SAC live connection, which is a hard requirement. Is this true and if so is there a work around?