cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Mapping

Former Member
0 Kudos

Hi,

I have a scenario where I need to use multi mapping (1:N). When we do that in mapping editor, SAP adds our message <Message> & <Message1&2>

So for e.g. our message is Mt_test1 & MT_test2 after having (1: N) it will look like

<Messages>

<Message1>

<MT_test1>

</MT_test1>

</Message1>

<Message2>

<MT_test2>

</MT_test2>

</Message2>

</Messages>

(1) I did not understood why it is done

(2) Cardinality of both Message & Message1, Messag2 is set to 1:1 by default by SAP.

I have a condition that if the data in MT_test1 comes blank , than I should not generate any message.

While putting the condition, createif, I am facing an runtime error since the Message & message1 &2 are set to 1:1 which prevent it from creating nothing..

Can you advice, how can I achieve this condition or change the cardinality of Message to 0..1

Thanks

Accepted Solutions (0)

Answers (6)

Answers (6)

jyothi_anagani
Active Contributor
0 Kudos

Hi,

You can set the occurence. Goto messages tab in message mapping and there while giving the meessage type you can set the occurence also.There give that as 0..1 or whatever you want. But it will assign that occurence to Message Type. No need to worry about message1 or message2 occurence. Your message type is important. Do this. It will really solve your problem.

Thanks.

Former Member
0 Kudos

If the source or target structure can comprise multiple messages, the mapping editor creates a sub-structure for both the source and the target structure in which the source and target messages are stored.

The root element is always <Messages> in a case like this.

The mapping editor inserts an element <MessageN> for each source or target message, where N is the position of the message according to the Messages tab page

Kindly check this for detail [http://help.sap.com/saphelp_nw04/helpdata/en/21/6faf35c2d74295a3cb97f6f3ccf43c/frameset.htm]

Instead of mapping to Target Message1 map the source field to Target MT_tes1 and change it occurence to 0..1

Use the below target field Mapping


MT_test1----removeContext------equalS------not-----ifWithoutElse-----MT_test1(TargetField)
                         Contant[]/                   MT_test1  /

Dont give any value in the constant

Edited by: Kubra fatima on May 12, 2009 6:53 AM

sunil_singh13
Active Contributor
0 Kudos

Hi,

Don't Bother about the <Message> node as it is introduced by the XI, It will take care of that :-).

You can check that by testing it without mapping the <Message> node.

But if you map this node with the node from source side then it becomes your responsibilty to creat this node and if you faild in doing that you will be in geoparadise so leave this node for XI, you look for the node in the target side on which you want to implement the logic.

Thanks

Sunil Singh

samiullah_qureshi
Active Contributor
0 Kudos

You just need to put condition on MT_test1. No need to bother abt the occurrece of the Messsages, Message1...

As Prateek replied SAP introduced Messages, Message1 to follow the xml standard. So that generated xml will be compatible to the standards.

prateek
Active Contributor
0 Kudos

(1) I did not understood why it is done

Its because the format of message must be an xml file. If there are multiple messages, then to collect them under a single root node, this structure is used.

For you scenario, are you handling the mapping condition at the node level MT_test1. Your condition should be at this level only.

Regards,

Prateek

Former Member
0 Kudos

Hi,

As the structure suggests, Messages will have many messages like Message1, Messages 2, Messages3.

SAP when made this facility available, made it such that atleast one messages (1.....n)should exists for Messages node.

We cannot change the cardinality of Messages from 1...1 to 0..1 as per /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change

this is because Message1...2...3 is not present in interface level. this is something SAP has placed after selecting Multi mapping in Message mapping.

In MM, if you check the XSD, you will see...

<xsd:element name="Message1" form="qualified">

But the cardinality of the messages is not given.

There is a work around....

Repeat the Message ( duplicate the messages)

map it with a constant..

do not map the subsequent fields.

It will generate empty messages... if you have a File CC on the receiver, just select Do not process empty messages.

Remember, if u have other Adapter at the receiver, it will try to process empty messages.

This is just a work around..

Regards,

Venkat.