cancel
Showing results for 
Search instead for 
Did you mean: 

How to collect and group records by loop count in SAP NW BPM

former_member607993
Contributor
0 Kudos

Hello Experts,

An automated activity with Synchronous wherein the records from Source needs to be grouped with '7' records in the Target and then sequentially pass to the to Next automated activity as an Input.

Example:

from Source, 'basepersons' occurs multiple times(0...unbounded) say 28 records and in Target it should group and sent Only 7 records each and pass to the next automated activity. Process continues to increment the loop count(7 records X 4 messages triggered) Appropriately. if there 29 records then 5th message should hold one record.

Please suggest your Valuable Inputs. Advance Thanks!

Good Regards- Rajesh PS

former_member607993
Contributor
0 Kudos

Hello Experts,

Please do provide you Inputs on this thread.

Accepted Solutions (0)

Answers (3)

Answers (3)

ravicarpenter
Active Participant

Not sure but:

1. Initialize a variable say i

2. Loop activity -> iteration and collect/append target structure as required

3. At each iteration incement value of i by 1.

4. if i mod 7 = 0 or i = count then send message else collect msg

5. At i = count, exit loop

I just put this immediately, so just check and improvise on logic. Don't run into infinite loop so put appropriate checks.

former_member607993
Contributor
0 Kudos

Ravi Carpenter

Thanks much for your reply Ravi.

I get it and I'm using a attribute "batchNum"(says 7records is bacthNum is 1 and next next 7 records its 2) and "batchTotalCount" (gives no of messages)from PI to BPM. Based on this can we do the looping and filtering.

for example:

'1' is mapped to DO_Count

for getting the batched records : get(filter(MT_object/result/baseperson, "batchNum=DO_Count")) and this is mapped to Increment mapping.

for Looping(increment): DO_Count+1 and mapped to uncontrolled merge.

Let me know if there is any oversight. and also other better suggestions are most Welcome.

stephen xue

Thanks - Rajesh PS

rasjoshi
Active Contributor
0 Kudos

Hi Rajesh,

Yes I was suggesting create files with 7 records using multimapping in SAP PI...

and use NWBPM for merging small pack file like 2 records, 3 records... use merger to create new files....You can use counter as artifact in NWBPM for knowing no. of records in incoming files...

Or

PI --> NWPMB --> use counter to read no of records --> Msg Mapping --> Split messages here --> If count of records = 7 -> End process (--> PI --> Target) ; If count of records < 7 use collect and then end this branch (--> PI --> Target)

- Rashmi

rasjoshi
Active Contributor
0 Kudos

Hi Rajesh,

I guess you need to use conditional start here, if records are 7 then process records further else use aggregation to hold messages from sources... may be splitting messages to 7 records n then passing to nwbpm help....

- Rashmi

former_member607993
Contributor
0 Kudos

Hi Rashmi Joshi ,

Thanks much for your reply.

You meant splitting the messages appropriately in SAP PI itself and then pass to NW BPM? Then how about loop count and total count?

Record_count is static value i.e. 7 always so in a message it should hold only 7 records.