Skip to Content
Technical Articles

SAP NWBPM Made Easy.

Hello Peers,

A few months back, I had a requirement in which I needed to explore BPM for one of our Business requirements. I read so many blogs and white papers to understand the BPM concept, how it is different from ccBPM? and also what are the guidelines to be followed.

Here in this blog, I would like to consolidate all my learnings and try to make it simple and easy for you using one scenario explained below

Problem Definition

In our project, the requirement was to send the data from CRM to RabbitMQ. We were having two interfaces named Document Upload and Order Details. Both interfaces were triggered almost at the same time. The Document upload interface has the payload of size in MBs whereas the Order Details interface has payload of size in KBs. As per SAP PO’s standard behavior, interface with less size payload i.e. Order Details was getting delivered first and interface with larger size (Document Upload) was getting delivered after Order Details. As per the requirement, the Document Upload interface needed to be delivered before the Order Details interface.

Solution

To achieve the required solution nwBPM is used as follows:

    1. SAP PO will receive the Upload Document interface payload and will send the same to nwBPM. 
    2.  ICO is used to send the data from SAP PO to nwBPM

This channel receives data from CRM.

  • Receiver Channel:

Channel to send the data to nwBPM is configured as follows

    1. NwBPM process will be triggered after receiving the Document Upload payload. It will wait for the Acquiring Order Submitted interface payload to be received.
    2. Following Palette Function is used in this step: 

2.2.1 START EVENT:

              • BPM Process starts when a Message is triggered to BPM is delivered to a START Event.
              •  BPM START Event can be triggered using two ways:
                  1. Using a general URL that points to the nwBPM then BPM checks for the appropriate Process which can be triggered 

http://<host><port>/MessagingSystem/receive/JPR/XI

                  1.  Using a specific Endpoint which is attached to the event when the message is selected. When a Service Interface is assigned to an event Trigger, BPM by default generates an end-point that can be used to trigger Start Event or Intermediate Event 

http://<hostname>:<port>/bpm/demosapcom/<processName> /<ServiceInterfaceName>?wsdl

  • DATA OBJECT
      • Data Objects are used to store information during the execution of the process.
      • Data Object can have their own Data type which is primitive like string, Boolean, etc or can be mapped with XML Data type Object of ESR.
      • When a process is initiated, these Data objects can be used as per need in the input or output mapping of each event, activity, etc.
      • When a process is canceled or ends successfully the Data Object Memory is released by SAP BPM.
    1. Data received in this step is mapped to Data Object created for Document Upload Interface as follows:

 

3.1 SAP PO will receive Acquiring Order Submitted interface payload from CRM at the same time or within the fraction of seconds when the Document Upload was received and will send the payload to nwBPM. 

3.2 ICO will send the data to BPM:

    1. Following Palette Function is used in this step:

3.3.1 INTERMEDIATE MESSAGE:

      • Intermediate Message Events are process steps where the respective process instance waits for a message to come in before the flow commences on the respective control flow branch. As such, they cater for a variety of use-cases, including
  1. conversations between the process and another component
  2. intra-process communication
  3. message collection and aggregation
  • Intermediate Message Event follows a mechanism called Matching and Delivery.
  1. Matching: When a message reaches BPM, it is matched to the process based on some correlation ID. This is one of the important functions of Event-Based Trigger. One can define his own co-relation ID. A correlation ID is nothing but a Boolean condition to validate if the message which has reached the BPM component matches a Process and can be delivered for initiation of the Event Trigger. For example: if a start event has a correlation condition based on the value of an XML tag is equal to a string or not. Thus, correlation ID acts as a filter for the BPM Process. Few examples are given below
        1. true
        2. message/name=context
        3. message/name=substring(context,0,3)
        4. concat(message/name, string(message/id))=substring(context,0,3)
  1. Delivery: If a message passed a correlation condition, it is set to be the delivery state. Thus, we can say that this message is a perfect fit for the Process. The “delivery” transaction is where the process server executes the Intermediate Message Event, i.e., receives the message, output maps its payload to the process data context, and proceeds on the respective control flow branch. The key takeaways for you are that Intermediate Message Events will also receive messages that have come in before the process has progressed to the Intermediate Message Event, but Intermediate Message Events will also wait (i.e., suspend the flow on the respective branch) for a matching message if none is currently queued.
      • Consuming that (Endpoint URL) as Web Service will deliver the corresponding request message to the process server where it is dispatched to those process instances that contain an Intermediate Message Event for that trigger and where a so-called correlation condition holds.
      • Please note that to successfully deliver the message to the Intermediate Message Event, the correlation condition needs to permanently hold until the control flow reaches the Intermediate Message Event (“delivery” transaction). If between the two transactions the process context is changed in a way that the correlation condition does no longer hold, the message is “un-matched” and removed from the queue. In effect, it will not be delivered.
      • Another Important note to take is that while using the web service URL, nwBPM comes with Web Service Stack supporting WS-Reliable Messaging (WS-RM) Protocol. We need to use the WS_AAE Adapter for using this web service.
      • Using WS-RM has a performance impact. The protocol requires additional database persistence and acknowledgments being exchanged between senders and receivers. SAP NetWeaver BPM support WS-RM 1.0, not WS-RM 1.1. To set up communication with for example with SAP NetWeaver Process Integration, use the PI WS adapter version 7.10.
      • Please know a single triggering of an Intermediate Message Event will deliver a single message to the process instance. If multiple messages are queued up to be delivered, the corresponding Intermediate Message Event will need to be triggered as many times as there are messages waiting in the queue.

