SAP integration example

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Integrate > Application integration > SAP connector >

SAP integration example

Overview

In the following section, we will illustrate how to integrate Bizagi with SAP without the need of programming.

This integration is easily set up through the out-of-the-box feature in Bizagi called the SAP connector.

 

Before moving on, make sure you have already installed the SAP.NET assemblies, as required by this type of integration.

For detailed information and requirements about the SAP connector, refer to SAP connector.

 

Example: Flight module

In this example, we will integrate the SAP R/3 (mySAP) Flight Module in a Bizagi process.

Our goal is to create a process in Bizagi in which users can search for a given flight and then book it (done in Bizagi through 2 different integration points).

We model our Bizagi process and call it the Flight Booking process, as shown:

 

Model_obj

The basic outline of this process is:
1. First, a petitioner starts the process to search for a flight that meets his or her requirements (date ranges, origin, destination).

In this same first activity called Request flight, Bizagi will fetch those available flights directly from SAP and present the results (upon the clicking of a button).

 

2. The second activity called Approve flight is assigned to an approver, who receives this request and approves or rejects it.

 

3. If approved, Bizagi books the flight (this integration ends up creating a new record in SAP), through an asynchronous task called Book flight in SAP.

 

note_pin

For more information on the flight module that comes installed in SAP for educational purposes, refer to http://wiki.scn.sap.com/wiki/display/ABAP/Flight+Data+Application+-+Demo+Example+for+Integration+Technologies.

 

Steps

We have divided this example and exercise into 3 major steps:

 

Preparation.

In this step we basically illustrate how to identify which parameters are involved both to send, and to receive information from SAP (especially as a helpful guide for people who are not necessarily SAP experts).

We will look up everything relevant to the functions in SAP we integrate, mainly through the options provided by SAP Logon.

It illustrates the design considerations of our Bizagi data model in this example as well.

 

Configuration of the connection.

We will illustrate how to configure the connection to your SAP system.

This step is only need once.

 

Configuration of the BAPIs invocation.

We will illustrate how to configure the invocation of SAP BAPIs from any part of your process.

In this example, we invoke 2 different BAPIs:

To search for flights, we rely on the BAPI wrapper called BAPI_FLIGHT_GETLIST.

To book a flight, we rely on the BAPI wrapper called BAPI_FLBOOKING_CREATEFROMDATA.

 

 

note_pin

