SAP Knowledge Base Article - Public

2787565 - ODATA Case Sensitive Operators

Symptom

While generating an ODATA query you are using $filter however notice that a filter on specific field does not return specific values.

Environment

  • SAP Cloud for Customer
  • SAP Business ByDesign

Reproducing the Issue

You have generated an ODATA query like the one below:

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/ana_businessanalytics_analytics.svc/RPZ123456789123456789123QueryResults?$select=CREL_CP_WPA_EMAIL_URI_CONTENT&$filter=CREL_CP_WPA_EMAIL_URI_CONTENT eq 'at123@gmail.com'

There are no results even though there is data for this e-mail address.

Cause

$filter is case sensitive but in your query you have used the wrong case for the filter value.

The example above has the e-mail at123@gmail.com in it. Originally this e-mail address would have looked like AT123@gmail.com.

Resolution

You either have to use the correct case for your value or you can make use of the following filter functions: substringof, startswith and endswith.

These operators are translated to a "Contains-Pattern" in ABAP which is not case-sensitive.

By using the startswith operator you will be able to select data that is case sensitive and bypass this sensitivity, see example below:

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/ana_businessanalytics_analytics.svc/RPZ123456789123456789123QueryResults?$select=CREL_CP_WPA_EMAIL_URI_CONTENT&$filter=startswith(CREL_CP_WPA_EMAIL_URI_CONTENT,'at123@gmail.com')

See Also

ODATA Blog

Keywords

ODATA, case sensitive, upper case, lower case, report, query, operator, filter, no data, filter not working, returns no data , KBA , AP-RC-ANA , C4C, ByD, Travel: Analytics Tools & Frameworks , How To

Product

SAP Business ByDesign all versions ; SAP Cloud for Customer add-ins all versions