cancel
Showing results for 
Search instead for 
Did you mean: 

BPM - ForEach Block

former_member286225
Participant
0 Kudos

Hello experts,

I have developed an interface with the following BPM:

1. <Receive Step>

2. <Transformation Step: 1:N mapping>

3. <Block: ForEach>

4. <Send Step> inside the Block: ForEach

I have created 2 container objects that use the same abstract interface:

1. Object A which is a multiline of the abstract interface - used as

a. the -Target Messages- in <Transformation Step: 1:N mapping>

b. the -Multiline Element- of <Block: ForEach>

2. Object B which is not a multiline of the abstract interface - used as

a. the -Current Line- of <Block: ForEach>

b. the -Message- of <Send Step>

The problem I am facing:

The <Send Step> is not executed and the status of the PE in SXMB_MONI is success.

Any advice would be appreciated.

Regards,

Effi.

Edited by: Effi Olivkovitch on Dec 1, 2009 9:33 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member200962
Active Contributor
0 Kudos
The problem I am facing:
The <Send Step> is not executed and the status of the PE in SXMB_MONI is success.

Configuration within/ related to the BPM Block step are not proper.

Check if you have defined the required Container elements as Multiline, selected the Block under the Container column for the element local to the Block

Cross-check you settings with those mentioned here:

/people/milan.thaker/blog/2008/08/05/modes-in-block-step-of-bpm

Regards,

Abhishek.

former_member286225
Participant
0 Kudos

>

>

The problem I am facing:
> The <Send Step> is not executed and the status of the PE in SXMB_MONI is success.

> Configuration within/ related to the BPM Block step are not proper.

> Check if you have defined the required Container elements as Multiline, selected the Block under the Container column for the element local to the Block

>

> Cross-check you settings with those mentioned here:

> /people/milan.thaker/blog/2008/08/05/modes-in-block-step-of-bpm

>

> Regards,

> Abhishek.

Check if you have defined the required Container elements as Multiline - Yes as stated in my original message.

Cross-check you settings with those mentioned here: - Checked okay.

former_member187339
Active Contributor
0 Kudos

Hi Effi,

>>The <Send Step> is not executed and the status of the PE in SXMB_MONI is success.

Check the communication channel in Send step does it show any error??

Also try to put one more step after BPM to do some dummy thiongs and see whether the BPM is successful or not

Regards

Suraj

former_member286225
Participant
0 Kudos

Hello Suraj,

Thank you for you quick response.

1. The communication channel is status green

2. I added a control step outside and after the block. it executes okay.

I also tested the send step outside the block and it was invoked by the BPM.

One more thing:

In SXMB_MONI I can see only one line from SENDER SYSTEM to BPM. The expected second line from BPM to RECEIVER SYSTEM is not there. (when I tested the send step outside the block, I did get 2 lines).

Regards,

Effi.

Former Member
0 Kudos

Is the 'Create New Trasaction' checked for the send step inside the ForEachBlock

former_member286225
Participant
0 Kudos

>

> Is the 'Create New Trasaction' checked for the send step inside the ForEachBlock

I am using the For Each. The 'Create New Trasaction' in the Send Step was not checked. I Checked it but the problem remains.

former_member187339
Active Contributor
0 Kudos

Hi Effi,

Cross check with the standard BPM pattern in SAP BASIS SWCV

http://help.sap.com/saphelp_nw04/helpdata/en/11/13283fd0ca8443e10000000a114084/frameset.htm

Regards

Suraj

former_member286225
Participant
0 Kudos

>

> Hi Effi,

>

> Cross check with the standard BPM pattern in SAP BASIS SWCV

> http://help.sap.com/saphelp_nw04/helpdata/en/11/13283fd0ca8443e10000000a114084/frameset.htm

>

> Regards

> Suraj

The frameset is not applicable in my situation. The Send step inside the ForEach Block is Async to the same receiver.

I am expecting that after the split to N messages the ForEach Block will iterate through the N messages and send each message using the Send Step.

Did I misunderstand the purpose of the ForEach Block?

Former Member
0 Kudos

receive a message, do 1:n transformation and send the target to receiver. if this is only step multi mapping should b able to do this

tru using a exception in the block. try activating the new transaction for the send step if does not show anyhing try activating new transaction for the block

former_member200962
Active Contributor
0 Kudos
I am expecting that after the split to N messages the ForEach Block will iterate through the N messages and send each message using the Send Step.

Did I misunderstand the purpose of the ForEach Block?

1) You perform 1:N mapping

2) The target messages are all the same.

3) Can be send to multiple receivers .... Updated

This is the way ForEach works

Regards,

Abhishek.

Edited by: abhishek salvi on Dec 1, 2009 3:56 PM

