cancel
Showing results for 
Search instead for 
Did you mean: 

Top, skip and inlinecount in a request

marcmaurí
Participant
0 Kudos

Dear Cloud SDK team,

The following odata request to an S/4 system is executed as expected:

  • I get a result with 100 records.
  • I get the __count property with the 613 records.

http://{{host}}/sap/opu/odata/sap/API_PRODUCT_SRV/A_Product?sap-client=500&$format=json&$top=100&$sk...

Why is it not possible to implement it with Cloud SDK? With Cloud SDK I can retrieve either the counter or the result set, but not both in a single query.

Best regards,

Marc

View Entire Topic

With the default API it's not easily possible. However we made sure you can cast any OData v2/v4 request to our Generic OData API. The response object features a method "getInlineCount()". However please notice - according to API contract - the method throws an exception if no inline count can be determined. You can let us know, if you need assistance with API usage.

Please find the following documentation page:

Generic Advanced OData Client | SAP Cloud SDK

Kind regards

Alexander

marcmaurí
Participant
0 Kudos

Thank you Alexander for your prompt reply.

We will check and let you know.

Best regards,

Marc

marcmaurí
Participant
0 Kudos

Hi alexander.duemont ,

Is the Generic Advanced OData Client available only for Java SDK? We use the Javascript version.

Best regards,

Marc

drvup
Contributor

As workaround, you could also add a custom query parameter to your request

https://sap.github.io/cloud-sdk/docs/js/features/odata/execute-request#setting-custom-query-paramete...

The idea, why this isn't coming out of the box - I assume it's that requesting "just the count" is more efficient, also for your loop/paging logic you're going to realize further. But I do not know, if this is real the case 😉