Keep in mind that for the Configuration of the BAPIs invocation, you should have already installed the required SAP.NET assemblies, as described at SAP connector (otherwise, Bizagi Studio won't be able to connect to your SAP system).

 

 

Preparation

We will need to explicitly identify first, the relevant needed information in order to use the BAPI_FLIGHT_GETLIST and BAPI_FLBOOKING_CREATEFROMDATA BAPIs in SAP (which information is strictly mandatory in its import, export and table parameters).

We use SAP Logon to browse the details of these 2 BAPIs.

 

Through the se37 command in SAP and in the function builder, we can look up the function modules definition by using SAP's wildcards (for example *):

 

Preparation0_se37

 

We can review further detail for both BAPI_FLIGHT_GETLIST and BAPI_FLBOOKING_CREATEFROMDATA:

 

Preparation1_FLB

 

For BAPI_FLIGHT_GETLIST, clicking on Display shows its definition:

 

Preparation2_displayFn

 

Notice that we will need to consider: Optional and non-optional import parameters, tables we can set as reference, export parameters, and any predefined exceptions to configure in Bizagi error handling.

 

Preparation3_flightgetlist

 

note_pin

To configure the input parameters of your SAP integration in Bizagi, you need to consider that information presented both in: Import and tables.

To configure the output parameters of your SAP integration in Bizagi, you need to consider that information presented both in: Export and tables.

 

Notice you can use the Test/Execute option to validate your results.

In our example, we will allow the petitioner to filter available flights according to a chosen range of date, and the departure and arrival city.

To test this function module in SAP, we enter dummy values into the mandatory fields (such as From: New York, To: Frankfurt):

 

Preparation4_test

 

For the values used above, these are our first 20 results for available flights (as specified by Max_Rows):

 

Preparation5_results

 

Similarly, we look up the definition for BAPI_FLBOOKING_CREATEFROMDATA:

 

Preparation6_flighbooking

 

 

note_pin

In this specific example, none of the two SAP BAPIs have predefined exceptions.

Therefore, in this example we will not be configuring special treatment for failed invocations.

For further information about error handling in the SAP connector, refer to: SAP error handling.

 

When testing this BAPI which aim is to create a record in SAP, note that you may do a "test run" and avoid that new record for testing purposes:

 

Preparation7_fillbooking

 

Upon a successful execution of this BAPI, you may query the Table called RETURN, which provides the detail message and SAP confirmation:

 

Preparation10_success

 

note_pin

If you do use the Test/Execute option in SAP Logon, make sure you either commit or rollback the execution before having Bizagi invoke these BAPIs (you may also explicitly close SAP Logon to discard changes).

Otherwise, it is likely that some tables and structures are left locked out awaiting for transaction commits.

 

Taking into consideration the objective of our Flight Booking process, plus the information involved in the integration with SAP, in this example we consider the following definitions in our data model:

 

Preparation8_datamodel

 

Notice that:

Our process entity is called FlightBooking.

The Search criteria and Date filters entities store the information that the petitioner enters to filter the flights that suit his or her requirements.

Available flights is a collection that will be filled out with the fetched list of flights from SAP.

The one flight marked down by the Selected? boolean, is set into the Selected flight attribute in the FlightBooking entity.

SAP messages stores the response messages sent by SAP when booking a flight. When this BAPI does not execute successfully, SAP will return more than 1 message specifying detail.

Information regarding cities, airports and airlines are registered through 3 parameter entities: City, Airport and Airline. For all of these 3 entities, we include a business key definition in Bizagi:

 

Preparation9_parameter

 

 

Note that preset values we have included for the Airline entity consider the exact codes that SAP handles for the flight carriers.

Similarly and in this example, we set in Bizagi the business key in the City and in the Airport entities, and use the following codes:

NEW YORK as a code for New York (USA) and FRANKFURT as the code for Frankfurt (Germany).

JFK for the John F. Kennedy airport in New York, and FRA for the Frankfurt airport.

 

Configuration of the connection

Now we enter the connection details for the SAP connector in Bizagi.

To do this, go to the Expert view and locate the External systems module.

In the panel to its right, locate SAP under the Connectors item.

 

Include a new SAP connector configuration by right clicking on SAP and selecting New Configuration...:

 

Connection0_new

 

Enter the details of your SAP system as described below:

App Server Host: The IP address or name of your Server hosting your SAP system.

Client: The number of the client accessing the SAP system.

Idle timeout: The timeout in seconds for idle connections.

By default, you may assign a value of 600.

Language: The 2-letter ISO code that represents the language setting (as inputted when accessing SAP through SAP Logon).

Peak connections limit: The maximum number of connections you will allow through the SAP connector.

By default, you may assign a value of 10 connections.

Pool size: The number of connections that will be handled for reuse.

By default, you may assign a value of 5.

System number: The number of your SAP system.

User: An authorized SAP user to access and invoke BAPIs or RFCs.

This SAP user configured here will be used as the service account of this connector.

User Password: The password for that authorized SAP user.
 

Connection1_props

 

When done click Ok.

Notice you may use different configuration parameters for each of your project environment (development, test and production).

 

Configuration of the BAPIs invocation

We will integrate Bizagi with SAP in 2 parts of the process:

First at the Request flight activity, by invoking BAPI_FLIGHT_GETLIST when the petitioner clicks a button.

Then, at the asynchronous task called Book flight in SAP where the system automatically invokes BAPI_FLBOOKING_CREATEFROMDATA (no user interface).

 

Invocation of BAPI_FLIGHT_GETLIST.

To invoke this BAPI which fetches records, through Bizagi Forms designer (Process wizard step #3), we consider the following user interface:

 

Invocation0_UIgetlist

 

Through the Actions and validations, we set the invocation of a SAP BAPI upon a given change or action in the user interfaces.

In this example, we will invoke SAP when the above button is clicked.

To do this, we create an action that uses the execute SAP option:

 

Steps1_ButtonAV

 

The relevant configuration is set at the execute sap action (the ClearAll rule just deletes all the records of the table), where you need to click on argument to configured your integration as shown below:

 

1. Select the SAP configuration.

This means choosing the configuration of the connection for SAP, as initially done at the External systems module.

By default the predefined SAP configuration is selected, and this option will additionally come in handy in case you have multiple SAP systems to connect to.

Notice you may create a new configuration from the New shortcut button.

 

Example0_Getlist1

 

2.  Select the function module.

Use the search box to filter and search for the function module you wish to invoke in SAP.

Recall that any RFC or BAPI wrapper will be listed, provided that you have properly configured the connection with a user with enough rights.

 

Click Search to list the matching function modules. Choose the desired one and click Next.

 

note_pin

Notice you may use in the Search box, any SAP wildcard characters such as *, + or #.

For more information about these wildcards, refer to SAP's documentation at

http://help.sap.com/saphelp_46c/helpdata/en/85/dae7c04bac11d1890e0000e8322f96/content.htm.

 

3. Map the Import parameters.

Use the graphical mapping to map inputs for your SAP function module.

Keep in mind that parameters passed on as reference to this function module, through SAP's tables, are presented in this step as well.

Use the Maximize button to access mapping functions:

 

SAP_maximize

 

When maximized, map the corresponding data from Bizagi to the SAP BAPI:

 

Example0_Getlist2

 

Notice in this example we rely on the Constant functions to map the Max_Rows and other inputs which we won't be leaving up for the end user's configuration.

Click Next.

 

4. Map the Export parameters.

Use the graphical mapping to map output of your SAP function module into Bizagi.

Keep in mind that parameters passed on back as reference by this function module, through SAP's tables, are presented in this step as well.

Recall that this BAPI merely executes a query and it does not create new records in SAP.

Ensure your mapping is as shown:

 

Example0_Getlist3

 

Notice we map an array of flights into our collection of available flights.

Should there be no available flights matching the end user's criteria, the table representing the collection of available flights in the user interfaces will be left empty.

Through this idea, there is no need to configure special error handling treatment.

Click Next and skip the error handling configuration by clicking Finish.

 

note_pin

In case you need to include a sophisticated treatment and customizations to manipulate the import or export parameters, you may do so by including a transformation using the Switch to advanced mapping option:

SAP_advancedmapping

For more information about this possibility, refer to Advanced mapping.

 

Invocation of BAPI_FLBOOKING_CREATEFROMDATA

To invoke this BAPI which creates a record in SAP for the booked flight, we consider an asynchronous task which performs this integration as an automatic task (without user intervention):

 

Example1_BookFlight1

 

Through the Activity actions definition for the Book flight in SAP task (through the Process wizard step #4), we set the invocation of a SAP BAPI:

 

Example1_BookFlight2

 

note_pin

A couple of additional activity actions are configured for this process.

These activity actions are secondary and not part of the integration with SAP (we will not focus on these).

They are configured mainly to complete the process aesthetically, and basically consider:

A business rule upon approval of the flight booking request, so that the selected flight is assigned to the Selectedflight attribute of our data model.

Setting an e-mail notification at the Notify SAP confirmation script task, in order to send to the petitioner an e-mail with the information related to his/her booking confirmation.

Setting the system's date and the petitioner's information into the flight request data.

 

The integration is then configured as described:

 

1. Select the SAP configuration.

We use the same SAP connection configuration.

 

2.  Select the function module.

We search for BAPI_FLBOOKING_CREATEFROMDATA and select it.

Click Next.

 

Example1_BookFlight3

 

3. Map the Import parameters.

Use the graphical mapping to map inputs for your SAP function module.

Keep in mind that parameters passed on as reference to this function module, through SAP's tables, are presented in this step as well.

Use the Maximize button to access mapping functions:

 

SAP_maximize

 

When maximized, map the corresponding data from Bizagi to the SAP BAPI:

 

Example1_BookFlight4

 

Notice in this example we rely on the Constant functions to map the Customerid, Counter and Agencynum, or other inputs which we won't be leaving up for the end user's configuration.

For instance, notice you may send out an X to mark this invocation as a test run and reserve only.

Click Next.

 

4. Map the Export parameters.

Use the graphical mapping to map output of your SAP function module into Bizagi.

Keep in mind that parameters passed on back as reference by this function module, through SAP's tables, are presented in this step as well.

Ensure your mapping is as shown:

 

Example1_BookFlight5

 

Click Next.

Finally, and since this specific BAPI did not have any predefined SAP exceptions (as looked up in the Preparation steps), we will not be handling for this BAPI any functional errors.

So we leave the default Throw exception option to handle any error during the invocation of this BAPI and click Finish.

Should there be an error during the invocation, the asynchronous task will be automatically retried by Bizagi.

 

Example1_BookFlight6

 

And that's it!

At this point we have integrated Bizagi with SAP through the SAP connector which avoids the need of programming.

 

note_pin

To learn about configuring error handling for SAP integration (if BAPIs have predefined functional exceptions), refer to SAP exceptions configuration.

 

Execution

Click on the Run option in Bizagi Studio to launch the bundled Work portal of the Studio and preview how your processes will be powered by Bizagi Engine:

 

RunBizagiRun

 

When logging in and creating a new case for the Flight request process, the petitioner will be able to search for flights according to a range of dates and the departure and arrival city:

 

Execution0_requestflight

 

The button updates the table with the available flights so that the petitioner selects one and inputs the passenger's name to book that flight:

 

Execution1_flightselected

 

Once the flight booking is verified by an approver, Bizagi processes the booking.

The petitioner is notified upon the success of the operation and receives an e-mail with confirmation information:

 

Execution2_notification

 

 

note_pin

Keep in mind that you should have already installed the SAP.NET assemblies required for execution, in order for the SAP connector to work in Bizagi.

Further information about this installation is described at SAP connector.