39
Sales force Integration Sridhar Barla

Salesforce and sap integration

  • View
    3.074

  • Download
    1

Embed Size (px)

DESCRIPTION

This is topic is presented by Sridhar Barla (Technical Lead at GE) in Chennai salesforce platform developer meetup

Citation preview

Page 1: Salesforce and sap integration

Sales force Integration

Sridhar Barla

Page 2: Salesforce and sap integration

Agenda

Page 3: Salesforce and sap integration

Agenda

Platform APIs : Breif History

– SOAP

– Bulk

– REST

– Also : calouts & APEX WS

Intégration use case for SOAP API

– Intégration Sales force Data with SAP

– Intégration sales force data with Primavera

Page 4: Salesforce and sap integration
Page 5: Salesforce and sap integration
Page 6: Salesforce and sap integration

SOAP APIintegration

Page 7: Salesforce and sap integration

Create a middle ware web service in .Net

2003/2005/2008/2010

Add Sales force WSDL (Enterprise /Partner ) file as

web reference in middle ware web service

Create a Web method As

Get_Quote()

Implement logic to read data from quote object

Page 8: Salesforce and sap integration

Read data from SFDC

Page 9: Salesforce and sap integration

SforceService sobj = new SforceService();

System.Net.NetworkCredential cr = new

System.Net.NetworkCredential(“sridhar", "taralika", “chennai");

