cancel
Showing results for 
Search instead for 
Did you mean: 

N:1 Multi mapping Not working !!

Former Member
0 Kudos

Hi Guys,

I have input xml message structure as follows:

<ROOT>
    <OUTPUT>    ----------------------0..n
        <XQ_Segment>  ---------------- 0..1
                XQ_DATA  -----------------0..1
                XQ_Value  -----------------0..1
         </XQ_Segment>
         <DTM_Segment> --------------0..n
             <DATES>         --------------0..1
                   Receiving_Date --------0..1
                   Process_Date   --------0..1
             </DATES>
          </DTM>
      </OUTPUT>
  </ROOT>

like 'n' number of input message ---> mapping into target message (both side message structures are same). Basically I am merging 'n' number messages. Using BPM working fine. Rather bundling 10 messages, 10 individual messages are coming out. I am using CollectTime patter.

Please can any give me their very good exposure how to map these source and target messages? Field level, Node level etc.,

Many Thanks in advance

Kind Regards

San

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If Your souce Test message for Example is like given below


<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
   <ns0:Message1>
      <ns1:MT_Test_Forum xmlns:ns1="http://YH1309/TestMapping">
         <Root>
            <Output>
               <XQ_Segment>
                  <XQ_DATA>data1</XQ_DATA>
                  <XQ_Value>value1</XQ_Value>
               </XQ_Segment>
               <DTM_Segment>
                  <DATES>
                     <Receiving_Date>dateReceive1</Receiving_Date>
                     <Process_Date>DateProcess1</Process_Date>
                  </DATES>
               </DTM_Segment>
            </Output>
            <Output>
               <XQ_Segment>
                  <XQ_DATA>data111</XQ_DATA>
                  <XQ_Value>value111</XQ_Value>
               </XQ_Segment>
               <DTM_Segment>
                  <DATES>
                     <Receiving_Date>dateReceive111</Receiving_Date>
                     <Process_Date>DateProcess111</Process_Date>
                  </DATES>
               </DTM_Segment>
            </Output>
         </Root>
      </ns1:MT_Test_Forum>
      <ns1:MT_Test_Forum xmlns:ns1="http://YH1309/TestMapping">
         <Root>
            <Output>
               <XQ_Segment>
                  <XQ_DATA>data2</XQ_DATA>
                  <XQ_Value>value2</XQ_Value>
               </XQ_Segment>
               <DTM_Segment>
                  <DATES>
                     <Receiving_Date>dateReceive2</Receiving_Date>
                     <Process_Date>DateProcess2</Process_Date>
                  </DATES>
               </DTM_Segment>
            </Output>
         </Root>
      </ns1:MT_Test_Forum>
   </ns0:Message1>
</ns0:Messages>

and You want to get the Target Message as


<?xml version="1.0" encoding="UTF-8"?>
<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
   <ns0:Message1>
      <ns1:MT_Test_Forum xmlns:ns1="http://YH1309/TestMapping">
         <Root>
            <Output>
               <XQ_Segment>
                  <XQ_DATA>data1</XQ_DATA>
                  <XQ_Value>value1</XQ_Value>
               </XQ_Segment>
               <DTM_Segment>
                  <DATES>
                     <Receiving_Date>dateReceive1</Receiving_Date>
                     <Process_Date>DateProcess1</Process_Date>
                  </DATES>
               </DTM_Segment>
            </Output>
            <Output>
               <XQ_Segment>
                  <XQ_DATA>data111</XQ_DATA>
                  <XQ_Value>value111</XQ_Value>
               </XQ_Segment>
               <DTM_Segment>
                  <DATES>
                     <Receiving_Date>dateReceive111</Receiving_Date>
                     <Process_Date>DateProcess111</Process_Date>
                  </DATES>
               </DTM_Segment>
            </Output>
            <Output>
               <XQ_Segment>
                  <XQ_DATA>data2</XQ_DATA>
                  <XQ_Value>value2</XQ_Value>
               </XQ_Segment>
               <DTM_Segment>
                  <DATES>
                     <Receiving_Date>dateReceive2</Receiving_Date>
                     <Process_Date>DateProcess2</Process_Date>
                  </DATES>
               </DTM_Segment>
            </Output>
         </Root>
      </ns1:MT_Test_Forum>
   </ns0:Message1>
</ns0:Messages>

Then do the Mapping as follows

Output(Change the Context to Message1)----


>Output.

For all other fiels just do the direct mapping from source Root toTarget Root .and similarly for other fields

You can also refer this wiki as a reference to collect message and bundle then into one message using BPM pattern

http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=133562783

Regard ,

Kubra fatima.

Edited by: Kubra fatima on Jul 19, 2010 7:33 AM

Answers (1)

Answers (1)

Former Member
0 Kudos

Just check if you have done following properly:

1) Message Mapping, Source Message Occurence is 0:unbound, target message is 1:1

2) Operation Mapping (Message Mapping), Source is 0:unbound, target is 1:1

3) In Message Mapping, target only, you can map any constant value to target message type node

4) In Target message, only one Root node need to be created, so you can also map a constant value to it.

