1. Home
  2. Dokumente
  3. SAP-ERP, S4/HANA Adapter
  4. 22. How to invoke SAP REST API using Skyvva REST Adapter?

22. How to invoke SAP REST API using Skyvva REST Adapter?

Posting BAPI XML to SAP ERP over 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:

  1. Select the required ICF service in the ICF tree in transaction SICF.
  2. Activate the ICF service in one of the following ways:
  3. Using menu option Service/Host  ->  Activate
  4. 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:

{

  “DocType” : “TA”,
  “SalesOrg” : “1000”,
  “DistrChan” : “12”,
  “Division” : “00”,
  “NvHeaderToOrdItem” : [
    {
      “ItmNumber” : “000010”,
      “Plant” : “1000”,
      “Material” : “1400-300”,
      “TargetQty” : “100.000”,
      “NvOrdItemToSchLine” : [
        {
          “ItmNumber” : “000010”,
          “ReqQty” : “100.000”,
          “ReqDate” : “2020-08-23T12:34:56”
        }
      ]
    }
  ],
  “NvHeaderToPartners” : [
    {
      “PartnRole” : “AG”,
      “PartnNumb” : “0000002300”
    }
  ],
  “ReturnSet” : [{
  “Type” : “”,
  “Message” : “”,
  “MessageV1” : “”
  }]
}
Response 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”
}
] }
Now create the message type using the above payloads along with the rest template.

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:

 

 

 

 

Fandest du diesen Artikel hilfreich? Ja Nein

Wie können wir helfen?