3.4 Data received in this step is mapped to Data Object created for Acquiring Order Submitted Interface as shown for first interface.

  1. Upon receiving the Acquiring Order Submitted payload, nwBPM will match the correlation id of both interfaces.
    1. If the match is found, the Document Upload interface payload will be sent to RabbitMQ through ICO.

   5.2 Following Palette Function is used in this step:

5.2.1 AUTOMATED ACTIVITY:

      • Automated Activity can be used to perform a task which is of two types i.e. either use to trigger an ICO or just an Operation Mapping.
      • Both ICO and Operation Mapping are imported by importing the Service Interface WSDL as Service Reference.
      • Please note that while defining the Service Reference if one must trigger an ICO the operation must be [XI] along with the sender Component Name, rather for Operation Mapping it must be just [WS] which is the default option.

   5.3 Here, Document Upload Data Object which is holding the data will be given as input to the ICO.

5.3 Here,  ICO will be called from BPM and executed in PO: 

6.1 After Document Upload Interface, Acquiring Order Submitted interface payload is sent to RabbitMQ.

    1. Following Palette Function is used in this step:

6.2.1 AUTOMATED ACTIVITY:

      • Automated Activity can be used to perform a task which is of two types i.e. either use to trigger an ICO or just an Operation Mapping.
      • Both ICO and Operation Mapping are imported by importing the Service Interface WSDL as Service Reference.
      • Please note that while defining the Service Reference if one must trigger an ICO the operation must be [XI] along with the sender Component Name, rather for Operation Mapping it must be just [WS] which is the default option.
  • END EVENT:
      • End Event indicates the end of the BPM Process.
      • Note that the message trigger of the START and END EVENT must be the same by default.

6.3 Here, Acquiring Order Data Object which is holding the data will be given as input to the ICO.

6.4 Here, following ICO will be called from BPM and executed in PO

  1. If the correlation id match is not found, the intermediate event will not be triggered, and that message will become pointless and will be lost.

8.

8.1 If in the whole BPM Process, an error occurs like Interface Failure or Message Mapping error then the Technical Error will be triggered, and a notification is sent to the respective stakeholders.

    1. Following Palette functions are used in this step,

8.2.1 TECHNICAL ERRORS IN BPM:

      • With NetWeaver Process Orchestration 7.31 SP10 and 7.40 SP5, we are now able to detect and handle technical errors. Some examples of technical errors are invalid passwords, unauthorized access, network failures, etc.
      • Such Error occurring inside the BPM need to address and handled for this SAP has already provided a pre-package know as Technical Errors
      • One of the key constructs in BPMN is the Boundary Event or Intermediate Events. The boundary events can only be attached to the boundary of activity and it reacts to (catches) a named error, or to an error if a name is not specified.
      • If a message (signal from outside the process), error (signal from inside the process), or signal (from either inside or outside) event is drawn attached to the boundary of a process task or subprocess, the task or subprocess immediately aborts, and processing continues the exception flow out of the event.
  • NOTIFICATION:
      • Technical Errors may be required to be notified to the respective stakeholder. Hence, for these cases, an email alert mechanism is being provided by BPM called Notification.
      • This notification uses the same mail configuration which PI uses for an alert rule, so no need to configure the JAVA Mail Client again.
      • The notification provides enough options and its own data type Object called Parameter which can be used to send relevant information via mail.
      • It also provides the use of variables in the mail body. We can define the variables and provide the Xpath of the same.

8.3 Here, If any technical error occurs in step 5 or 6; it will be stored in TechnicalErrorType Data Object. This Data Object contains different details such as rootErrorMessage, interface details, etc. 

8.4 Using the notification palette function, we will send the error information stored in TechnicalErrorType Data Object to configure Email.

In this way, we were able to sync both the interfaces even if there was a payload size mismatch.

There can be many other solutions to this problem. Like storing both the payloads in PO FTP and then using EOIO to Fetch the file etc.

We thought of exploring BPM solutions too for the same.

While developing this scenario I was able to learn many concepts of BPM in detail.

Thank You for the read 🙂

Be the first to leave a comment
You must be Logged on to comment or reply to a post.