former_member200962
Active Contributor
0 Kudos

If your input message is already having the "n" separate messages ("n" occurences of the node that you want to send as message) OR you collect the "n" different messages first and then call the ForEach block then there is no need of MultiMapping.

Regards,

Abhishek.

former_member187339
Active Contributor
0 Kudos

Hi Effi,,,

You can use the same pattern to send to same receivers (but you can do this without BPM too )

Now in the block have you selected New Transactions? IF not then select and test it

Regards

Suraj

former_member286225
Participant
0 Kudos

>

> If your input message is already having the "n" separate messages ("n" occurences of the node that you want to send as message) OR you collect the "n" different messages first and then call the ForEach block then there is no need of MultiMapping.

>

> Regards,

> Abhishek.

I have the following input message structure (from sender system):

<Message> 1

<Row> 0..n

<Field-1>

<Field-2>

</Row>

</Message>

I want to create for each <Row> a file.

I have the following BPM message structure (Used as Multiline and as Current Line):

<Message> 1

<Field-1>

<Field-2>

</Message>

In the Transformation Step I am performing a 1 to N mapping:

<Messages> 1

<Message1> 1

<Message> 1

<Row> 0..n

<Field-1>

<Field-2>

</Row>

</Message>

</Message1>

</Messages>

To

<Messages> 1

<Message1> 1

<Message> 0..n

<Field-1>

<Field-2>

</Message>

</Message1>

</Messages>

The result is used as input to the ForEach Block.

The ForEach Block should iterate the Multiline sending each line using Sender Step.

former_member286225
Participant
0 Kudos

>

> Hi Effi,,,

>

> You can use the same pattern to send to same receivers (but you can do this without BPM too )

>

> Now in the block have you selected New Transactions? IF not then select and test it

>

> Regards

> Suraj

Hi Suraj,

I took your advice as a temporary solution (I need the BPM to perform later on some additional steps) and I came with the following error:

<SAP:P1>Split mapping created no messages</SAP:P1>

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText />

<SAP:Stack>Split mapping created no messages</SAP:Stack>

<SAP:Retry>M</SAP:Retry>

For some reason the mapping is not correct.

I followed every step in performing the 1:N mapping and I do not understand why I get this error.

The payload of the source message contains 5 rows.

At the moment I have to assume that the BPM ForEach Block was a false conclusion and the problem lies with the mapping.

former_member187339
Active Contributor
0 Kudos

Hi Effi,

Have you tested your multimapping in Message Mapping?? Is it creating N outputs??

Can you paste here the input file as given for your end to end testing... Make sure you dont have Messages and Message1 in the structure ie your input file should look something like


<Message> 1
<Row> 0..n
<Field-1>
<Field-2>
</Row>
</Message>

Regards

Suraj

Former Member
0 Kudos

in the signature tab in message mapping make sure for the target message type the occureence is 1...Unbounded and the message type is mapped to Row as you need to split the target for every Row (in source)

make sure u do the same for interface mapping

former_member286225
Participant
0 Kudos

>

> Hi Effi,

>

> Have you tested your multimapping in Message Mapping?? Is it creating N outputs??

>

> Can you paste here the input file as given for your end to end testing... Make sure you dont have Messages and Message1 in the structure ie your input file should look something like

>

>


> <Message> 1
> <Row> 0..n
> <Field-1>
> <Field-2>
> </Row>
> </Message>
> 

>

> Regards

> Suraj

Hi Suraj,

I tested the mapping in the test tab in ESR giving dummy values and the test was successful.

The test xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
   <ns0:Message1>
      <ns1:EDI_Extracts xmlns:ns1="urn:zim.com:tests">
         <Row>
            <EDI_EXTRACT_ID/>
         </Row>
      </ns1:EDI_Extracts>
   </ns0:Message1>
</ns0:Messages>

I also took the payload of the source message, put the Row elements inside the test xml and it was successful.

The payload I see in SXMB_MONI for the source message is as follows:

<?xml version="1.0" encoding="utf-8"?>
<ns:EDI_Extracts xmlns:ns="urn:zim.com:tests">
	<row>
		<EDI_EXTRACT_ID>3141618</EDI_EXTRACT_ID>
		<EDI_EXTRACT_TYPE>M</EDI_EXTRACT_TYPE>
	</row>
	<row>
		<EDI_EXTRACT_ID>5192509</EDI_EXTRACT_ID>
		<EDI_EXTRACT_TYPE>A</EDI_EXTRACT_TYPE>
	</row>
	<row>
		<EDI_EXTRACT_ID>656869</EDI_EXTRACT_ID>
		<EDI_EXTRACT_TYPE>M</EDI_EXTRACT_TYPE>
	</row>
	<row>
		<EDI_EXTRACT_ID>656867</EDI_EXTRACT_ID>
		<EDI_EXTRACT_TYPE>M</EDI_EXTRACT_TYPE>
	</row>
	<row>
		<EDI_EXTRACT_ID>9686612</EDI_EXTRACT_ID>
		<EDI_EXTRACT_TYPE>M</EDI_EXTRACT_TYPE>
	</row>