System.Net.WebProxy proxy = new System.Net.WebProxy("http-proxy-

sample.com", 80);

proxy.Credentials = cr;

sobj.Proxy = proxy;

LoginResult lr = sobj.login(“[email protected].",

“testpasswordplusRFwWSPB4PPjWdjpDO3VC2yts");

sobjj.Url = lr.serverUrl;

sobj.SessionHeaderValue = new SessionHeader();

sobj.SessionHeaderValue.sessionId = lr.sessionId;

QueryResult quoteDetails = null;

sobj.QueryOptionsValue = new QueryOptions();

sobj.QueryOptionsValue.batchSize = 1000;

sobj.QueryOptionsValue.batchSizeSpecified = true;

Page 10: Salesforce and sap integration

string sforceQuery = "Select

ID,NAME,RECORDTYPEID,RecordType.Name,PARENTID,OWNERI

D,CREATEDDATE,CREATEDBYID,LASTMODIFIEDDATE,LASTMO

DIFIEDBYID,SAPREF__C,

ACCOUNTACTIVITYSTATUS__C,ACCOUNTCOUNTRY__C,DUNS

NUMBER__C,REPRESENTATIVE__C,COMPETITOR__C,OEM__C,

ENDUSER__C,EPCDESIGNINSTITUTE__C,KEYACCOUNT__C,FL

OW_BUSINESS_ACCOUNT__C,OTHERTYPEACCOUNT__C,INDU

STRY__C,CVTUNIT__C from Quote__C";

quoteDetails = sobj .query(sforceQuery);

Page 11: Salesforce and sap integration

bool bContinue = true;

while (bContinue)

{

if (quoteDetails .records != null)

{

if (quoteDetails .records.Length > 0)

{

quoteListObj.Add(quoteDetails );

//handle the loop + 1 problem by checking the most recent queryResult

if (quoteDetails .done)

bContinue = false;

else

quoteDetails = sobj .queryMore(accDetails.queryLocator);

}

}

else

{

bContinue = false;

}

}

Page 12: Salesforce and sap integration

Access Middle ware in SAP

Page 13: Salesforce and sap integration

Make sure, that the proxy configuration is ok. In SAP

other wise you won’t have a chance to connect to an

external web service.

To check proxy settings use SM59 transaction code

Page 14: Salesforce and sap integration

Create Consumer Proxy in SAP

At first you have to generate a consumer proxy. A proxy

class will be generated

Generation can be triggered out of SE80:

Page 15: Salesforce and sap integration
Page 16: Salesforce and sap integration
Page 17: Salesforce and sap integration
Page 18: Salesforce and sap integration

In the following dialogue you have to input the WSDL, in

order that the proxy settings can be retrieved

automatically

Page 19: Salesforce and sap integration

The following screenshot display the consumer proxy.

For our example, the default settings are o.k.

Page 20: Salesforce and sap integration

Next step is to create a logical port

The logical port is necessary to call the external web

service. You create the logical port with transaction

SOAMANAGER.

Within SOAMANAGER you have to go for the Single

Service Administration:

Page 21: Salesforce and sap integration
Page 22: Salesforce and sap integration

Within SOAMANAGER you have to select the

respective web service

Page 23: Salesforce and sap integration

After applying the selection, you just push the button for creation of logical port and use the default setting. Be

sure to input the correct URL for the WSDL into the creation dialogue and write down the logical port name.

This will be used in your ABAP coding. Also make sure, that the proxy settings are entered

Page 24: Salesforce and sap integration

ABAP Coding

The following sample coding consumes the external

web service. It uses the created consumer proxy and

the logical port to request the quote for the symbol

SAP. After successful calling, the structure out keeps

the actual values for the SAP stock.

Page 25: Salesforce and sap integration
Page 26: Salesforce and sap integration

SAP integration

Integrate Sales force and SAP with using middle ware

technology as .NET

SAP .NET connector– SAP connector 2.0

– SAP connector 3.0

Sales force WSDL (Enterprise /Partner )

Page 27: Salesforce and sap integration

SAP connector versions and .NET versions

SAP connector 2.0 supports Visual studio .NET 2003

only and this connector supports XP not windows 7

SAP connector 3.0 supports all Visual studio versions.

Page 28: Salesforce and sap integration

SAP connector 2.0

Download SAP connector from service.sap.com/connectors and install

Open visual studio 2003 and createa class Library project as SAPProxyLib

Page 29: Salesforce and sap integration

After you add the proxy, you will notice that the system automatically adds the

necessary references to your project as well as creates a WSDL file

called SAPProxy1.wsdl. This file will show up as a blank screen in Visual Studio, as

shown in figure below:

Page 30: Salesforce and sap integration

Once the proxy has been added, it's time to add the SAP Server to your project. Click View,

then click Server Explorer and you will see that an option for SAP is included in the list. Click

the SAP entry and it will expand and show "Application Servers". Right click this and select

"Add Application Server". A dialog box similar to Figure below will appear

Page 31: Salesforce and sap integration

This is where you will need to set your parameters for establishing a

connection to your SAP server. Change the Destination Type property to

“Custom”, then add the necessary values for the following properties:

– User Name

– Password

– AppServerHost

– SAPRouterString

– HTTP Port

– Client

– System Number

These variables will depend on your SAP installation. Check with

your SAP Administrator for the specific settings in your environment.

Page 32: Salesforce and sap integration

Once you have the properties set, you can then establish your connection to SAP.

Expand the new server, then expand the Functions entry. This will provide a list of

all ABAP functions that are contained in your SAP environment. See figure below:

Page 33: Salesforce and sap integration

The next step is to locate the function that you wish to call. When you find it, simply

drag and drop it onto theSAPProxy1.sapwsdl file. It will automatically create several

objects and even code files that relate to your particular function (note that you need

to be viewing all files in your project to see the code files that the process creates):

Page 34: Salesforce and sap integration

Right click the solution and Build the project

Then system generate dll like SAPProxyLib.dll

This class library you can use any .NET version

application

Page 35: Salesforce and sap integration

Create new website in VS2010

Add web reference Sales force WSDL (Enterprise

/Partner )

Add reference SAPProxyLib.dll

Page 36: Salesforce and sap integration

Read data from SAP

Page 37: Salesforce and sap integration

SAPProxyLib.SAPProxy1 BAPI = new SAPProxyLib .SAPProxy1();

DataSet salesOrder = new DataSet();

string conStr = "ASHOST=xx.xx.xx.xx SYSNR=0 CLIENT=10 USER=IM_SREE

PASSWD=sappass LANG=EN";

BAPI = new SAPProxyLib .SAPProxy1(conStr);

System.Net.NetworkCredential cr = new System.Net.NetworkCredential(“1236456",

“password", “chennai");

System.Net.WebProxy proxy = new System.Net.WebProxy(“proxyservername", 80);

proxy.Credentials = cr;

BAPI.Proxy = proxy;

BAPI.Connection.Open();

SAPProxy1.BAPIRET2 ret = new SAPProxy1.BAPIRET2();

SAPProxy1.ZPROJOUT proj = new SAPProxy1.ZPROJOUT();

SAPProxy1.ZPROJOUTTable prjOut = new SAPProxy1 ZPROJOUTTable();

BAPI.Zbapi_Proj_Sales_Details(startdate, ref prjOut);//

if (prjOut.Count > 0) {

salesOrder.Tables.Add(prjOut.ToADODataTable());

if (salesOrder.Tables[0].Rows.Count > 0) {

foreach (DataRow salesDetails in salesOrder.Tables[0].Rows) {

}

Page 38: Salesforce and sap integration

Read Data from SAP with using SAP connector 3.0

Page 39: Salesforce and sap integration

using SAP.Middleware.Connector;