Skip to Content
Technical Articles
Author's profile photo Rashmi Joshi

Integrate SAP PI7.4 with SFDC(Oauth2.0)

By Rashmi Joshi, SAP PI Consultant, Yash Technologies.


This document details the steps required to enable integration between SAP ECC(On-premise) and SFDC-CRM(cloud) system, using SAP PI 7.4 middle-ware.

The business scenario is to send the quotation details from SAP ECC system to SFDC system and update the response back from SFDC to ECC. SFDC system is based on REST APIs with authentication method as OAuth2.0. To update the records on SFDC, service needs to send login request and get the access token from SFDC API. This access token needs to be updated at Header level of actual payload. With SAP PI 7.4, there is no standard adapter available to handle OAuth2.0 communication with SFDC REST APIs. Hence, used the UDF and performed REST Lookup.



Pre-requisites to start the development

  1. Network team needs to open port 443
  2. Whitelist the SFDC
  3. Deploy SFDC certificates SAP PI server
  4. Check cipher suites on SAP PI system for the compatibility
  5. Check the TLS version in SFDC and SAP PI

In order to maintain the length of document I am not attaching screen shots of ESR – Design objects. Below is the list of objects which I created in the ESR –

  1. Imported RFC for quotation from ECC system
  2. Receiver Data Type, Message Type
  3. Response Data Type, Message Type
  4. Inbound Service Interface – Synchronous
  5. Request and Response Message Mapping Programs
  6. In the request message mapping use the UDF code
  7. Operation Mapping


Provide login details at line String reqString.

Adjust below line to read the access_token key as per your service provider –


Use Dynamic configuration to create attribute Access_Token and hold the value. This will be used at receiver communication channel of ICO2.


For configuration, we need to create two ICOs. One is dummy ICO  which will be used to fetch the access token from the SFDC and UDF is used to execute it. Another ICO is used to push the actual payload with header value access_token from the first ICO.

ID Objects List –

Below are the screen shots from the Integration Builder –

ICO 1 –

This is dummy ICO where we need to configure only receiver REST communication channel to fetch the access token.

Receiver rest communication channel –

Access Token URL will be provided by SFDC team.

Set the Content-Type as per URL type provided by your SFDC team. In my case it was of type –> application/x-www-form-urlencoded

ICO 2 –

For the sender side, we have used Sender RFC Communication Channel.

Provide the appropriate receiver and operation mapping details in respective tabs of ICO.

Receiver REST Communication Channel –

Provide Service Upsert URL and set the attributes of getting value from the UDF.

Set the Attribute values at the HTTP Header level –

Save and activate ID objects and interface is ready to run.

Please follow below steps to test the interface end to end –

  1. In ECC system, go to Tcode SE37 and provide function module name –> execute it –> provide the necessary (In my case it was quotation details) –> execute
  2. In PI system, go to /PIMON page –> Adapter Engine –> Message Monitoring –> You can trace the log file here
  3. In SFDC, search the quotation and it will be updated


If you are working on lower versions (<7.5) of SAP PI/PO and not willing to pay for OEM adapter which supports OAuth2.0. then this document will be useful to achieve integration between SAP ECC and SFDC system via SAP PI/PO system using REST adapter where SFDC APIs are oauth2.0 authenticated.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Vikas Kumar Singh
      Vikas Kumar Singh


      Try using the standard oauth token functionality with Rest adapter and save Hussle of udf.



      Author's profile photo Rashmi Joshi
      Rashmi Joshi
      Blog Post Author
      As mentioned in my Blog, this feature is available from PI 7.50.
      And hence, UDF is required to achieve this scenario with lower environments.
      Author's profile photo Vikas Kumar Singh
      Vikas Kumar Singh

      Hi Rashmi,

      REST adapter is available from 7.31 SP14 / 7.4 SP9
      Oauth 2.0 native functionality is available from  7.31 SP17 / 7.4 SP12

      And, SP upgrade is not required till program changes there, for the above we can just download SAP BASIS ESR content from marketplace of latest SP for 7.4 and imported in ESR will show the feature.



      And even UDF works very well though 🙂






      Author's profile photo Manoj K
      Manoj K

      Hi Vikas ,

      Even though Rest adapter OAuth is available for version <7.5  , It supports only Concur and SAML based OAuth .

      OAuth of Grant Type and SF are purely supported in 7.5 only , AFAIK SAP does not has any plans to downgrade this feature into lower version .And as SFDC purely works in OAuth-Grant type so only alternative i can see is Using UDF , if you are using SOAP API of SFDC then we can perform soap lookup to get sessionID.

      Rashmi ,

      You don't really need dummy ICO1 , you can just create Rest Receiver channel and use the same in UDF for lookup.





      Author's profile photo Rashmi Joshi
      Rashmi Joshi
      Blog Post Author

      Thanks for the feedback Manoj K

      Will give a shot without ICO1 to try this option...




      Author's profile photo Dimitri Sannen
      Dimitri Sannen

      Hi Rashmi,

      Any feedback on this one? I’m trying to understand if we need to purchase a 3rd party adapter for our SFDC integration or not.

      Thanks a lot.


      Author's profile photo Rajesh PS
      Rajesh PS

      Nice Blog Rashmi. Keep it Up!

      Author's profile photo Dimitri Sannen
      Dimitri Sannen

      Hi Rashmi,

      When I read this blog, SFDC integration seems easy using a REST adapter on SAP PO. But you need to use the SFDC REST API, OUath 2.0 authentication and the most recent SAP PO release (7.5), right?

      So, no need for a 3rd-party adapter, like e.g. Advantco.

      Kind regards,

      Author's profile photo Rashmi Joshi
      Rashmi Joshi
      Blog Post Author

      Hi Dimitri Sannen ,

      For my version of PI, rest adapter was not supporting OAUTH2.0 authentication. Hence I had to use UDF.

      Yes, with higher version of SAP PO 7.5 SP07 SAP made this feature available.

      Hence, no need for 3rd-party adapter like Advantco.



      Author's profile photo Juan Edmundo Vargas Vasquez
      Juan Edmundo Vargas Vasquez

      Hi Rashmi Joshi

      Thank you very much for the post!.
      Necessary if you can please put the complete UDF code.
      Also, you are talking about modifying a line to get the access_token, where should that code be put?
      Greetings and thanks again for the response.!
      Author's profile photo Diego Mesa
      Diego Mesa

      Thanks very much post!

      Author's profile photo Sebastian Alvarez
      Sebastian Alvarez

      Thank you very much! I have a question, what would be the implementation if I have a REST Sender and I have to receive the Bearer Authorization?

      Author's profile photo Dimitri Sannen
      Dimitri Sannen

      Hi Rashmi Joshi,

      Can you share the UDF code please? Obviously leave out the client_id, client_secret, …
      You provided a screenshot, but that makes copy/paste impossible.

      ‘m currently battling to get Salesforce integrated with SAP PO 7.5

      Getting the Bearer token with the receiver REST adapter is no problem, but I received a SOAP end point. Therefore, I’m going to try to get the token from the message mapping onwards.