</ns:EDI_Extracts>

Kind regards,

Effi.

former_member286225
Participant
0 Kudos

>

> in the signature tab in message mapping make sure for the target message type the occureence is 1...Unbounded and the message type is mapped to Row as you need to split the target for every Row (in source)

>

> make sure u do the same for interface mapping

Hi Kumar,

The only option available in the Signature tab is 0..unbounded.

In message mapping I specified the occurrence of the target message 0..unbounded

In operation mapping (I use PI 7.1) I specified the occurrence of the target message 0..unbounded

Also, the Row element in the source message which is defined as 0..unbounded is mapped to the message type (which is 0..unbounded after changing the occurrence) of the target message.

Regards,

Effi.

Former Member
0 Kudos

is testing form Operation mapping OK. try to test from ID test configuration

if all is fine do a delta/full cache refresh

former_member286225
Participant
0 Kudos

Hi Kumar,

The test results in OM is as follows:

Source-

<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
   <ns0:Message1>
      <ns1:MT_EDIExtractsKeys xmlns:ns1="urn:zim.com:tests">
         <row>
            <EDI_EXTRACT_ID>4223142</EDI_EXTRACT_ID>
         </row>
         <row>
            <EDI_EXTRACT_ID>4223143</EDI_EXTRACT_ID>
         </row>
         <row>
            <EDI_EXTRACT_ID>4223188</EDI_EXTRACT_ID>
         </row>
         <row>
            <EDI_EXTRACT_ID>4223225</EDI_EXTRACT_ID>
         </row>
         <row>
            <EDI_EXTRACT_ID>4223226</EDI_EXTRACT_ID>
         </row>
      </ns1:MT_EDIExtractsKeys>
   </ns0:Message1>
</ns0:Messages>

Target-

<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
   <ns0:Message1>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223142</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223143</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223188</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223225</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223226</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
   </ns0:Message1>
</ns0:Messages>

But, inside the BPM, The transformation step (which use this OM) does not seem to do the trick.

Looking at the transformation step in PE workflow monitoring:

The MESSAGES table inside the MESSAGES_IN contains 1 element (which is the source message).

But, the MESSAGES table inside the MESSAGES_OUT contains no entries.

Edited by: Effi Olivkovitch on Dec 2, 2009 10:17 AM

Former Member
0 Kudos

check if this helps

former_member286225
Participant
0 Kudos

>

> check if this helps

>

Hi Kumar,

The problem I am facing is not as described in the thread you suggested.

I have defined the container elements properly.

It seems that the transformation prior to the ForEach Block does not return a split message as expected. So, the loop does not take iterate.

Regards,

Effi.

Former Member
0 Kudos

did u get any error after enabling new transaction for the block and for the individual prcesses

former_member187339
Active Contributor
0 Kudos

Hi Effi...

Just saw your source and target the target is incorrect.

It should have been


<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
   <ns0:Message1>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223142</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
 </ns0:Message1>
 <ns0:Message1>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223143</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
 </ns0:Message1>
 <ns0:Message1>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223188</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
 </ns0:Message1>
 <ns0:Message1>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223225</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
 </ns0:Message1>
 <ns0:Message1>
      <ns1:MT_EDIExtractKey xmlns:ns1="urn:zim.com:tests">
         <EDI_EXTRACT_ID>4223226</EDI_EXTRACT_ID>
      </ns1:MT_EDIExtractKey>
   </ns0:Message1>
</ns0:Messages>

Change your multi-mapping to create a structure as this above and check your BPM.. Also tell how the signature tab of Message and Operation mapping looks like.. I guess you changed the occurrences there..

Try to make a output like the one above and it will work..

Regards

Suraj

former_member200962
Active Contributor
0 Kudos

The basic message structure included in the MultiLine element and Current Line element should be the same.....both should refer to the same MI in the container variables list.

CurrentLine element should be restricted for the Block only.

Do not change the occurence of the message in the Signature tab of MM/ OM.....it does not fit into the logic.

Regards,

Abhishek.

former_member286225
Participant
0 Kudos

Hi Suraj,

In MM: <Source Message> 1 -> <Target Message> 0..Unbounded

In OM: <Source Operation> 1 -> <Target Operation> 0..Unbounded

The mapping is done automatically.

I can not see how I can change the mapping to come up with the result structure you suggested.

The original source message is:

