cancel
Showing results for 
Search instead for 
Did you mean: 

Forwarding OData filters and field selection to Cloud SDK VDM client

marcmaurí
Participant
0 Kudos

Dear Experts,

I developed a Node.js CAP App without persistence which exposes some services that require to forward the requests to a S/4Hana Cloud custom service.

For this, I created a new Cloud SDK client with the VDM client generator and implemented custom handlers in the CAP app to forward the request to the VDM client. I also developed an app with some filters that consumes my CAP services, so the user can set the filters as needed.

My question is, is there any way to forward the OData filters and field selection to the VDM Client?

Thanks in advance,

Marc

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hello Marc,

I'm one of the developers of SAP Cloud SDK for Java. In case Gregor's advice is not working for you, I would ask you to provide some code snippets / describe concrete expectations in API to better communicate best-practices.

What is the OData version of your "S/4Hana Cloud custom service"?

Regards

Alexander

gregorw
Active Contributor
0 Kudos

Hi Marc,

I would suggest you check out my sample handler implementaiton in customer-material-service.js. There was no need to create a VDM Client. All filters and field selections are simply forwarded. One drawback unfortunately are the limitation when you use a Fiori Elements UI. The count functionality is lacking there.

Best regards
Gregor

marcmaurí
Participant
0 Kudos

Hi Gregor,

Thanks for your support! I saw your suggestion and I'm working on it. It solved my issues but I have some open questions that I will like to share with you. I will post them soon.

Regarding the limitation you mentioned with the Fiori Elements UI, is there any other limitation that the counting functionality? I solved it by adding the count in the handler and the UI is working fine.

...
const result = await extSrv.tx(req).run(query)
result.$count = result.length;
return result;

Best regards,

Marc

gregorw
Active Contributor
0 Kudos

That is a nice solution. Unfortunately I think it doesn't solve one issue of Fiori Elements that this returns only the actual length but not the total lengh when $top was used.