Using the Run standard workflow action from the SAP BAPI package,
build a bot that retrieves data from SAP systems.
Prerequisites
Download the SAP Java connector and DLL from the SAP website.
In this tutorial, you will build a bot that uses the Run standard
workflow action. The Run standard workflow action provides a user interface that
enables you to select BAPIs and configure the parameters for the selected BAPI.
By using this single SAP BAPI package action, you will perform the
following actions:
- Select a BAPI (BAPI_FLIGHT_CHECKAVAILABILITY) from a list of
function modules available in the connected SAP system.
- Set values for the import and export parameters of the selected BAPI.
- Assign retrieved structure or tables to dictionary or table variables.
When executed, the bot gets flight availability data based on the
input data, and writes it to a CSV file.
Procedure
-
Create a bot named
SAP-BAPI-CheckFlightAvailability.
-
Log in to the Control Room.
-
On the left pane, click Automation.
-
Click the Create a bot icon.
-
In the Name field, enter
SAP-BAPI-CheckFlightAvailability, and click
Create & Edit.
-
To connect the bot to your SAP system, from the
Actions panel, find action and add it to the Bot editor.
-
In JCo: SAP Java Connector package, specify the
path to the Java connector .jar file.
-
In JCo DLL dependency, specify the path to the
DLL file.
-
Choose Custom Application Server as
Connection Type.
-
In Application server host name, specify the
host name of the SAP application server.
Note: As a best practice, use the
Credential Vault to specify sensitive information
such as host name, user name, and password.
-
In System number, enter the instance
number.
-
In SAP instance system ID, enter the system
ID.
-
In Client number, enter the client number.
-
In Logon language code, enter
EN or the language specific to your
system.
-
In Router string, enter the SAP router
string.
-
In Username, enter your SAP user name.
-
In Password, enter your password.
-
Run the bot to test the connection.
If the specified connection properties are correct, the bot is
executed successfully.
-
From the Actions panel, find action after the Connect action.
-
Select a BAPI.
-
Click the Select workflow option.
-
In the Standard BAPI Selector window, from
Select Standard BAPI, expand SAP
Modules.
-
Find and expand Flight with connection data (SAP
training).
-
In Flight with connection data (SAP training),
expand , select
BAPI_FLIGHT_CHECKAVAILABILITY, and then click
Select.
-
Specify values for the fields in the import parameter. Do the following in
Import to BAPI:
-
Click the vertical ellipsis option for the
AIRLINEID field, and select
Edit.
-
In Value, enter DL and
click Apply.
-
Click the vertical ellipsis option for the
CONNECTIONID field, and select
Edit.
-
In Value, enter 1699 and
click Apply.
-
Click the vertical ellipsis option for the
FLIGHTDATE field, and select
Edit.
-
In Value, enter 20170418
and click Apply.
The Java connector for SAP systems takes the date values in the
yyyymmdd format.
BAPI_FLIGHT_CHECKAVAILABILITY returns data in the
AVAILABILITY export parameter, which is of the type
structure.
-
In Export to BAPI, perform the following steps:
-
Click the ellipsis option for the AVAILABILITY
field.
-
On the Availability window, select the
Field name check box to select all fields
within the structure, and then click Apply.
-
Store the data that the BAPI exports to a variable.
-
In Save exported structures and scalars, create
a variable by clicking (x) and name it
ReturnStructure.
-
In Save exported structures and scalars, create a
variable by clicking (x) and name it
ReturnStructure.
-
Save the Run standard workflow action.
-
Convert the exported data to a table.
-
From the Actions panel, find action, and add it after the Run standard
workflow action.
-
Click inside Dictionary variable and select
ReturnStructure.
-
In Key, enter
AVAILABILITY.
-
In Assign the output to variable, create a
variable by clicking (x) and name it
Availability.
-
To write the data from the retrieved table to a CSV file, add the action.
-
In Data table, select
Availability.
-
In Enter file name, specify the path to the CSV
file, to which you want to write the data.
-
Select Create folders/files if it doesn't
exist.
-
Click Overwrite existing file.
-
Save and run the bot.