SAP-ERP (Old Version) Adapter

  1. Home
  2. SAP-ERP (Old Version) Adapter
  3. 19. How to invoke BAPI XML using Agent SAP ERP Adapter?

19. How to invoke BAPI XML using Agent SAP ERP Adapter?

[add-search-inside]

Posting BAPI XML to SAP ERP over Skyvva Agent SAP ERP Adapter

In SAP ERP we have to do the following settings

Calling RFC-enabled Function Modules over HTTP from external application

As a prerequisite, go to transaction SICF and locate the following service: sap -> bc -> soap -> rfc. Its description gives you some more details about the functionality: SOAP HTTP HANDLER FOR RFC-CAPABLE FUNCTION MODULES.

Now, right-click on that service and choose Test Service, and make sure that you allow SAP to open your web browser (in a popup that appears). Make note of the URL that is opened in the browser. Generally, this URL would look as follows:

http://[hostname]:[SICF port]/sap/bc/soap/rfc?sap-client=[client]

 

It’s a central endpoint for all BAPI’s. Now that we know the communication URL use an HTTP client to communicate with SAP. In this example, I will use the SOAP UI tool for this purpose, but it can be any application.

Importing BAPI/RFC’s 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 for the connection destination like Name, Description and Type as shown below.

 

 

In the Salesforce->AGENT tab. Provide the details of Agent

Host Url: http://xxxx.com

Port: 90**
Username: xxxx
Password: ******

 

 

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.

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 select the SAP Connection through the Agent and select Adapter type  which we created earlier in the Agent Control Board and Select the Application Data type BAPI/RFC’s and then Select create message type to call in BAPI in SAP.

Click on Retrieve after selecting all the above details as shown in the screenshot.

 

 

Select the BAPI name to create message type

 

 

Below is the message type template for BAPI

 

 

This message type we use in the outbound interface and inbound interface

 

Creating the Agent SAP ERP Adapter in Skyvva

We need to provide the following details to create the Agent SAP ERP adapter

Name – Name of the adapter

Type – Agent SAP ERP

Description – IDOC XML Adapter

Direction – Outbound

Status – Active

objectFormat – BAPI

Connection Destination: Agent Window SAP

Salesforce Id Handling – It means the salesforce Id will come back along with the Response message to update the existing account in order to avoid the new record creation.

Now click on save button to create the adapter.

Creating an Outbound Request 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 and point to Response in the response interface.

In our example BAPI_CUSTOMER_CREATEFROMDATA1 is the root message type as shown below.

 

 

 

 

Add the response interface in the request interface.

For outbound interface we have to do mapping in Skyvva as shown.

 

 

Save the interface once provide all the necessary details.

Creating an Inbound Response Interface:

Provide the Name, sObject type, Description, Processing mode, Status, Operation Type, Metadata provider, Repository, Message type as shown in the screenshots below

Do the inbound mapping as shown below.

We have to map the Id field in the response mapping to get the Id back in the response message. For the below example we don’t have Id field in the source side so we are going to map Id with functions as shown below.

 

Now we have to synchronize the cache to push the Integration, Interface, Adapter and Mapping to Agent H2 table.

For that we have to go to cache Monitor in that select Object Name and Integration Name and Status and then click on Synchronize Cache.

 

Now click on Yes to Synchronize the Cache

 

 

Now click on Refresh

 

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[]{‘001f000001bN527AAC’};
skyvvasolutions.Iservices.invokeCalloutV3(‘SAP ERP Integration App V1′,’BAPIXML_Out’,ids,’SYNC’, c);

 

Now we can see the message in the message monitor:

 

Expand the response interface dropdown to see the message Id.

We can see the salesforce Id coming in the response message along with the customer number.

Click on Related to as shown in below screenshot

 

Then we can see the updated customer ID in SKYVVA as shown below

 

 

Fandest du diesen Artikel hilfreich? Ja Nein

Wie können wir helfen?