Skip to Content

How to use OData Date filter query to filter data from OData NetWeaver Gateway Service?

Jan 25 at 09:45 AM


avatar image
Former Member


I am trying to use the OData Filter query. to filter data records from the OData Service, using Date range for filters.

Please check the below URL for the SAP's sample OData Service, with filter option.

Service Query URL :$filter=OrderDate+ge+datetime%271996-07-04T00:00:00%27

It gives out following error :->

<message xml:lang="en">Invalid filter expression: 'OrderDate ge datetime'1996-07-04T00:00:00''</message>

Please let me know, if there is any mistake in the Query or is there anything that needs to be done on the
Backend Service.

Thanks & Regards,

Avish Kumar

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Ankit Maskara
Jan 27 at 06:09 PM

This works for me - "<OData service>....$filter=StartDate ge datetime'2017-04-15T00:00:00' and EndDate le datetime'2017-04-28T00:00:00' " provided the entity has StartDate and EndDate as Edm.Datetime properties. Same should work for you as well.

10 |10000 characters needed characters left characters exceeded