Posting IDOC XML to SAP S/4 HANA over Agent S/4 HANA Adapter
Importing IDOC from Import SAP metadata
To Import SAP metadata first we need to create Agent Connection in skyvva as shown below
Go to Integration details tab and then select Agent Control Board
Provide the details as shown for the Agent and the SAP system
In the Configuration tab. Provide the details
Once we provide the details we need to ping the Agent Connection. Then we can see the pop-up like its successfully connected to Agent.
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.
Next provide the SAP details like
Host URL, Port, Username, Password, the reverse proxy path, SAP system client and the logical system name as shown below.
Here we need to provide the sap configuration details as below
Type: Agent S/4 HANA
Logical System: tr5
Host Url: http://xxxx.com
Port: 16xxx
Username: xxxx
Password: ******
SAPID: System Id
Client: 820
Click on Ping SAP connection from Agent if its connected successfully or not
Again provide the details of Agent
Click on ping connection of Agent
Save the connection after entering all the required details
Create Metadata Provider
Create Repository
From the Repository Click on Import SAP Metadata Tab
Here we need to give the details of connection type, Connection Destination which we created earlier in the SAP Control Board and the Select the Application Data type IDOC
Now click on Retrieve to create the message type from SAP
Here is the IDOC template. Here we need message type for both Request and Response also to get the IDOC number back from SAP and to show it in Skyvva Monitor. But we use only Request message type while creating the outbound interface.
Creating the Agent S/4 HANA Adapter in Skyvva
We need to provide the following details to create the soap adapter
Name – Name of the adapter
Type – Agent S/4 HANA
Description – Agent S4 test Adapter
Direction – Outbound
Status – Active
objectFormat – IDOC
Connection Destination – It means the SAP Connection which we created earlier for the backend connection – agentSapS/4Hana
Now click on save button to create the adapter.
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
In the message type we have to select the root message type then it will automatically point to Request in the request interface
In our example DEBMAS.DEBMAS07.ZNBDEBMAS is the root message type as shown 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:
Cskyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl();
c.returnXml=true;
c.returnListRecord=true;
c.isCreateMessage=true;
c.actionDoIntegrate=true;
String[] ids=new String[]{‘0013E00001DKgY9QAL’};
skyvvasolutions.Iservices.invokeCalloutV3(‘IDOCXML’,’IDOCXML_Out’,ids,’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 in Skyvva message monitor in the comment section like IDOC got created in SAP.
This IDOC number we can search in the Business external ID
We have also a Copy node function in Skyvva. Copy node is used to duplicate the segment if needed.
In our example we have duplicated the segment for one time
Now we can see the repeated segments in SAP as well as shown below.
This is the functionality of Skyvva copy node.