cancel
Showing results for 
Search instead for 
Did you mean: 

ODATA API Wildcard characters

itabhishek9
Participant
0 Kudos

Hi SDNites,

I have a requirement to consume ODATA API of S4HANA cloud system and the query string should have some wild card characters like '*'. I have tried to use substring and contains function and none of them are working. Can you please advise if the same does not work with S4HANA cloud and are there any other options available.

Regards,

Abhi

Accepted Solutions (0)

Answers (1)

Answers (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi Abhishek,

I am not sure if the odata service you are refering to is on version 2 or 4. But if it is on version 2, there is no "contains" function. On version 2 you will have to resort to function "substringof" like the following exemple:

https://services.odata.org/v2/Northwind/Northwind.svc/Customers?$format=json&$filter=substringof('Alfreds', CompanyName) eq true

On version 4.0 there is a rather simpler way of doing so:

https://services.odata.org/v4/Northwind/Northwind.svc/Customers?$format=json&$filter=contains(CompanyName,'Alfreds')

If you are still facing trouble, please let us know the exact service and the uri you are using to perform filtering.

Best Regards,
Ivan