Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

OData filter logical (substringof and substringof) on same property fails

former_member637651
Discoverer

Hi, I'm having an OData filter that looks like this:

$filter=substringof('120',PROPERTY) and substringof('130',PROPERTY)

As soon as I have 2 substringof operations on the same property name, the query fails.

"Expression can not converted into ABAP select options"

Replacing the 'and' with an 'or' passes, but changes completely the context of my query.

My property is defined as a string, that can be either empty, have 1 value, or multiple comma-separated values, and the query should return the items that has all values specified.

PROPERTY=""
PROPERTY="120"
PROPERTY="120,130,150"

According to this question from 2012, multiple actions on the same properties are not supported yet.
https://answers.sap.com/questions/9264652/multiple-filters-with-dates.html

Can someone confirm this is still the case?
Does someone have another performant solution for my case?

Thanks

  • SAP Managed Tags:
3 REPLIES 3

Andre_Fischer
Product and Topic Expert
Product and Topic Expert

Hi Ronald,

please check out my following blog:

https://blogs.sap.com/2018/06/07/how-to-get-select-options-for-a-filter-that-contains-two-substringo...

Though I have not tried it with the same property you should be able to interpret the filter object yourself.

Best Regards

Andre

ceterum censeo RAP esse utendam
  • SAP Managed Tags:

0 Kudos

Thanks Andre,

I actually found your blog earlier when I was searching for a solution. However the problem you describe is different then mine.
I don't have any problems with the or operator between different or same properties. Only when I use and on twice the same property.

Also, my client is a .NET application that constructs the appropriate OData URLs and calls the server endpoint.
There is no way for me to evaluate filter trees on the sap side.

  • SAP Managed Tags:

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Kudos

I can confirm that the SAP Gateway Framework is not able to convert the above mentioned $filter value

$filter=substringof('120',PROPERTY)and substringof('130',PROPERTY)

into Select Options.

Is there any way you can change the service implementation on the SAP side?

If yes, what is the SAP NetWeaver Release of the system the service implementation is running in?

Best Regards,

Andre

ceterum censeo RAP esse utendam
  • SAP Managed Tags: