SAP Knowledge Base Article - Public

2600188 - Error "Operands of Logical Operator 'and' are not Valid" While Using OData Filters

Symptom

You are trying to use the Odata queries below, but system shows the error message: "Operands of logical operator 'and' are not valid".

  • ge and lt.
  • gt and le.
  • gt and lt.

Environment

  • SAP Hybris Cloud for Customer 1802 and higher.
  • SAP Business ByDesign 1802 and higher.

Reproducing the Issue

Open the internet browser and use a query, such as: https://<myTenantURL>/sap/c4c/odata/v1/c4codata/OpportunityCollection?$filter=AccountID ge '1234' and AccountID lt '1240'

Cause

This is the expected system behavior. Logical operator AND only works when used between different properties.

Supported:

$filter=OpportunityID ge 'YYYY' and Name/content eq 'Test'

Not Supported:

$filter=PartyID ge 'ZZZZ' and PartyID le 'XXXX'

(YYYY represents the ID of the Opportunity, ZZZZ represents one Party ID and XXXX represents another Party ID)

See Also

https://github.com/SAP/C4CODATAAPIDEVGUIDE#known-limitations

Keywords

Odata Filters, Query, Logical operator , KBA , LOD-CRM-INT-API , OData API (C4C Only) , Problem

Product

SAP Cloud for Customer add-ins all versions