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 Cloud for Customer
  • SAP Business ByDesign

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)

Similarly,

Logical operator OR only works when used between same properties.

Supported:

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

Not Supported:

$filter=PartyID ge 'ZZZZ' or OpportunityID le 'XXXX'

See Also

C4CODATAAPIDEVGUIDE - Known Limitations on GITHUB

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 ; SAP Cloud for Customer core applications all versions