Skip to Content

$filter option in SAP Cloud Integration OData adapter does not work. Invalid filter option

Hi

We are trying to call an OData service in the SAP Backend user a $Filter via OData provisioning

We are able to call the odata service directly using this filter option but when we do it via the OData adapter the adapter crashes with this error.

Request url for HCI:

https://xxxxxx-iflmap.hcisbp.eu1.hana.ondemand.com/http/Webshop/SalesOrderHistory/SalesOrderSet$filter=Customer eq '0050169000'

Response from CPI (the request does not reach the SAP Backend

An internal server error occured: No property "Customer%20eq%20%270050169000%27" exists in type "Z_ORDER_TO_CASH_V1_SRV.SalesOrder" at position 1 in "Customer%20eq%20%270050169000%27"..

It seems as if the adapter tries to find the entire string “Customer eq ‘1234567890’”as a property in the service.

The Filter parameters are dynamically set from the request url using the CamelHTTPQuery header.

I do not think it is a problem with OData provisioning itself since a direct call to the ODP OData service (via http) works fine. Also $top & &skip work fine both in http and odata adapter.

So it seems a problem specifically for the CPI OData adapter.

How can we solve this?

Thanks

Tom

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Dec 01, 2017 at 02:00 PM

    Hi Olegs,

    Thanks, I tried it but the behaviour stays the same alas.

    regards

    Tom

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 01, 2017 at 01:41 PM

    Have you tried

    https://xxxxxx-iflmap.hcisbp.eu1.hana.ondemand.com/http/Webshop/SalesOrderHistory/SalesOrderSet/?$filter=Customer eq '0050169000'
    Add comment
    10|10000 characters needed characters exceeded

  • Dec 06, 2017 at 11:35 AM

    Hi Tom,

    It seems to me there is a ? missing:

    https://xxxxxx-iflmap.hcisbp.eu1.hana.ondemand.com/http/Webshop/SalesOrderHistory/SalesOrderSet$filter=Customereq'0050169000'

    vs

    https://xxxxxx-iflmap.hcisbp.eu1.hana.ondemand.com/http/Webshop/SalesOrderHistory/SalesOrderSet?$filter=Customereq'0050169000'

    Can that be the error?

    Kind regards,

    Martin

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Martin,

      I was using the wrong header for the filter in my OData select. I used CamelHTTPQuery which contains the complete filter string including thew word filter itself which is nice for monitoring but you cannot use it in your OData select statement.

      Apache Camel also sends all url parameters as headers with the message, so as soon as I whitelist the header named filter I can use it in the query string, which then looks something like this (note the top and skip headers are also whitelisted):

      $select=Field5,Field4,Field3,Field2,Field1,DeliveryCity,DeliveryPostlCode,DeliveryCountryIso,DeliveryStreet,DeliveryName,DeliveryPartnerID,Status,SelectMaterial,AllowanceTotal,Payable,TaxInclusive,TaxExclusive,Yourreference,Custpurchasenumber,Documentdate,Customer,RequestType,Division,DistrChan,SalesOrg,DocType,Salesdocument&$top=${header.top}&$skip=${header.skip}&$filter=${header.filter}

      This works pretty good as long as all parameters are always provided which is something you can agree upon with the sender of the request.

      KInd regards

      Tom