SAP-ERP (Old Version) Adapter

  1. Home
  2. SAP-ERP (Old Version) Adapter
  3. 9. How to develop Outbound interface using BAPI asynchronously?

9. How to develop Outbound interface using BAPI asynchronously?


Create Customer in SAP from Salesforce using BAPI (ASYNCHRONOUS call)

Table of Contents

    1. Skyvva software landscape and building blocks
    2. Used Convention
    3. Purpose & Prerequisite for creating an outbound interface
    4. Creating Outbound Interface
      • Define BAPI and fields in the skyvva config
      • Export BAPI structure from SAP
      • Create an interface
      • Import BAPI structure
      • Query editor
      • Mapping of fields
      • Running Apex code


1. Skyvva software landscape and building blocks

Skyvva Integration Suite enables the integration between Salesforce and SAP-Backend with the native ABAP-Adapter sitting inside on SAP Backend e.g. an ECC 6.0 System with less effort and without programming neither in SAP nor in Salesforce. It is based on the generation and customizing approach to reduce effort and to accelerate the development of interfaces between these systems.

To be able to provide such a tool set and framework some component (green) has been developed by Skyvva and has to be deployed on Salesforce and SAP-Backend of the customer.

Architecture building blocks: The creation of an outbound interface is only possible when the Skyvva solution framework is set up correctly. This work has to be done beforehand by an administrator e.g. an ABAP transport has to be imported into the customer SAP-Backend system.


2. Used Convention

When talking about the direction we have to clearly define the perspective from which platform we are looking for. Since we couple two platforms Salesforce and SAP together we have to clearly define from which view we are referencing when talking about direction outbound.

Outbound and Inbound Interface

The term outbound is used when data is sent out from Salesforce to SAP. Therefore we call interfaces for sending data out of Salesforce to SAP “Outbound Interface”. For the other direction, we call interfaces “Inbound Interface” when data comes to Salesforce from SAP. So, the reference point is set to Salesforce.


3. Purpose & Prerequisite for creating an outbound interface

Purpose: The purpose of this document is to explain the necessary steps required in SAP & Salesforce to Create a Customer in SAP from Salesforce. For creating Customer we are going to use a standard BAPI(Business Application Programming Interfaces) provided by sap named as ‘BAPI_CUSTOMER_CREATEFROMDATA1’. In this BAPI we need to send the required data for the creation of customers from Salesforce.

Prerequisite :

When this prerequisite is fulfilled you can start creating outbound interfaces with the Skyvva development framework to send data from SAP to Salesforce.


4. Creating Outbound Interface

Step 1: Define BAPI and fields in the skyvva config

To create an interface you need to run the transaction /skyvva/config in SAP.

Run T-code – /n/SKYVVA/CONFIG

Below is the SAP interface configuration screen to define the interface for the transfer of data between SAP & Salesforce through BAPI or Idoc.

To create a SAP interface, Select New Entries(as shown above)

In the below screen enter a name for the field SAP interface id. This will be the name of your interface. Give a meaning full name for your interface. Then choose the value “BAPI interface” for the type(in case of Idoc select different option).

Now save your editing with the save button. You might get a popup screen to record your change for later transport. Here just can select a transport number of your choice. If you don’t know the transport number you can create a new one or contact your SAP basis administrator and ask him for a valid SAP transport number to use.

Now, need to Save in Transport request(as shown below).


Select the line(SAP interface id) and double click on BAPI int. maintenance.

It will open a new screen(as shown below), here select the option “New Entries”. This will let you to maintain the BAPI/RFC name for the interface.


The BAPI/Function Module which we provide in SAP interface is responsible for the process and its parameter is defined for the exchange of data between two systems.

Now you need to enter the BAPI/RFC name which is going to process the request from Salesforce. In this example the Function Module is  ‘BAPI_CUSTOMER_CREATEFROMDATA1’.

If a BAPI/RFC does not have many fields and all fields can be part of the Interface then select the checkbox “All Fields” as shown in this screen.

A second flag you have to check when using function module is the flag “send input”. This flag indicates the run time of Skyvva that the data should be sent via the function module call and not IDoc.


