Posting BAPI to SAP ERP from salesforce using Skyvva REST Adapter
In SAP ERP we have to do the following settings
How to Activate the Skyvva service in SAP using Tcode SICF.
Introduction:- #
In this chapter, you will learn about the “Activation of Skyvva service in sap”. The service is used to send & receive data from SAP <> salesforce .
Activation of Skyvva service in Tcode SICF #
Once you have installed the Skyvva package(TR) all Internet Communication Framework (ICF) services are available in an inactive state for security reasons. After the installation you have to decide which services must be activated for the applications you want to use.
Since multiple services can be executed when you call a URL, all service nodes must be activated in the SICF tree. The URL path is mapped in ICF subnodes (services). For example, if you want to activate the services for URL /default_host/sap/bc/skyvva/, you have to activate the service tree default_host in transaction SICF. Then you have to activate services sap, bc and skyvva separately.
You activate an ICF service as follows:
- Select the required ICF service in the ICF tree in transaction SICF.
- Activate the ICF service in one of the following ways:
- Using menu option Service/Host -> Activate
- Using the context menu and choosing Activate Service.
Services for Skyvav #
For skyvva ABAP the following services must be activated in the system.
Using skyvva Applications #
/default_host/sap/public/ping
This node itself must be activated, for ping service.
/default_host/sap/bc/skyvva/
Here only the node itself must be activated, and not the subnodes.
/default_host/sap/bc/skyvva/v3/
This node is activated automatically when the subnodes described below are activated. Likewise, here only the node itself must be activated, as well as the following subnodes: #
/default_host/sap/bc/skyvva/v3/cache
/default_host/sap/bc/skyvva/v3/ GetBapiDetail
/default_host/sap/bc/skyvva/v3/ GetIdocSegField
/default_host/sap/bc/skyvva/v3/ GetIdocSegList
/default_host/sap/bc/skyvva/v3/ GetObjCount
/default_host/sap/bc/skyvva/v3/ GetObjectList
/default_host/sap/bc/skyvva/v3/ GetPartnProfile
/default_host/sap/bc/skyvva/v3/ GetQualifier
/default_host/sap/bc/skyvva/v3/ GetTabFieldList
/default_host/sap/bc/skyvva/v3/ restoreendpoint
- Activate All the service as shown below.
We will get the endpoint and request and response JSON payloads from SAP. By using that we have to create message type in Skyvva.
Creating the REST Adapter in Skyvva
We need to provide the following details to create the REST adapter
Name – Name of the adapter
Type – REST
Description – BAPI REST Adapter
Direction – Outbound
Status – Active
Authentication – Basic
endpoint – http://195.201.104.232:16080/sapid7/sap/bc/skyvva_sf/createso?sap-client=820
Operation – POST
Request and Response Format – application/json
Username – idadmin
Password – ******
Now click on save button to create the adapter.
Create Metadata Provider –
Create Repository –
Create Message type –
Creating the message type using the following JSON payload.
Request Structure:
{
“ARRAY”: [
{
“TYPE”: “S”,
“ID”: “V4”,
“NUMBER”: “233”,
“MESSAGE”: “SALES_HEADER_IN has been processed\r\nsuccessfully”,
“LOG_NO”: “”,
“LOG_MSG_NO”: “000000”,
“MESSAGE_V1”: “VBAKKOM”,
“MESSAGE_V2”: “”,
“MESSAGE_V3”: “”,
“MESSAGE_V4”: “”,
“PARAMETER”: “SALES_HEADER_IN”,
“ROW”: 0,
“FIELD”: “”,
“SYSTEM”: “CNT_DEV820”
},
{
“TYPE”: “S”,
“ID”: “V4”,
“NUMBER”: “233”,
“MESSAGE”: “SALES_ITEM_IN\r\nhas been processed\r\nsuccessfully”,
“LOG_NO”: “”,
“LOG_MSG_NO”: “000000”,
“MESSAGE_V1”: “VBAPKOM”,
“MESSAGE_V2”: “000010”,
“MESSAGE_V3”: “”,
“MESSAGE_V4”: “”,
“PARAMETER”: “SALES_ITEM_IN”,
“ROW”: 1,
“FIELD”: “”,
“SYSTEM”: “CNT_DEV820”
},
{
“TYPE”: “S”,
“ID”: “V1”,
“NUMBER”: “311”,
“MESSAGE”: “Standard\r\nOrder 20469 has been saved”,
“LOG_NO”: “”,
“LOG_MSG_NO”: “000000”,
“MESSAGE_V1”: “Standard\r\nOrder”,
“MESSAGE_V2”: “20469”,
“MESSAGE_V3”: “”,
“MESSAGE_V4”: “”,
“PARAMETER”: “SALES_HEADER_IN”,
“ROW”: 0,
“FIELD”: “”,
“SYSTEM”: “CNT_DEV820”
}
] }
Use the above messagetype while creating the outbound and inbound interface.
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.
Create Inbound response interface:
Do the mapping as shown
Now do the callout using below apex code:
skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl();
c.returnXml=true;
c.returnListRecord=true;
c.isCreateMessage=true;
c.actionDoIntegrate=true;
String[] ids=new String[]{‘0Q0f0000000ASn6CAG’};
skyvvasolutions.Iservices.invokeCalloutV3(‘BAPIXML_REST’,’BAPI_SalesOrder_Out’,ids,’SYNC’, c);
Now we can see the message in the message monitor: