cancel
Showing results for 
Search instead for 
Did you mean: 

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

tomvanrooijen
Participant

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$filt... 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

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

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

tomvanrooijen
Participant
0 Kudos

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

virendra_raval
Employee
Employee
0 Kudos

Hi Rooijen,

Could you please elaborate on "whitelist the header named filter". How do you do that in CPI? We have a OData Service Integration Flow (Odata as sender and receiver). We are not able to capture any url parameter in headers. In our case, the below is output of header list

null accept-language en-US,en;q=0.9,gu;q=0.8

ODataContext org.apache.olingo.odata2.core.ODataContextImpl@501b8ee3

odataEntity Customers

ODataMethod GET_FEED

odataURI null

SAP_MessageProcessingLogID AFy_xY3nU4CZP0GUMwfhjwAyYXip s

criptFile script2.gsh

scriptFileType groovy

UriInfo com.sap.gateway.core.ip.odata.OGWUriInfo@da8f72b x-forwarded-for 50.101.108.120

tomvanrooijen
Participant
0 Kudos

Hi Olegs,

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

regards

Tom

0 Kudos