SAP Knowledge Base Article - Public

2767202 - OData Query Doesn't Fetch all the Records

Symptom

You are trying to fetch data using an OData service, for example:

https://myxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/AppointmentCollection

You don't find all records in the result.

Environment

SAP Cloud for Customer

Reproducing the Issue

Run an OData query for any object, for example Product for which (for example) 10000 products exist in the system. You will find only 1000 product records being fetched.

Cause

An OData query without any filter fetches only 1000 records.

Resolution

Please use a filter like $top = 10000 in this case to bring all the records.

For example:

https://myxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/AppointmentCollection?$top=10  will fetch 10 records.

https://myxxxxx.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/AppointmentCollection?$top=50000 will fetch 50000 records.

Note that, for consuming analytical reports and data sources, using only $top parameter does not improve the query performance since it does not reduce the amount of information to be read in data source level. So, if used alone in large queries or reports, the $top parameter will not improve the performance. To improve the performance, you should make use of $filter parameter instead.

See Also

2330688 - How to Use Methods And Filters in OData Services

2806920 - OData Error " 500 SAP Internal Server Error"

Keywords

ODATA, Custom Odata, Query without filters, Odata query gives maximum 1000 entries , KBA , odata , custom odata , odata query gives maximum 1000 entries , query without filters , AP-RC-ODF , OData framework (C4C Only) , How To

Product

SAP Cloud for Customer add-ins all versions ; SAP Cloud for Customer core applications all versions