cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping multiple source fields to same target field

Former Member
0 Kudos

Hi All,

I have a field called <b>Note</b> in my target message. The occurrence is 0..1. And in my source message there are many fields which are to be mapped to this field. For example if the source message is:

<sourceMessage>

-


Other Elements----

<name>Sandeep</name>

<phone>88665434</phone>

<location>Bangalore</location>

</sourceMessage>

In the target message this should appear as follows:

<targetMessage>

-


Other Elements----

<note>Sandeep</note>

<note>88665434</note>

<note>Bangalore</note>

</targetMessage>

How can I achieve this using the graphical mapping tool (Message Mapping). Can any node functions help?

Many Thanks,

Sandeep

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

Use the feature "Duplicate Subtree".

http://help.sap.com/saphelp_nw04/helpdata/en/2f/5bc63d15431352e10000000a114084/frameset.htm

Click right on the target field node to open the context menu.

Regards

Stefan

Message was edited by: Stefan Grube

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Sandeep,

Do post the solution at the end...we'd like to know what worked in the end:)

Regards,

Sushumna

Former Member
0 Kudos

Hi Sushumna,

I'll surely do that. I have so many solutions right now from all of you and am in the process of trying them out :-). I'll also be rewarding the points to you all as well

Thanks Everybody,

Sandeep

Former Member
0 Kudos

Former Member
0 Kudos

Hi All,

I tried the solution suggested by Stefan since it appeared to be the most simple one and it worked correctly. I'm sure that there could be other solutions as many of you suggested but I have to try them yet.

Thanks Stefan and Everybody,

Sandeep

Former Member
0 Kudos

Hi Sandeep

You could also use SplitByValue node function as it creates a new context, if your target node is only one.

Also if your

<b>Note</b> node's occurence is 0 to 1 you cannot have multiple <b>Note</b> nodes. You have to change the occurence.

Regards

Padmaja

Former Member
0 Kudos

Hi Sandeep,

I think you can use a user defined function to achieve this.

Give all the input nodes as parameters to the UserDefinedFunction.

Then for each value add that value to the resultList.

Map the output of the UserDefinedFunction to the target node.

The code for this is

public void create(String[] a,String[] b,String[] c,ResultList result,Container container){
result.addValue(a[0]);
result.addValue(b[0]);
result.addValue(c[0]);
}

where create is the user defined function.

the mapping will be like


name ----------
phone ------- create -------- note
location ----------

Hope this helps.

regards,

P.Venkat.

Message was edited by: Venkataramanan

Message was edited by: Venkataramanan

Former Member
0 Kudos

Hi Sandeep,

Use the "createif" node to create the node in the target side for every tag present in the source side. And then give the value of the source node in it.

Go through the following blog by Sravya regarding node functions:-

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

Regards,

Sushumna