Posting IDOC XML to SAP ERP over Skyvva SOAP Adapter
In SAP ERP we have to do the following settings
Transaction: SRTIDOC
- Execute with the default values in the transaction with the option “Register Service” selected
- Registration should be successful with the message “Registration Successful”
- If this service has already been registered, you may get the error message – “Access Address already used for Web service”.
- In such a case, this step can be ignored as the SOAP Service is already registered and running.
Transaction: SICF
Hierarchy Type: SERVICE & Execute
Navigate to Default Host –> sap –> bc –> srt –> IDoc. Right Click & Test Service
Note the URL that comes in your browser.
This is the generic endpoint for idoc xml posting to SAP.
http://host:port/sap/bc/srt/idoc?sap-client=<clientnumber>.
The following is the endpoint for our SAP system ID7 with client 800
“http://195.201.104.232:16080/sapid7/sap/bc/srt/idoc?sap-client=800”
This endpoint we will use while creating the Skyvva SOAP adapter in skyvva.
Creating the SOAP Adapter in Skyvva
We need to provide the following details to create the soap adapter
Name – Name of the adapter
Type – SOAP
Description – IDOC XML Adapter
Direction – Outbound
Status – Active
Authentication – Basic
endpoint – http://195.201.104.232:16080/sapid7/sap/bc/srt/idoc?sap-client=800
Operation – POST
PayloadFormat – XML
Username – idadmin
Password – ******
HTTP Header – Server:{!servertype}|content-type:{!type}|content-length:{!length}
Now click on save button to create the adapter.
Importing IDOC from Import SAP metadata
To Import SAP metadata first we need to create SAP Connection in skyvva as shown below
Go to Integration details tab and then select SAP Control Board
Provide the details as shown for the SAP system
In the Configuration tab. Provide the details
Here we need to provide the sap configuration details as below
Type: SAP ERP
Deployment: Embedded
Logical System: LS10
Host Url: http://xxxx.com
Port: 16xxx
Username: xxxx
Password: ******
SAPID: System Id
Client: 820
Once we provide the details we need to ping the SAP Connection. Then we can see the pop-up like its successfully connected to SAP Backend.
Now we have to provide the salesforce details as shown below.
Consumer Key and Consumer Secret we can get from the connected App.
Click on Ping Connection of Salesforce to check if its connected successfully.
With this connection. we can import the IDOC/RFC’s from SAP.
Create Metadata Provider
Create Repository
From the Repository Click on Import SAP Metadata Tab
Here we need to give the details of Connection Destination which we created earlier in the SAP Control Board and RFC destination from SAP and the Select the Application Data type IDOC/RFC.
Now click on Retrieve to create the message type from SAP
As we are using soap adapter. We have specific template for soap. Merging soap template with SAP IDOC message type.
Creating an Outbound interface:
Provide the Name, sObject type, Description, Processing mode, Status, Metadata provider, Repository, Message type, outbound adapter and the SQL statement as shown in the screenshots below
For outbound interface we have to do mapping in Skyvva as shown.
Save the interface once provide all the necessary details.
Now do the callout using below apex code:
CallOutcontrol c = new CallOutcontrol();
Map<String,String> header = new Map<String,String>(); // for HTTP Header.
header.put(‘servertype’,’Apache’);
header.put(‘type’,’text/xml; charset=utf-8′);
header.put(‘length’,’279′);
c.headerParam= header;
IServices.invokeCalloutV3(‘IDOCXML’,’IDOCXML_Out’,new String[]{‘0011X00000gUY28QAG’},’SYNC’,c);
Now we can see the message in the message monitor:
IDOC posted to SAP
And we got the acknowledgement response back from SAP to Skyvva