cancel
Showing results for 
Search instead for 
Did you mean: 

Sequential Looping in NW BPM

Former Member
0 Kudos

Hi Experts,

I have a requirement to do sequential looping to spilt line items from the list, which is failing

I did the following to establish the scenario,

  • Send Async request from PI to NW BPM ( List that have multiple lines)
  • Output mapping for Start--> map the request and Instantiate Index variable to 0 and Linecount

Send the request to Uncontrolled merge Gateway and then to Exclusive choice gateway ( to check on Index with Linecount If Index > Linecount End process)

  • I have used Embedded process to retrieve the current lineitem from the list using get generic function where I was the passing the individual Lineitem values and Index for Mapping.

get(Transaction/lineItem/element1, Index)

When I tried to debug the process it fails at the retrieve current line item step in Embedded process saying

String Index out of range:40

Appreciate your responses with above issue

Thanks,

Hussein

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

So your gateway checks if the index is Greater than Linecount, which means that if you have 40 items then the last index will be 39, however as linecount is 40, it will only exit the loop if index equals 41 (greater than 40) so it will still go to the sub process with an index of 40, giving the out of range exception.

Former Member
0 Kudos

Hi Experts,

I am also working on a scenario like your case.

Pls check the SDN Post  http://scn.sap.com/thread/3367500 and suggest.How to fix the issue.

Regards

Deepak

ch_loos
Advisor
Advisor
0 Kudos

Hi Hussein,

not sure why you got this error, but you could also do a par-for-each on the automated activity so you don't need to have a counter.

Christian

Former Member
0 Kudos

Hi Christian,

The requirement is to send the line items sequentially as the receiver can only process one message at any time. hence I have to build the scenario with counter.

Not sure if I am using the get function correctly?

Thanks,

Hussein

Former Member
0 Kudos

In that case just check the size of the document using the count function to see how many items are in the document list.

Thanks

Manish

ch_loos
Advisor
Advisor
0 Kudos

If you are using 7.31 SP04 or later even with parallel loop the activities will be executed sequentially anyways.

Former Member
0 Kudos

Hi Christian,

Does it mean for synchronous messages will be processed one after the other once they completed (response is received) ? and what happens if any one messages ran into error will it stop the process OR continues with other messages.

Thanks and appreciate your responses.

Hussein

ch_loos
Advisor
Advisor
0 Kudos

Hi Hussein,

yes, messages will be processed one after the other because by default BPM executes each process instance within a single thread. But in practice this should not matter since the processing times should be quite short.

If one of the messages run into an error it depends whether this is a modelled SOAP fault for which you have defined a boundary event. If not (e.g. technical error or mapping error), then the complete process instance would be suspended and no further messages would be processed until the process is resumed. By the way - this would also happen in case of parallel/multi-threaded execution. As soon as an automated activity throws an error the process instance is suspended.

Regards,

Christian

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi Hussein,

I hope you are passing a list to generic function in BPM and not an individual element.

Also from NWA you will be able to check the contents of context variables.

NWA->Operation Management -> Processes and Tasks -> Manage Processes , find the process and in details view below check context details.

-Abhijeet

Former Member
0 Kudos

Hi Abhijeet,

I have checked the context details in NWA and while debugging, the values look ok but it fails at the Automated activity to retrieve the first line item using get function.

I have tried passing the list into the function, the BPM split step runs but fails in PI as no listItem generated from the BPM.

Hence I tried with individual elements which throws error at the BPM split step.

Might be I am getting wrong with get function

I have the structure like below

Transaction 1..1

   lineItem      1..unbounded

     Elements    ...........

I used the funtion get(transaction/lineItem, Index) to map source and target lineitems(same message type) . Did  I got this correct?

Thanks,

Hussein

Former Member
0 Kudos

Hi,

From your error looks like its already going past the maximum lineitem count, do u have a loop as well in the first mapping step ?