cancel
Showing results for 
Search instead for 
Did you mean: 

How to merge two messages into one?

Former Member
0 Kudos

Hello

I have two messages coming into PI, one containing a list of order header information, and the second message contains the order items of the orders contained in the first message. I need to merge these two messages into one oder message that contains both the header and item data.

Certainly I need BPM to collect the two messages, my question is how to define the message mapping to merge an order header message and an order item message into one (Note, order header message contains a list of orders' header data). Anyone has an idea how to do it in graphic mapping?

If graphic mapping not possible, I guess I would need to do it in Java mapping. However the method transform(TransformationInput arg0, TransformationOutput arg1) of the AbstractTransformation only take one inputstream as input, normally the inputstream contains data of one xml document (so I can jsut conver the content of the inputstream into an xml document and work on it), now I have two messages as input, how can I get it from the inputstream then?

Thank you guys for input.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hey Jayson,

I am sure there will be more ways of handling this; however off the top of my head and still do able in graphical mapping, you can do two mappings one for header then for order and in the operations mapping put them in sequence.

regards

Answers (4)

Answers (4)

Former Member
0 Kudos

Using UDF to take process the whole queue solves my issue.

Thanks, guys

Former Member
0 Kudos

Hi, Jason:

As replied from other SDNers, graphical mapping can be used in your situation.

Steps:

1. Design your Message Mapping:

1.1 Put MT_PO_Header as normal source message, MT_Target as your target message

1.2 In Signature Tab, add your MT_PO_Item as second source message

After you have done above steps, go back your design tab, you will see your PO header message show up under

Message1 and PO Item message under Message2. Your target message show under Message1

1.3 Finish your mapping design

2. In your Operation Mapping, make sure your source interface has two: SI_PO_Header_Abs and SI_PO_Detail_Abs, and the target is just one: SI_Target_Abs. Then add above message mapping as mapping program. (They are all Abstract Interface)

3. Design your BPM to call your mapping program in Transformation Step.

Regards

Liang

Former Member
0 Kudos

Hi Guys,

thanks for your response. It seems like I didn't express my issue clearly.

I know very well how to make hte mapping 1:N or N:1 or N:M whatsoever. My issue is, how to merge the two messages into one once the signature tab definition is done.

Basically I can map the OP_Item node (source) to the PO_Target (target) so that the same number of PO_Target lines are created as of the PO_Item. However how to fill the header data fields of PO_Target with the PO_Header(source)? Remember PO_Header and PO_Item are two separate messages, both contain data for multiple POs (on header and item level).

Basically when I create a PO_Target node taking the data from PO_Item, how can I then take data from PO_Header to fill the corresponding header fields of the PO_Target?

NOt sure if you can understand what I mean.

Thanks again

Former Member
0 Kudos

Jayson:

Thanks for the clarification of your issue.

Correct me if I am wrong: you have two mult-line messages on source, on target side, you have combined one target message.

Then next question for you is how did you collected the two types of message: what correlation you specified in your message collection, all those will affect how you achieve your mapping.

Regards

Liang

Former Member
0 Kudos

You are right, Liang. The two source messages contains multiple lines for multiple orders data.

The BPM is pretty simple, I don't even need correlation, because we will make sure only two messages (PO_Header and PO_Item) come into PI at a time. Once it's processed, another two messages will be sent to PI. So no correlation is needed. BPM just wait for two messanges coming in, so two receiver steps with fort.

Former Member
0 Kudos

Jayson

If the sequence of the header in message 1 and sequence of the orders in message 2 is same, it should be easy to map to target.

If not, they must have business rules to connecting them, then you can use mapping logic to achieve it.

If this is not helpful to you, you can post your data types for both side, includes some sample data, so we can see if I can help you.

Regards

Liang

prateek
Active Contributor
0 Kudos

Jayson, graphical mapping is very much possible. Just search for "N:1" or "1:N" multimapping blogs and you will get enough information with screenshots.

Regards,

Prateek

samiullah_qureshi
Active Contributor
0 Kudos

Create a graphical mapping. Go to Signature tab of the mapping. Here you can add n number of messages for source and target of the message mapping. In your case, you have to add two messages for source and one message for target. After switch to Definition tab of the mapping. You will see source and target as per messages u selected in signature.