This is my First Blog in SCN.Hope this article will help someone having similar requirement.

In this article I have shown the steps required to achieve the following requirement in Netweaver BPM process in Process Orchestration 7.31:

1)Getting 0…unbounded (multiple) records in a single structure as an input to NW BPM process.

2)Sequential splitting of (0…unbounded) records from structure using index functionality to fetch individual records at a time.

3)Introducing a delay of 5 secs between each individual record and sending message from Netweaver BPM process to PI.

Prerequisites:

  1. Sandbox/ Development System: SAP NetWeaver Process Orchestration 7.31 .
  2. SAP NWDS for developing BPM process.
  3. Administration user on the sandbox to create new users and to deploy a new dc.
  4. Basic understanding of NW BPM process Creation through NWDS i.e. Creation of product in Composite Designer Perspective.
  5. Configuration from NWBPM to PI and PI to NW BPM in place (This is not a part of this document).Reader can take help of below link from William Li:

          http://scn.sap.com/docs/DOC-28803

Details:

For looping in NW BPM Process on Data object (0…n) i.e. multiple records of a structure, we are using mainly Automated Activity and Mapping Activity option available in NW BPM process. But they support Parforeach functionality (I.e. Parallel for each) for activating loop. So, If we want to implement split of a structure having 0…n (unbounded) records into individual record messages one after other (i.e. Non Parallel split) for example with a delay in between each messages, we can’t implement it directly by activating loop property. Therefore following main Activities Performed to achieve the required result:

1)Use of Embedded Process Event.

2)Use of Get function for fetching next records from structure using Index count and increment.

3)Automated Activity with No Looping option enabled.

Process flow Diagram (Product – Composite Designer Perspective) created through NWDS with Annotation used to describe each steps:

Blog1.jpg

Detailed Steps used in each flow objects and events in process flow diagram: 

Ø  Step 1.  Defining following Data Object:

a)      DO_TypeCount – Used for counting number of records coming in structure (i.e. Count of PriceDetail record in structure ArrayOfPriceDetail) .This is also used for condition evaluation in Exclusive Choice Gateway.

Data type is Integer.

Blog1.jpg

a)      DO_LoopCount – Used for counting the number of iterative flow completion in process flow. This is also used for condition evaluation in Exclusive Choice Gateway.

Data type is Integer.

Blog1.jpg

a)      DO_Index – Defined for index count in Get function .This will help to evaluate new record each time (i.e. Price Detail record) from structure (ArrayOfPriceDetail) to be mapped from NW BPM to PI/AEX in Automated Activity on each iterative process flow step.

Data type is long.

Note: Get function works for long data type Data object/value.

Blog1.jpg

a)      DO_ArrayOfPriceDetail: Data Object created for holding incoming 0…n (unbounded) record Structure (i.e incoming payload) as an input to NW BPM process from PI.

Data type is of type incoming structure into NW BPM process.

Blog1.jpg

Ø  Step 2. Define Start Event:

a)      Here Start Event used as the first step in NW BPM Process to receive the incoming message through trigger criteria.

aaBlog1.jpg

a)      Define the trigger for Start Event:

Blog1.jpg

a)      Define Output mapping in Start Event:

·         Here we mapped incoming Message structure (ArrayOfPriceDetail) to it Data object type DO_ArrayOfPriceDetail

Blog1.jpg

·         Initialize the count for Data object DO_Index to 1:

Blog1.jpg

·         Initialize the count for Data Object DO_LoopCount to 0.

Blog1.jpg

·         Initialize the Data Object DO_TypeCount with Count of PriceDetail Node (0…n) i.e. multiple occurrence node in structure. This Data object holds the count of number of records in structure.

Blog1.jpg

Ø  Step 3. Define Uncontrolled Merge Gateway:

Blog1.jpg

Ø  Step 4. Define Exclusive Choice Gateway:

Here we are checking if all records in Message are Processed or not using logic

If (Do_TypeCount = DO_LoopCount)

Then follow path YES and End the NWBPM Process.

Else follow path No”.

Here No is checked as Default Gate.

Blog1.jpg

Ø  Step 5. Define Embedded Sub- process and within Embedded Process include first step as Automated Activity (Split and Send Individual msg) and second step as Timer Event (Timer) shown as below:

Blog1.jpg

·         Step 5.a.

