Skip to Content
Technical Articles

SAP PI/PO Salesforce integration: PATCH Requests with REST Adapter

This blog tackles a small hurdle that you might come across when your aim is to integrate an SAP system with Salesforce (SFDC) using SAP PI/PO as a middleware.

I was tasked to develop an S/4 to SFDC integration on PO using the SFDC REST API. That API is strongly making use of the http PATCH operation. This short blog explains two ways to achieve this.

Problem

In case you’re on an older PO version before 7.50 SP09, the REST adapter doesn’t support this HTTP operation:

Operations%20of%20REST%20Receiver%20Adapter

Operations of REST Receiver Adapter in the NWDS GUI

 

The Integration Directory (IB or NWDS) GUI doesn’t list the PATCH request as an option.

Solutions

There are two solutions to this:

  1. Since SP09 of PO 7.50, it is possible to issue PATCH calls in a REST receiver channel by setting an adapter module parameter (of module sap.com/com.sap.aii.adapter.rest.app/RESTAdapterBean). Unfortunately, the method was not added to the GUI, as shown above. Nevertheless, you can configure the following module parameter to enable the PATCH method in the REST receiver adapter (excerpt from SAP note 2498897 (S-user log-in required)):

    Parameter Name: 
    overrideHttpMethod

    Parameter Value:
    PATCH

    By doing this, you switch the http client library from SAP’s native to the one form Apache.
  2. Now there is another and easier option you can use in case your system is not yet on the required SP level or you maybe face other issues with the Apache library. The trick is pertaining to Salesforce (and obviously can’t be used with other receivers than that). It is applied by simply adding the parameter ?_HttpMethod=PATCH to the target URL, and selecting POST as the HTTP operation in the channel.Quoting from the SFDC docs:

    If you use an HTTP library that doesn’t allow overriding or setting an arbitrary HTTP method name, you can send a POST request and provide an override to the HTTP method via the query string parameter¬†_HttpMethod.

Conclusion

Although No. 2 is a proprietary feature of a third party vendor and SAP offers a way on patched PI/PO systems to achieve the same with their own means, it might still help the developers which are facing the above mentioned restrictions, or would like to avoid setting the adapter module parameter.

If you have questions or remarks, let me know in the comments.

Thank you,

Philippe Addor

/
Operations%20of%20REST%20Receiver%20Adapter
5 Comments
You must be Logged on to comment or reply to a post.
  • Good blog, we use the Advantco SFDC adapter to integrate with salesforce. It isn't cheap but it makes it easier.

    I have to say that the Salesforce documentation is very good. Comprehensive.

    • Thanks for your comment. Yes that's right. And there's by the way another issue when using the standard REST adapter instead of the third-party one: token caching. The built in mechanism doesn't work with Salesforce because the server doesn't response with the "expires_in" header that PO's REST adapter seems to require to do the caching. I have written an adapter module that takes over this part too. Might post it in another blog later on.