Skip to Content
Technical Articles

SAP Integration with Salesforce using SAP PI (Proxy to SOAP) using Java Mapping

Introduction

This document provides end to end details for how to do integration between SAP ECC and Salesforce using PI with sender proxy and receiver SOAP adapter.

The document covers the Product and Account details send to Salesforce with “Upsert” operation using Java mapping with Dynamic Configuration.

 

Below is the Implementation Step.

  1. Login operation for Salesforce using java mapping.
  2. Create Header part for Salesforce “UPSERT” operation in java mapping.
  3. Dynamic URL pass to the receiver channel using dynamic configuration within the java mapping.
  4. Set attribute to sObjects node.
  5. Add fields in sObjects for the specific operation.
  6. ESR Configuration
  7. ID Configuration.
  8. Step by Step to create a .jar file for Java Mapping.
  9. Proxy creation and code for calling a proxy method in ABAP

Implementation:                                                                        

1.Login operation for Salesforce using java mapping:

First, you have to test the Login URL with a credential in SOUP UI testing tool to verify the credential. You can download the Trial version of SOUP UI and testing as per below screenshots.

You will get the session id and server URL in response which is passed at the time of “UPSERT” operation.

Login Request and Response

You have to pass the user id and password in the method which is used in java mapping.

2. Create Header part for Salesforce “UPSERT” operation in java mapping.

Here, you have to set the header part for the receiver XML payload to Salesforce which contains session id which is getting it from “Login” operation.

3.Dynamic URL pass to the receiver channel using dynamic configuration within the java mapping.

You have to pass the serverurl to the receiver channel which is getting it in Response Login payload.

You have used standard private stick final class for the Dynamic configuration.

Here, you have to specify the Dynamic Configuration object to get and put the value of dynamic configuration at run time.

4. Set attribute to sObjects node.

This step is very important to replace the value of node  <sObjects> in XML payload bcoz the Salesforce system did not recognize that which type of operation trigger along with URL within the upsert operation and you will get the error “500 internal error”.

5. Add fields within sObjects in WSDL file for the specific operation.

6.ESR Configuration

Upload the WSDL file as External Definition in PI.

Service Interface Outbound

Service Interface for Inbound

Upload .jar file in Imported Archives for Request and Response.

Java Mapping for Request

Java Mapping for Response

One to one Message Mapping for Request

One to one Message Mapping for Response

Operation Mapping – Request

Operation Mapping –  Response

7. ID Configuration.

Sender channel for proxy.

SOAP Receiver channel

Lookup Channel for Login operation.

8.Step by Step to Create a .jar file for Java Mapping.

https://blogs.sap.com/?p=861727&preview=true&preview_id=861727

9. Proxy creation and code for calling the proxy method in ABAP.

Go to t-code “SPROXY”

Double click on SI object and provide the package, prefix and Request no then click on continue button it will generate the all the object related to SI object.


SPAN {
font-family: “Courier New”;
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}

DATA : LS_UPSERT TYPE ZUPSERTREQUESTUPSERT_REQUEST,
LT_UPSERTR TYPE ZUPSERTREQUESTS_OBJECT_TAB,
LS_UPSERTR TYPE ZUPSERTREQUESTS_OBJECT,
CL_UPSERT TYPE REF TO ZUPSERTREQUESTCO_SI_SALESFORCE.
DATA : LS_UPSERTS TYPE ZUPSERTREQUESTUPSERT_RESPONSE.

DATA : LT_RESULT TYPE TABLE OF ZUPSERTREQUESTUPSERT_RESULT,LS_RESULT TYPE ZUPSERTREQUESTUPSERT_RESULT.
DATA : LT_ERRORS TYPE TABLE OF ZUPSERTREQUESTERROR,LS_ERRORS TYPE ZUPSERTREQUESTERROR.

TRY.
CALL METHOD CL_UPSERT->SI_SALESFORCE_OUTBOUND_MATERIA
EXPORTING
OUTPUT = LS_UPSERT
IMPORTING
INPUT  = LS_UPSERTS.
CATCH CX_AI_SYSTEM_FAULT INTO LO_EXE.
LV_ERROR = LO_EXE->ERRORTEXT.

ENDTRY.

Conclusion

This document helps the developer, whomsoever is not having the knowledge about Java mapping.

This document help above 7.31 version of SAP PI.

 

Thanks

Uday Vyas

&

Venkat Ramana

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.