Define Automated Activity (split and Send Individual msg) in Embedded Sub-Process as below:Blog1.jpg

No Looping Activated in Automated Activity

Blog1.jpg

Define Service Interface, Operation and Service Reference for Sending Message from BPM to AEX/PI

Blog1.jpg

Mapping individual records to output structure:

Here we use “get” generic function to fetch new individual records each time from source structure using index count and mapped it to receiver structure.

Blog1.jpg

·         Step 5.b.

Define Timer Event (Timer) in Embedded Sub-Process as below to add 5 seconds delay:

Blog1.jpg

We used constant value 5000 in “Use Expression” section to add delay of 5 seconds (i.e. 5000 MSecs)

Blog1.jpg

Ø  Step 6. Mapping Activity (Incrementing Counter):

Here we have to increment count value for DO_Index and DO_LoopCount and output connection flow is marked to exclusive gateway for condition evaluation.

Note: Uncontrolled merge step used to create Connection flow as we cannot mark connection flow from mapping activity directly to Exclusive choice Gateway.

Blog1.jpg

Blog1.jpg

Ø  Step 7. Test input Payload with 4 records example (i.e. 4 PriceDetail records):

Sample payload attached(Refer attachment): TestInput.xml

Say we have 4 records coming in structure as marked below in colors.

Blog1.jpg

Ø  Step 8. Monitoring Result:

We will get individual record as a single message with 5 seconds delay between each messages from NWBPM to PI/AEX.

Blog1.jpg

Limitations

1.     1.  Automated Activity and Mapping Activity in Netweaver BPM Process only works for Parforeach looping i.e. Parallel Looping scenarios only.

2.     2. Use Case shown here is only for NW BPM with monitoring results relevant to it.

3.     3.Configuration required to develop NW PI to NW BPM and NW BPM to PI is not a part of these document. However reader can take help of following link from william Li to develop configuration part through NWDS for Enterprise Service Browser objects and Integration Directory Objects :

       http://scn.sap.com/docs/DOC-28803

Use Cases

1.       1. Sequential looping to spilt line items from the list.

2.       2. Receiver System can only process one message at any time. Hence Split of message is required.

     3. Use of Time delay between each record output message from structure

To report this post you need to login first.

9 Comments

You must be Logged on to comment or reply to a post.

  1. Gareth Ryan

    This is a good, detailed blog covering off a very powerful pattern within BPM.  I’ve used looping patterns like this a lot to manipulate payloads instead of the “parallel for each” which in my mind is NOT looping but SAP seem to think it is!

    It’s useful to add that the parallel for each has a limitation in how many tokens (i.e. records) can be handled which I think is 500, so you have to be very careful if you use it with larger payloads.

    Also, it is worth bearing in mind that you could also replace this modelled looping with a coded EJB mapping function.  In my experience, if you have anything other than a sequential loop (say you want to merge two payloads or have a nested loop of two payloads) then it is better to simplify the BPM model and use a single EJB mapping instead.

    (0) 
  2. divyesh vasani

    Nice one 🙂

    However, can you provide example on difference between parallel looping and sequential looping.

    I know that sequential is something where you have to process record one by one out of one multiple(unbounded) occurences node.

    I have query on parallel split…

    –Divyesh   

    (0) 
  3. Jonathan Ma

    Hi, all

    Interesting blog. I have tried to follow the blog but ran into problems with step 5a on the get function. My input datatype is the following:

    input_dt

      records occurence 1…unbounded

        pernr string occurence 1

        plans string occurence 1

    output_dt

      pernr string occurence 1

      plans string occurence1

    On the get function, I have a hard time getting the records mapped to the output_mt. Here is the screenshot I am trying to do:

    Untitled.png

    Any idea how to get the function working?

    Thanks in advance,

    Jonathan.

    (0) 
    1. Raj Kumar

      I successfully deployed the above scenario. But unsure what is the next step which I need to do in ID. If you(anyone who successfully completed)please send me the detail steps on what agreements which I need to create in ID it would very useful. I can test the scenario.

      (0) 
  4. Rashmi Joshi

    Indeed great blog!!!

    I have a question on “Parallel For Each”.. I understood this blog how we can get sequential records out of multiple… It will be great if you can help in understanding ParForEach…

    If you can provide any example that will be helpful…

    BR,

    Rashmi

    (0) 

Leave a Reply