Sequential Split of messages and Looping in NWBPM Process using Indexing of record
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.
- Sandbox/ Development System: SAP NetWeaver Process Orchestration 7.31 .
- SAP NWDS for developing BPM process.
- Administration user on the sandbox to create new users and to deploy a new dc.
- Basic understanding of NW BPM process Creation through NWDS i.e. Creation of product in Composite Designer Perspective.
- 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:
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:
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.
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.
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.
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.
Ø 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.
a) Define the trigger for Start Event:
a) Define Output mapping in Start Event:
· Here we mapped incoming Message structure (ArrayOfPriceDetail) to it Data object type DO_ArrayOfPriceDetail
· Initialize the count for Data object DO_Index to 1:
· Initialize the count for Data Object DO_LoopCount to 0.
· 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.
Ø Step 3. Define Uncontrolled Merge Gateway:
Ø 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.
Ø 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:
· Step 5.a.
No Looping Activated in Automated Activity
Define Service Interface, Operation and Service Reference for Sending Message from BPM to AEX/PI
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.
· Step 5.b.
Define Timer Event (Timer) in Embedded Sub-Process as below to add 5 seconds delay:
We used constant value 5000 in “Use Expression” section to add delay of 5 seconds (i.e. 5000 MSecs)
Ø 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.
Ø 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.
Ø 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.
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 :
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