In this article, we will understand the concept of Business Process Management in SAP XI/PI using a simple scenario. A BPM consists of an Integration Process which in turn contains a number of process steps similar to an SAP workflow. Integration process can be stateless or stateful. A stateful process retains its state until a specific event occurs. Unlike point-to-point communication where there is exactly one sender and one receiver, there can be a number of systems/stakeholders involved in a BPM communication and hence it is also called as Cross-Component BPM or ccBPM.
We will design and configure a BPM scenario using Asynchronous/Synchronous Bridge, i.e. we will send an asynchronous message to XI using a File sender and XI will in turn make a synchronous BAPI call to an SAP ERP system and then route the response to the same or another File system using File receiver. The point to note here is that, since the source message is sent asynchronously, the calling application does not have to wait for the synchronous response. The incoming asynchronous message is persisted in XI and hence the calling application need not wait.
We will use the RFC function module BAPI_CUSTOMER_GETDETAIL2 in this scenario. The request message would contain the customer number and optionally the company code; and the response message would return the corresponding details of the customer like name, address etc. A file containing request message would be picked up asynchronously by XI, then the response will be synchronously received from the SAP ERP system and the same will be routed asynchronously to the target file system.
First of all, import the RFC function module BAPI_CUSTOMER_GETDETAIL2 in the Integration Repository (Click here for steps to Import RFCs and IDocs in IR).
Now create the data types and corresponding message types for the request and response message. For details on the structure of the data types, see the Repository section of this article.
Now create following Message Interfaces:
- MIOA_Customer – Outbound and Asynchronous referring to the request message type
- MIAA_ReqCustomer – Abstract and Asynchronous referring to the request message type
- MIAS_Customer – Abstract and Synchronous referring to both request and response message types
- MIAA_RespCustomer – Abstract and Asynchronous referring to the response message type
- MIIA_Customer – Inbound and Asynchronous referring to the response message type
Note that a BPM or an Integration Process understands only abstract interfaces. Abstract interfaces do not have any direction and hence can be used to send as well as receive messages. You cannot use non-abstract (inbound or outbound) interfaces within a Integration Process definition.
Now define a request message mapping MM_ReqCustomer between the request message type and BAPI_CUSTOMER_GETDETAIL2. Similarly define MM_RespCustomer message mapping between BAPI_CUSTOMER_GETDETAIL2.Response and the response message type. More detailed info here.
Now define a synchronous interface mapping IM_Customer between MIAS_Customer and BAPI_CUSTOMER_GETDETAIL2 using the above message mappings and activate the objects.
Now, we will create the Integration process. Under your namespace, expand the node Integration Scenarios & Integration Processes. Right click Integration Processes and select New. Name your Integration Process, say IP_AS_Bridge and choose Create.
Pay attention to different windows/panes presented to you as the BPM Editor. The Graphical Definition window helps you design the integration process steps. The Properties pane displays the properties of the selected step. Container pane displays different container variables used in the process.
Graphical Definition window sidebar lists different process steps that can be inserted in the process by using a simple drag-and-drop. The upper toolbar provides various display and editing options.
Now, in the container pane, create two container variables say REQ and RESP as shown in the adjoining figure. The figure also shows graphical view of the complete integration process. Create the integration process by adding one step at a time in the Graphical Definition window and update the properties of the step in the Properties pane. The different process steps used are listed below along with corresponding properties:
Receive Step – Receives the asynchronous message and starts the process.
Send Step – Sends the received request message synchronously and receives corresponding response.
Send Step – Send the received response message asynchronously.
Save the process. Check the created process for semantic errors using the menu option Integration Process→Check or by simply pressing F7 key. The Tasks pane displays errors/warnings if any. You should receive no errors/warnings. Go ahead and activate your change list. Thus you have completed the repository part.
Now let us complete the directory configuration:
Create a configuration scenario to hold all the directory objects. Add the Business System corresponding to SAP ERP system under Service Without Party. Create a RFC receiver channel under it. Create a new Business Service for the source and target file systems. Create File Sender and receiver channels under it.
Now, right-click the Integration Process node and choose New. A wizard will open up. Click on Continue. Choose the Repository process you created in the Integration Repository and click on Continue. Give a name to the process. This may or may not be same as the repository process. But for better understanding, it is suggested to keep both the names same. Save the object. Pay attention to Sender and Receiver tabs which enlist the different abstract interfaces involved in the integration process.
Create a sender agreement using the outbound interface MIOA_Customer and the file sender channel. We will need to create three receiver and interface determination objects:
1. Source File System to BPM (Asynchronous request)
- Sender Service – Source File System
- Sender interface – MIOA_Customer
- Configured Receiver – IP_AS_Bridge (BPM)
- Inbound Interface – MIAA_ReqCustomer
- Interface mapping is not necessary as message type are identical
- Since the receiver is a BPM, receiver agreement is not required
2. BPM to SAP ERP (Synchronous request and response)
- Sender Service – IP_AS_Bridge (BPM)
- Sender interface – MIAS_Customer
- Configured Receiver – SAP ERP System
- Inbound Interface – BAPI_CUSTOMER_GETDETAIL2
- Interface mapping – IM_Customer
- Receiver agreement – Create using the interface BAPI_CUSTOMER_GETDETAIL2 and the RFC Receiver channel
3. BPM to Target File System (Asynchronous response)
- Sender Service – IP_AS_Bridge (BPM)
- Sender interface – MIAA_RespCustomer
- Configured Receiver – Target File System
- Inbound Interface – MIIA_Customer
- Interface mapping is not necessary as message type are identical
- Receiver agreement – Create using the inbound interface MIIA_Customer and the File Receiver channel
Finally, activate your changes.
To test the scenario, place an input file in the specified directory of the source file system. A sample input XML file can be created from the test tab of the request message mapping in the Integration Repository. SXI_MONITOR/SXMB_MONI should show a total of four successful messages. Open the target directory on the target file system to check the response message.
Thus we have completed a simple Asynch/Sync Bridge scenario using Business Process Management.