9

SAP Gateway ignored the filter pass by OData recei... - SAP Community

 4 weeks ago
source link: https://community.sap.com/t5/technology-q-a/sap-gateway-ignored-the-filter-pass-by-odata-receiver-adapter-in/qaq-p/13653882
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

SAP Gateway ignored the filter pass by OData receiver adapter in Integration Sute

sbandara

Discoverer

Saturday

Dear All,

I am trying to implement an OData API in Integration Suite and having issues passing the filter to the backend S/4HANA system. This is an end-to-end OData service (Receiver and sender). The requirement is to publish an OData endpoint to expose an OData service built in S/4 HANA using Integration Suite.

Details are :

  1. S/4 HANA development environment has two clients 400 and 411. Cloud connector has access only to client 411. OData service was developed consuming a CDS view using Eclipse in client 400 and copied to 411.

Processing mode = Routing Based and added system alias

sbandara_0-1711796825033.png

2. I tested the OData service with the following URL internally and it is giving the expected result.

https://<hostname>/sap/opu/odata/sap/ZAPI_O2_SALESORDERETA/SalesOrderETA/?$filter=(SoldToParty%20eq%...

3. iFlow has been configured with the following information.

sbandara_1-1711796905619.png

         a.Runtime configuration - Allowed Header(s) : CamelHttpQuery

sbandara_3-1711796985168.png

          b. OData sender – System generated values.

sbandara_4-1711797036026.png
sbandara_5-1711797063840.png

        c. Odata sender -Script

I tried with following two options.

if(uriInfo.getFilter() != null){

        def filter = uriInfo.getFilter();

        if(odataURI.size()!=0)

        odataURI.append(urlDelimiter);

        odataURI.append("\$filter=").append(filter);

          log.logErrors(LogMessage.TechnicalError,  "Filter value:"+filterExpression);

message.setHeader("odataEntity",entityName);

message.setHeader("odataURI",odataURI.toString());

When I do this, trace has following value for the filter.

odataURI                 : $filter=org.apache.olingo.odata2.core.uri.expression.FilterExpressionImpl@7d1f5f10

Then I tried with this

if(uriInfo.getFilter() != null){

             def filterExpression = uriInfo.getFilter().getExpressionString()

             odataURI.append(urlDelimiter);

        odataURI.append("\$filter=").append(filter);

         odataURI.append("\$filter=").append(filterExpression);

message.setHeader("odataEntity",entityName);

message.setHeader("odataURI",odataURI.toString());

Trace had the following value for the filter.

odataURI                 : $filter=(SoldToParty eq '47474' and OpenReqdDelivQtyInBaseUnit gt 0)

        d. OData receiver configuration looks like this.

Connection Address http://<hostname>:443/sap/opu/odata/sap/ZAPI_O2_SALESORDERETA

Proxy On-Premise

Authentication Basic

Credential Name – Populated with valid credential ID

Processing

Operation details : Query(GET)

Resource Path : SalesETA

HEADER DETAILS – Request Header = *

METADATA DETAILS – Customer query parameter = sap-client=411

The external endpoint is 

https://<hostname>.hana.ondemand.com/gw/odata/SAP/S4_SALESORDERETA;v=1/SalesOrderETATypeSet/?$filter=(SoldToParty eq '47474' and OpenReqdDelivQtyInBaseUnit gt 0)

Message log sys com.sap.gateway.core.ip.component.odata.exception.OsciException: Unauthorized : 401 : HTTP/1.1

It would be great if someone could help me.

Kind Regards

Shantha


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK