+ Start a Discussion
Roopa SarathkumarRoopa Sarathkumar 

Salesforce Integration With SAP

Hi Gurus,

I am new to Salesforce and learning new skills. Need some details regarding integrating SAP and Salesforce.

I have created a interface using SAP PI(with SAP ECC) .. its a SOAP to RFC synchronous interface, created a WSDL.

Tested the WSDL using SOAP UI, its working perfectly fine.

In Salesforce, I have created a Apex Class using that WSDL. Now, I need to know how to call this service.

Can anyone Help ?? ( I will provide the Apex Class generated from WSDL)

Regards,
Roopa





Grazitti TeamGrazitti Team
Hi,

Please see the below link:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50a76cfa-4966-2d10-aba7-da496d9b5bcf?QuickLink=index&overridelayout=true&48636210042836

Hope it solves your problem.

Regards,
Grazitti Team
Roopa SarathkumarRoopa Sarathkumar
Hi ,

Thanks for the information, but in that link is for SAP Service consumer, but here SAP is service provider.
Shri RajShri Raj
From which system are you planning to make the first call? SAP -- > Salesforce or viceversa?
Roopa SarathkumarRoopa Sarathkumar
Hi Shri,

I need to call SAP From Salesforce .. Salesforce --> SAP ..

Below is the Apex Class..  I think, I should be calling Si_Flight_ObPort Method, but not sure how to call and pass the parameters ( Paremeters ex Carrid = 'LH', Connid = '400', Date'20140901')

public class ramanWsToRfc {
    public class Flight_element {
        public String Carrid;
        public String FlightName;
        public String Connid;
        public String Date_x;
        public String ArpFrom;
        public String CityFrom;
        public String ArpTo;
        public String CityTo;
        private String[] Carrid_type_info = new String[]{'Carrid','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] FlightName_type_info = new String[]{'FlightName','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] Connid_type_info = new String[]{'Connid','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] Date_x_type_info = new String[]{'Date','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] ArpFrom_type_info = new String[]{'ArpFrom','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] CityFrom_type_info = new String[]{'CityFrom','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] ArpTo_type_info = new String[]{'ArpTo','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] CityTo_type_info = new String[]{'CityTo','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:Raman_Ws_To_RFC','false','false'};
        private String[] field_order_type_info = new String[]{'Carrid','FlightName','Connid','Date_x','ArpFrom','CityFrom','ArpTo','CityTo'};
    }
    public class Dt_Flight_Res_Ib {
        public ramanWsToRfc.Flight_element Flight;
        private String[] Flight_type_info = new String[]{'Flight','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:Raman_Ws_To_RFC','false','false'};
        private String[] field_order_type_info = new String[]{'Flight'};
    }
    public class Dt_Flight_Req_Ob {
        public ramanWsToRfc.Flight_element Flight;
        private String[] Flight_type_info = new String[]{'Flight','urn:Raman_Ws_To_RFC',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:Raman_Ws_To_RFC','false','false'};
        private String[] field_order_type_info = new String[]{'Flight'};
    }

public class Si_Flight_ObPort {
        public String endpoint_x = '*******************************************************************';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'urn:Raman_Ws_To_RFC', 'ramanWsToRfc'};
        public ramanWsToRfc.Flight_element Si_Flight_Ob(ramanWsToRfc.Flight_element Flight) {
            ramanWsToRfc.Dt_Flight_Req_Ob request_x = new ramanWsToRfc.Dt_Flight_Req_Ob();
            request_x.Flight = Flight;
            ramanWsToRfc.Dt_Flight_Res_Ib response_x;
            Map<String, ramanWsToRfc.Dt_Flight_Res_Ib> response_map_x = new Map<String, ramanWsToRfc.Dt_Flight_Res_Ib>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://sap.com/xi/WebService/soap1.1',
              'urn:Raman_Ws_To_RFC',
              'Mt_Flight_Req_Ob',
              'urn:Raman_Ws_To_RFC',
              'Mt_Flight_Res_Ib',
              'ramanWsToRfc.Dt_Flight_Res_Ib'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.Flight;
        }
    }
Shri RajShri Raj
I think you can do it using SOAP API. Since the first call is from the Salesforce, Please do the following. 
1) Take the WSDL from the SAP System. 
2) Login into Salesforce. Setup --> Apex Classes --> Generate WSDL. 
3) Bascially, You need to parse SAP's WSDL into Salesforce. By default it would create multiple Apex classes inside Salesforce. 
4) You need to check those classes, provide the credentials, Endpoint, and perform the insert/update/delete operations. 

Refer to SOAP API inside Salesforce. There are lot of documents and examples online. 
http://www.salesforce.com/us/developer/docs/api/index.htm
peter ha 3peter ha 3
Hi Roopa,

check out this SAP certified Salesforce adapter for PI:
 http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/05/02/salesforce-adapter-for-sap-pipo

kind regards.
Roman Kucak 3Roman Kucak 3
Pls. also check out this article on sap and salesforce integration (http://j.mp/SFDC_SAP_integration).
Bushra SalmanBushra Salman
this might help

https://forcefixes.blogspot.com/2017/12/apex-outbound-integration-using-apex.html