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

CAP $expand external service

VoJu
Participant
0 Kudos
3,501

Hello together,

I have included an external service to my CAP project and added it to my service CDS. When I call the entity and use OData Notation $expand it is working, also the READ in my servicehandler is called.

I want to access the entity with $expand in a cds function ( https://cap.cloud.sap/docs/cds/cdl#actions ). What would be the right approach:

a) Use CQN SQL join ( https://cap.cloud.sap/docs/cds/cqn#select ) in my servicehandler

b) Create a new entity in my service CDS with mixin ( https://cap.cloud.sap/docs/cds/cql#query-local-mixins ) like described here https://answers.sap.com/questions/13055409/cap-using-expand-on-imported-model.html

c) Use await tx.get(url path with $expand)

c) is working for me, but maybe there is a better solution.

Thanks and best regards,

Julian

View Entire Topic
NilsJanßen
Participant
0 Kudos

Hi @VoJu ,

I hope you found a solution already. I had luck with something like this in which masterBlockData is the master table and sma an association to another table.

SELECT.from('masterBlockData', (mbp) => {
          mbp`.*`,
            mbp.sma((sma) => {
              sma`.*`;
            });
        }).limit(10)

 I know its late but I hope it helps.