5) ROOT in source will map to our OUTPUT in target, I guess (you have to carify how you merge your data in business level).

Regards

Liang

Former Member
0 Kudos

Hi Liang,

I have done all the things what ever you mentioned in previous step, still I am getting the same way. If I send n input messages, I am getting n output messages.

few questions please, we are not mapping source output tag.

In test tab, if duplicate <ROOT> tag, I am getting only one <OUTPUT> tag, the second dupicated <ROOT> node <OUTPUT> tag is not appearing.

The last but not leaset, if I would have more than one <OUTPUT> tag under one <ROOT> message, I am not getting all <OUTPUT> tags, only one OUTPUT tag is coming from target message.

I will appreciate for your quick and positive response.

Many Thanks

San

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi ,

i assuming that your expected out will be like this , take an example of 2 messages, is it correct??if it not post your structure.

are you suree the patter what you have implemented merging messages??

<ROOT>
    <OUTPUT>    ----------------------0..n
        <XQ_Segment>  ---------------- 0..1
                XQ_DATA  -----------------0..1
                XQ_Value  -----------------0..1
         </XQ_Segment>
         <DTM_Segment> --------------0..n
             <DATES>         --------------0..1
                   Receiving_Date --------0..1
                   Process_Date   --------0..1
             </DATES>
          </DTM>
      </OUTPUT>
<OUTPUT>    ----------------------0..n
        <XQ_Segment>  ---------------- 0..1
                XQ_DATA  -----------------0..1
                XQ_Value  -----------------0..1
         </XQ_Segment>
         <DTM_Segment> --------------0..n
             <DATES>         --------------0..1
                   Receiving_Date --------0..1
                   Process_Date   --------0..1
             </DATES>
          </DTM>
      </OUTPUT>

  </ROOT>

Regards,

Raj

former_member200962
Active Contributor
0 Kudos
The last but not leaset, if I would have more than one <OUTPUT> tag under one <ROOT> message, I am not getting all 
<OUTPUT> tags, only one OUTPUT tag is coming from target message.

Is the context handled properly for the source node?

Raise the context to the highest possible node.....if this is not done then only the first reference of the source message is considered and the rest are left un-noticed.....and if i am not wrong the one OUTPUT tag that you are getting would be containing first source message details.

Regards,

Abhishek.

Former Member
0 Kudos

Hi Guys,

Thanks your quick response back. I don't think so the messages are merging. I have taken CollectTime pattern exactly like under SAP Basis patterns. Deadline branch Duration I have taken 1 minute. What happening now, the sender sending (Business Services) 2 messages(for test scenario) these two messages are going to BPM, the process is waiting more than 2 minutes(I don't know why), then two messages are coming to target Business Services to my application server folder. I am keeping my source and target structure in the following links. Please will give your idea on this.

I am sure I am wrong in my mapping thing. Please can you give me your valuable points in this.

http://img827.imageshack.us/img827/3061/map2.jpg

http://img829.imageshack.us/img829/7258/map1.jpg

I will really appreciate your help guys, to resolve this issue.

Many Thanks

Regards

San

Former Member
0 Kudos

Dont add source message multiple times .Just add only one time as source message but change the occurence to 0..unbounded.

also dont forget to change the mapping as mentioned in my previous reply.

I think now It works fine as now it will not create Message2 tag

Edited by: Kubra fatima on Jul 19, 2010 7:41 AM

Former Member
0 Kudos

Hi Fathima,

Really good. I am nearly there. Now I can able to see merging. If i send 3 messages comes as one output, perfect. I change the mapping like the link you sent me. Only first message one <OUTPUT> tag is coming. Please push me a bit, I belive you can do this.

One more question that link counter has got definate counter, like 2 or 3 etc., Incase if I don't know howmany input messages I am getting, what do I do pls?

Your spontaneous response will be much appreciate.

Kind Regards

San

former_member200962
Active Contributor
0 Kudos
Only first message one <OUTPUT> tag is coming.

Did you set the Context properly?

One more question that link counter has got definate counter, like 2 or 3 etc., Incase if I don't know howmany input 
messages I am getting, what do I do pls?

In that case you should implement Time-Dependent or Message-Dependent pattern.....i hope you are asking for the counter value specified in the BPM for the loop.

Regards,

Abhishek.

Former Member
0 Kudos

Hi ASandhya ,



 I change the mapping like the link you sent me. Only first message one <OUTPUT> tag is coming. Please push me a bit,

I think You have missed one point from my previous reply


Then do the Mapping as follows
Output(Change the Context to Message1)----------->Output.

right click on the Output field of the source message and selct Context ,Message1.

As your requirement is to Collect and Bundle Messages from One Interface

There are three ways of doing it as mentioned in this link

http://help.sap.com/saphelp_nwpi711/helpdata/en/3c/831620a4f1044dba38b370f77835cc/frameset.htm

and The link that I have mentioned for collect the message is based on Payload depended.In your case as you dont know the no of message to be collected and it dependens on Time..then You have to go for

Time-Dependent Loop .

The most important is your transformation step after the loop ends.

So I suggest you to check your mapping in the test tab by duplicating the requirend nodes.

Regards ,

Kubra fatima