Join 25k+ Publishers who track Tweets, Likes, Pins, +1s to their websites right from their WordPress Dashboard! X

XI/PI: A Step-by-Step Guide to BPM – Asynch/Sync Bridge

In this article, we will understand the concept of Business Process Management in SAP XI/PI using a simple scenario.

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.

BPM Integration ProcessNow, 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.

Step 1: Receive Asynchronous MessageStep 1: Receive Asynchronously

Send Step – Sends the received request message synchronously and receives corresponding response.

Step 2: Send Synchronous MessageStep 2: Send Synchronous Message

Send Step – Send the received response message asynchronously.

Step 3: Send Asynchronous Response MessageStep 3: Send Asynchronous Response

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.

Comments

  1. mohanreddy says:

    hi,i am mohan
    i need sap xi/pi materials as begginer and with screen lables
    plzzzzzzzz……. anyone mail to meaterial
    mail id:mohanboyapalle@gmail.com

  2. Aparna says:

    Hi Riyaz,
    I need help in BPM. We have a functionality where i have the usual receive step->wait step->send step.
    I want this wait step to wait for 24Hrs. My question is, can we take this value(24Hrs) as a parameter in ID, like the usual Parameterization?
    It is Urgent,can you please reply yo my blog???

  3. Sneha says:

    Hi Riyaz,

    I have a IDoc to Webservice synchronous scenario using BPM.
    The problem that we are facing is whenever the interface fails due to some reason like the webservice is down, we then have ‘n’ number of repeated executions for the same interface with same set of data.
    The executions keeps happening till the time the interface is successful.
    Is there any way how we can avoid too many repeated executions of the same set of data?
    Thanks for your help.

    • Riyaz says:

      I believe PI attempts to re-deliver the message somewhere around 5 times. The maximum number of retry attempts before declaring a failure could be configured by your NW Administrator.

  1. Mithun says:

    For a File(ASYNC)-PI-ECC, i need to do some mappingin the async request. were do i place the mapping in the BPM. Should i use a TRANSFORMATION before calling the recieve steps in BPM

    • Riyaz says:

      First step in the BPM should always be a receive step. You can place a transformation step after the first receive step. If you want to do mapping before receive step, you can do the mapping outside the BPM (using interface mapping object) and send the resulting message as input to BPM.

  2. Dev says:

    Hey,
    I have a question with regards to Async(IDoc)-Sync(SOAP)-Aysnc(IDoc) BPM.
    How do you represent this in integration scenario with the actions?
    I tried to do it with three application components Sender->BPM->ECC with three actions.
    I am confused on how to represent the Sync interface in the integration scenario.
    Is there a screenshot that I could refer to for an integration scenario with actions for the Aysnc-Sync-Async bridge? That would be really awesome.
    Regards,

  3. Pradeep says:

    Hi Riyaz,
    Issue is resolved..

    I think the issue was the software component for which the RFC was imported was not installed to the SAP ERP system in the SLD. After I enable the the software component to SAP ERP, RFC definition started showing for SAP ERP. Thanks a lot for all the help.

    Thanks
    -Pradeep

  4. Pradeep says:

    Hi Riyaz,
    Thanks for getting back. I verified ESR and RFC exists in ESR. Also I refreshed the cache. Still the RFC function module is not showing for SAP ERP communication component. However the RFC shows up under other communication component that is being used in the scenario. It is ONLY under the SAP ERP it is not showing. Any clues??

    Thanks a lot!

    -Pradeep

  5. Pradeep says:

    Hi Riyaz,
    Very userful blog. I am trying above scenario in PI 7.1. I have done all the interface configuration in Enterpise service repository. However I am stuck in Integration Directory while configurig Interface Determination for BPM to SAP ERP (Synchronous request and response)

    After selecting SAP ERP as receiver communication component, when I tried add the receiver interface, RFC interface name does not show up in the “Select Interface” screen. Infact screen does not show any of the interfaces that I have defined not just RFC interface.

    I am able to import the RFC successfully in enterpise services repository from the SAP ERP system.

    And If I select any other receiver communication component then RFC interface shows up in “Select Interface” screen.

    Please let me know if you have any clue on why RFC interface name is not showing up when SAP ERP is selected as receiver communuication component.

    Thanks
    -Pradeep

    • Riyaz says:

      In Integration Directory, open the business system (communication component) corresponding to SAP ERP and make sure that you can see the RFC function module name in the Receiver tab. If you dont see it, you might need to add it or import the function module from SAP ERP system in ESR. Refresh the cache, clear SLD data cache and it should work.

  6. santosh says:

    Really good job buddy…..
    Thanks a lot….
    All the stuff in your site quite usefull & informative…………….basically for PI guys….

    santosh.

  7. Prasad says:

    Hello Riyaz,

    Your blogs are highly informative. I have one query and I hope you provide some hints.

    I am implementing a scenario SOAP-PI7.1-IDOC. Here I get the SOAP Request from supplier system with following format:

    ……………
    ……………

    attribute1 value
    attribute2 value
    attribute3 value
    attribute4 value

    text/xml
    invoice.xml
    base64 encoded UBL2.0 message here

    So far the interface is working fine( i.e when I make test soap request with above format, the idoc gets posted in ECC without any problem) and I get a empty soap response back to my soap client.

    Question: My supplier wants the SOAP response with following format in the same session.

    ……………
    ……………

    attribute1 value
    attribute2 value
    attribute3 value
    attribute4 value

    All the attributes are available with SOAP request.

    Is this possible without use of BPM?, if yes, could please describe.

    Thanks in advance.

    Prasad

  8. Riyaz says:

    You can very much use S/A bridge in a BPM. For sender SOAP adapter pls see: http://www.riyaz.net/blog/xipi-a-guide-to-using-sap-xi-soap-adapter/ . and for IDoc adapter pls see: http://www.riyaz.net/blog/xipi-simple-idoc-communication-using-sap-xi/

    Hope this helps.

  9. manohar says:

    Hi
    Riyaz,
    I want to know how to do SOAP TO IDOC SCENARIO.
    I in this scenario sender adapter is soap and receiver adapter is idoc.
    here sender side we need to send 6 file at time( WSDL) to the idoc R/3
    in this case we can give request and and we can get response from Pi (not from
    R/3 IDOC). Here we want to used SYNC/ASYNC BRIDGE.
    how to do this scenario,send me any screen shots or material

    Regards
    Manohar

  10. Partha says:

    Hi Riyaz,

    Is there any article for HTTP and JDBC interface. Please help to find out.

    Thanks

    Partha

  11. Venkatesh says:

    Hi Riyaz,

    This is one of the best written knowledge brief which i have come across.

    i have a similar situation in my project which might require similar concept.
    Flow: IDoc adpater -> SOAP (Request) -> SOAP (Response) -> RFC

    With the above article i tried to re-create things for my scenario… but they do not seem to work.
    so i thought of changing the Flow (IDOC adapter -> File (receiver), File (Sender ) SOAP (Request) -> SOAP (Response) -> RFC)

    when i tried this approach.. it shooted an error at the (File Sender -> BPM config)The File Sender was not able to identify the Receiver..
    i.e considering from the provided scenario 1:
    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

    I am pretty sure you would be having an idea on this. Please guide me in the right way.

    Thanks in Advance,
    venkatesh

  12. Riyaz says:

    Saif,

    When you create a synchronous send step, you need to specify an abstract synchronous interface to send a request message and receive a reposnse message. Also, the container element type for the request message must be the same as the outbound message interface of the synchronous interface. Similarly, the container element type for the response message must be the same as the inbound message interface of the synchronous interface. The container elements used here should correspond to abstract aysnchronous interfaces.

  13. Saif says:

    Hi Riyaz,
    Could you please explain the logic behind using message interface with Abstract Synchronous type.

    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

  14. Riyaz says:

    Hi Koti,

    1:N transformation can be done with or without BPM. If you want to use BPM check out 1:n Multi-Mapping using BPM.

    If you want to do it without BPM, you can make use of enhanced receiver/interface determination option in your receiver/interface determination.

    Regards,
    Riyaz

  15. Koti says:

    Hi Riyaz,
    This is very usefull blog. But in my project i have the scenario like, to send same file to multiple SAPs using RFCs. All RFCs have the same fuctionalities and same name and same structures. Is it possible to add multiple receivers in receiver determination?

    Thanks,
    Koti

  16. Riyaz says:

    Hi Partha,

    Thanks for your compliemnts :-)

    For webservice a similar approach would do the job. Only that you will use SOAP adapter instead of RFC adapter. I guess, five interfaces should only be required.

    Regards,
    Riyaz

  17. Partha P Mukherjee says:

    Hello Riyaz,

    This is one of the best articles anywhere on Async – sync that I have come accross.

    I have a question. For File to Sync web service do we need six Message Interfaces?

    Will it be inbound sync with the webservice input type being the input message and web service outout mesage type being the output message?

    OR 5 will do the job?

    Thanks and regards,

    Partha.

  18. Riyaz says:

    Hi Sankar,

    Thank you for reporting the broken links. The same have been corrected.

    Regards,
    Riyaz

    • Aparna says:

      Hello,
      I have a BPM scenario where we have the usual receive->wait->send steps.
      Wait step has to wait for 24hrs.My question is, can we have wait step value as a parameter in ID?
      Like we do the normal parameterization? can you please reply ASAP. this is real urgent.
      Aparna

  19. sankara rao bhatta says:

    Hi

    in this article i am not able access the repository objects. when i click on the link a win dow opens but there is nothing there

    thanks
    sankar