<MT_EDIExtractsKeys>
   <row> 0..unbounded
      <EDI_EXTRACT_ID> 1 

The original target message is:

<MT_EDIExtractKey>
   <EDI_EXTRACT_ID> 1 

The original message after defining multimapping:

<Messages> 1..1
   <Message1> 1..1
      <MT_EDIExtractsKeys> 1..1
         <row> 0..unbounded
            <EDI_EXTRACT_ID> 1..1 

The target message after defining multimapping:

<Messages> 1..1
   <Message1> 1..1
      <MT_EDIExtractKey> 0..unbounded
         <EDI_EXTRACT_ID> 1..1 

Field <row> is mapped to Field <MT_EDIExtractKey>

Field <EDI_EXTRACT_ID> is mapped to Field <EDI_EXTRACT_ID>

Regards,

Effi.

former_member187339
Active Contributor
0 Kudos

Hi Effi,

The BPM will work only if the output is as suggested in my previous thread..

Try changing the signature of message types and you may also need to change the mapping logic..

Regards

Suraj

former_member286225
Participant
0 Kudos

>

> The basic message structure included in the MultiLine element and Current Line element should be the same.....both should refer to the same MI in the container variables list.

> CurrentLine element should be restricted for the Block only.

> Do not change the occurence of the message in the Signature tab of MM/ OM.....it does not fit into the logic.

>

> Regards,

> Abhishek.

Hi Abhishek,

1. The basic message structure included in the MultiLine element and Current Line element should be the same - They refer to the same MI.

2. CurrentLine element should be restricted for the Block only - Restricted

3. Do not change the occurence of the message in the Signature - ??? If I do not change the occurrence, there is no 1:N mapping and the PE crashes.

former_member286225
Participant
0 Kudos

>

> Hi Effi,

>

> The BPM will work only if the output is as suggested in my previous thread..

>

> Try changing the signature of message types and you may also need to change the mapping logic..

>

> Regards

> Suraj

Hi Suraj,

I guess there is a bug in PI because I can not see a way to make <Message1> occure more than once at the head of the message.

The tags: <Messages> and <Message1> are added outomatically by PI.

Regards,

Effi.

former_member187339
Active Contributor
0 Kudos

Hi Effi,

It is not a bug.. PI added it for you because you have changed the occurrence to 0..unbound.. but this doesnot guarantee multimapping.. For making a multimapping, either you add the same target structure once more as target (ie twice in signature tab)or else need to try some other methods..

Regards

suraj

former_member286225
Participant
0 Kudos

>

> Hi Effi,

>

> It is not a bug.. PI added it for you because you have changed the occurrence to 0..unbound.. but this doesnot guarantee multimapping.. For making a multimapping, either you add the same target structure once more as target (ie twice in signature tab)or else need to try some other methods..

>

> Regards

> suraj

Hi Suraj,

The option of adding more target structure is not possible because the source message contains multiple elements being populated at runtime (by querying a database).

I am familiar with the option of spiting a message to n different messages. Maybe I misunderstood the functionality of 1:N mapping and the thing I am trying to achieve is impossible.

using the 0..Unbounded option does split the message to n messages (based on the amount of row elements). The problem is: it does not comply with transformation step which is being followed by a ForEach Block.

Regards,

Effi.

former_member200962
Active Contributor
0 Kudos
If I do not change the occurrence, there is no 1:N mapping and the PE crashes.

You dont need a 1:N mapping to achieve ForEach block

You dont need to change the occurence in Signature tab.

You just need to ensure that the multiline message entering the Block is of the following structure:

<SRC>

<Node>

<Node>

<Node>

</SRC>

Now based on the occurence of the Node element your ForEach block wil be executed. In the above case the send step within block will be executed thrice.

The element that you configure inside the block will be like (this is how the message will look in the send step of the Block):

<SRC>

<Node>

</SRC>

When you say multimapping/ 1:N mapping you are actually doing the following:

<SRC>

<Node>

</SRC>

<SRC>

<Node>

</SRC>

<SRC>

<Node>

</SRC>

Which is not the way. Multimapping does not work for Sequential processing....whereas the main intention of using ForEach block is Sequential processing....this is the difference.

Regards,

Abhishek.

former_member286225
Participant
0 Kudos

Hi Experts,

The problem has been resolved.

I took a look at the payload of the incoming message (it is from a database) and I realized that the namespace is not correct.

In the JDBC sender comm channel I put an old structure name in the document name field which made the payload inconsistent with the source message in the mapping program.

That is the reason the transformation did not take place and the resulting ForEach Block failure (Idiot me ...).

After correcting the document name in the comm channel, everything is working like a charm.

I would like to take this opportunity and thank all participants in this thread for the time and effort helping me resolving my problem.

Kind regards,

Effi.