You are on page 1of 10

SAP PI SALESFORCE BULK API

InthisblogImgoingtogiveanideahowwecanachievebulkAPIusingSOAPadapterandCCBPMinPI.
SalesforcesupportsthreeAPIsfordataintegration.1.SOAPAPI(Synchronous)Itsupportonly200records
foranyoperationslikeinsert/updateanddelete.2.RESTAPI(Synchronous)Italsosupportonly200records
foranyoperations3.BULKAPI(Asynchronous)Itsupport10,000recordspermessage.SOAPAPIalready
wellexplainedinthislinkbyPrasanna,ItriedBULKAPIbyusingSOAPadapterwithCCBPMinPI.

BULK API
Itisusefulwhenyouaretryingtobulkinsert,updateandupsertinsalesforce.Ifyourinterfaceperformsbelow
threeoperationsforsalesforcethenitperformtheBULKAPI.
1.CreateJob
2.AddJob
3.CloseJob

LogicalFlow:

Pleasecheckthelinkformoreinformation
https://www.salesforce.com/us/developer/docs/api_asynch/index_Left.htm#CSHID=asynch_api_quickstart_req
uests_intro.htm|StartTopic=Content%2Fasynch_api_quickstart_requests_intro.htm|SkinName=webhelpforbulk
API.SampleexampleprovidedinlinktoloaddatausingCURL,hereItriedtocomparetheCURLexample
withmydevelopmentinPI.

ToPerformabovestepsweneedBPMtoachieve.HereiusedCCBPMtofollowthestepsinsingleinterface.

CCBPMforBulkAPI:

Step1SalesforceLogin:
ForthiswecanuseSOAPLookupinmessagemappingtologinintosalesforcetogettheSessionIdand
ServerURL.Pleasechecklinkhttp://scn.sap.com/community/piandsoa
middleware/blog/2006/11/20/webservicecallsfromauserdefinedfunctionforSOAPLookup.

Step2CreateJob:
Beforeyousendthedatatoperformsomeoperationinsaleforce,youneedtopreparethejobbyproviding
whichoperationyouaregoingtoperformforobject.ForthatyouneedtoprepareJobxmltorequestto
salesforce.Onceyourequestsalesforce,itwillpreparethejobandprovideyoutheresponsemessagewithjobid,
byusingthisjobidyoucansendbulkdatatoperformoperationinslaesforce.

CreaterequestmappingforpreparingJob.xmlwithsoaplookupUDFtogetsessionidandassignit
dynamicallyinhttpheadersforthesoapadapter.

UDFSnippets:(Assignsessionidandcontenttypetotheheaders)

CommunicationChannel:
ChanneltosendJob.xmltosalesforce:
Httpurlhttps://instance.salesforce.com/services/async/30.0/job
HttpheadersXSFDCSessionandContentType

UseVariabletransportbindingfordynamicsessionandcontenttypeinhttpheaderswhichweassignedinUDF
(XHeaderName1&XHeaderName2).

TheresponseofthismessagewillcontainJobid,assignthisidtoBPMbyusingexportparameterizedmapping
fortheresponsemessage.
Responsemessagemapping:

UseUDFtoassignjobidtoexportparameterforCCBPM.

CreateExportparameterinmapping.

Step3AddJob:
Onceyoucompletedthestep2(createjob)inPI,youwillhavethejobidinCCBPMtosenddatatoperform
bulkoperationinsalesforce.Youneedtopreparetheaddjoburlbyappendingurlwithjobid/batch.Herewe
cansendXMLdatatoperformoperationinsalesforceobject.
CreateRequestmapping:

CCBPM:ImportParameter:

UDFSnippets:(Assignsessionid,contenttypeandhttpurltotheheaders)

CommunicationChannel:
ChanneltosendJob.xmltosalesforce:
HttpurlTServerLocation
HttpheadersXSFDCSessionandContentType

UseVariabletransportbindingfordynamicURL,sessionandcontenttypeinhttpheaderswhichweassignedin
UDF(XHeaderName1,XHeaderName2&XHeaderName3).

Step4CloseJob:
Onceabovestepscompletedwecanclosethejobusingthesamejobid.Hereweneedtopassthexmldatawith
statusclosedtosalesforceusingtheurlwithjobidtoclosethejob.

CCBPM:ImportParameter

UDFSnippets:(Assignsessionid,contenttypeandhttpurltotheheaders)

CommunicationChannel:
ChanneltosendJob.xmltosalesforce:
HttpurlTServerLocation
HttpheadersXSFDCSessionandContentType

UseVariabletransportbindingfordynamicURL,sessionandcontenttypeinhttpheaderswhichweassignedin
UDFfor(XHeaderName1,XHeaderName2&XHeaderName3).

ThisblogistojustgivingideathatSalesforcebulkAPIispossibleinPIbyusingSOAPadapter,Parameterized
mapping,BPMandvariabletransportbinding.InNextblogIwilltrytocoverstepbystepproceduretousebulk
APIinPI.
Thisismyfirstblog,Pleaseshareyourthoughts/feedbackandyoursolutiontoachieveSalesforceBULKAPI.

You might also like