Skip to Content
Jun 12, 2019 at 03:01 PM

SAP Cloud SDK - Get and Convert Filter Expression not working

12757 Views Last edit Jun 12, 2019 at 03:03 PM 2 rev

Hi all,

we've created a CDS based OData service in Cloud Foundry with CAP to call an OData exposed by a SAP ECC and as we read on this blog:

we should be able to convert the filter expression retrieved from the QueryRequest object into the filter expression that can be used in the filter method of the ODataQueryBuilder object.

We've modified the following dependency version in the pom.xml file:








So when we start our service and try to invoke GET method with filter property set as show:

/odata/v2/Search1LService/Mmain?$filter=('Maufnr' eq '0001')

we get an exception because of the filter format.

Apparently the queryRequest.getQueryExpression() provides the right filter data but when we try to convert this object into the FilterExpression object something goes wrong.

As you can see the String value is: " eq %27Maufnr%27" instead of "%27Maufnr%27%20eq%20%270001%27".

The FilterExpression object (fe2) has obviously the same issue, so the execute call ends with an exception, because the OData filter we are passing to the backend system has a wrong format.

In the blog the author passes the FilterExpressionConverter.queryRequest.getQueryExpression() object to UncheckedFilterExpression costructor to buid the filter input parameter:


.filter(new UncheckedFilterExpression<>(




In our class this code causes a syntax error because the filter doesn't accept this UncheckedFilterExpression object as input:

The method filter(FilterExpression) in the type ODataQueryBuilder is not applicable for the arguments (new UncheckedFilterExpression<>(FilterExpressionConverter.convertTo(queryRequest.getQueryExpression())))Java Debug

Can someone please help with the issue? Is there something wrong to get the expression or is there a bug in the Cloud SDK to convert the Expression?

Best regards


debug01.png (133.4 kB)
debg02.png (71.5 kB)