Symptom
You create two identical custom OData services. One as the primary (main) OData service and one for testing.
However, different results are produced for each OData service when using the $count query.
Environment
SAP Cloud for Customer
Reproducing the Issue
- Navigate to the Administrator work center.
- Go to the OData Service Explorer view.
- From the drop-down menu, select Custom OData Services.
For example purposes:
- Test OData service = 'customtest'.
- Primary OData service = 'customprimary'.
- Open 'customtest'.
- Run queries:
- https://myexample.crm.ondemand.com/sap/c4c/odata/cust/v1/customtest/EmployeeCollection/$count => result: 20
- https://myexample.crm.ondemand.com/sap/c4c/odata/cust/v1/customtest/BusinessPartnerCollection/$count => result: 23
- Open 'customprimary'.
- Run queries:
Cause
The behavior is different for both OData services because one service has been created in a different tenant version.
For example, 'customprimary' was created in 1811, whereas 'customtest' has been created in 1902.
Resolution
If the default value provided for the particular property should be treated as constant, then the corresponding property should be marked as 'Hide in Metadata' from OData Editor.
In 'customprimary', under Employee, BPKINDcontent has a default value, unlike 'customtest'.
As a result the BPKINDcontent must be selected as Hide in Metadata for 'customprimary'.
This is the same case for Business Partner.
Keywords
OData, query, custom , KBA , AP-RC-ODF , OData framework (C4C Only) , Problem