Skip to Content
Technical Articles

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

By Rashmi Joshi, SAP PI Consultant, Yash Technologies.

Introduction:-

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

UDF –

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

Conclusion:-

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.

6 Comments
You must be Logged on to comment or reply to a post.
      • 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.

        XI CONTENT SAP_BASIS 7.40

         

        And even UDF works very well though 🙂

         

        Regards,

        Vikas

         

         

        • 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.

          Thanks,

          Manoj