Skip to Content
0
Oct 14, 2022 at 01:37 PM

CAP - Querying SCI MessageProcessingLogs returns maximum of 1000 records

272 Views

Hi,

I have a small custom CAP application, which integrates the following API of the SCI.

I query the MessageProcessingLogs using the following code snippet:

const msgProcessingSrv = await cds.connect.to('com.sap.hci.api');
const messages = await msgProcessingSrv.read(msgProcessingSrv.entities.MessageProcessingLogs);

Somehow the service returns only 1.000 records, even though there are more.

After sending some queries via PostMan I found the following behaviour:

Sending {{baseURL}}/MessageProcessingLogs?$format=json

Returns a response of 1000 records, with a '__next' property that links to the next set of data.

Sending {{baseURL}}/MessageProcessingLogs?$format=json&$top=1000

Returns a response with the same data, but no 'next' property

Sending {{baseURL}}/MessageProcessingLogs?$format=json&$top=1000&$skip=1000

Returns a response with the corresponding data, which is the next page, but also doesn't have a 'next' property

When running my CAP application locally with mocking the service (and over 1000 records in a csv file) through

cds-ts mock com.sap.hci.api

and another terminal running

cds-ts watch

I get the behaviour of the first example above, with a next property (which is called $nextLink in CAP), which points to the next set of data, that I can simply query by calling srv.get(...) with the value of the $nextLink property.

However, in the deployed version of my application, I don't get any references to the next set of data (checked by logging the keys of the response of the service call).

Additionally, manually constructing queries which make use of $skip / $skiptoken (that's what's in the link in the postman response), I still get only 1000 records.

Has anyone encountered a similar behaviour and was able to solve it?

Ideally I'd like to read all available MessageProcessingLogs records (if possible even in one request, as to not flood the external service).

Thanks for any hints on the topic.

Regards

Jan