Now we need to maintain the parameter(import, export, table, changing) which we are going to send and receive back in Salesforce.

To maintain this double click on the option ‘BAPI parameters. maint.(as shown below)’ and then click on NEW ENTRY to add the parameters


Add the required number of parameters which we are going to send from Salesforce. It could be a single field or a structure. Maintain all the relevant parameters and Save it.

Note: Here, we will are using the least parameter fields required to create a customer to show the example. You can maintain multiple field as per your requirement.

To add fields for a parameter, Select the PI_COMPANYDATA and then BAPI fields

Add the required fields and SAVE.


Repeat the same step for PI_PERSONALDATA

Add the required field using F4 and Save.


Repeat the same for PI_COPYREFERENCE.


Now the necessary fields for Customers are added in the SAP interface.

Now need this information to send these fields structure to Salesforce, so that necessary mapping with could be performed in Salesforce.


Step 2:  Export BAPI structure from SAP

To use the structure in Salesforce we first need to import the configuration into XML format.



Enter the following information on the screen:

Interface: The exact name of the created Interface

Language: Depending on the language it may be possible to get the SAP field descriptions into the IStructure


Format: There are 4 different output formats:

D – Deployment Script

U – Format for XML upload

V – Format for XML upload (2)

C – CSV file (not yet supported)


The most commonly used formats of an IStructure to upload to Salesforce are either D or V. They differ in the XML structure and how they are uploaded into the SKYVVA Integration Suite in Salesforce. Structure V offers the possibility to get the SAP field description into the IStructure.

Execute and save the  XML file.


After executing this step you have an XML file that contains the SAP structure definition. The next step is to upload this structure into Salesforce.


Step 3: Create an interface in Salesforce

Goto>login>skyvva>create new Interface.


Enter the details:

1. Name: Salesforce Interface Name

2. Source name: Sap interface Name

3. Adapter: Your created adapter

4. Status: Deployed.

5. Save


Open the Interface. And Goto Related Tab.


Step 4:  Import BAPI structure

To upload the XML file and query for the selection of data to send.

Upload file and then click on the upload button and then close the pop-up, the file will be loaded.


Now after loading we can see all the SAP interface fields which we have used from parameters.

Step 5:  Query editor

Now we need to write Select Query (Note: you can either use the inbuilt query editor or you can directly write the SQL query, but make sure that SQL query should not give any error).

Based on the selected field we will map Salesforce fields with SAP.

In this example we are using Query editor. Go to Query Editor.

  1. Select Objects from where we need to fetch and send data.
  2. Select the required fields for selection.
  3. Save and Test.

In our example we have selected Account Object and final query looks like:

SELECT AccountNumber,BillingCity,BillingCountry,BillingState,Name,Fax,Id,Phone, BillingPostalCode FROM Account


Step 6: Mapping of fields.

Now Refresh the page(F5) and go to Details Tab.

And go to Mapping Tab and scroll down.

On the Left side, the Salesforce field is present and the right side SAP interface field is present.


Now we need to map the field by drag from Account and drop to SF_SAP_CUSTOMER.


After mapping, You can see the mapped fields below. SAVE the mapping

Now, Salesforce and SAP interface is ready.

To test this we need to run the apex code from Developer Console.

Open Developer Console by going to the top corner and then press the Developer Console option.


New Window will appear and press ctrl+E to open Apex editor.

Sample Apex Code.

skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl();





 String[] id1=new String[]{‘Data Record-Id’};

skyvvasolutions.CallOutResponse r=skyvvasolutions.Iservices.invokeCallout2(‘Integration Name’,’Interface Name’,id1,’SYNC’, c);

Data Record Id: Each database table in Salesforce have Id field, which is a unique identification of particular records.

Put the above Apex Code in Developer Console and replace the necessary details with actual value.

After successful execution, the response will come back from SAP with the created customer number.


Now, we can verify the created customer exists in the SAP table or not.

Go to transaction code SE16.

Enter Table Name: KNA1

Enter customer number(from above picture) in KUNNR field.

After execution, we can see a result record in the table. You can verify this record using the data sent earlier through the message monitoring.


Fandest du diesen Artikel hilfreich? Ja Nein

Wie können wir helfen?