cancel
Showing results for 
Search instead for 
Did you mean: 

MessageMapping CounterPart of CopyValue

Former Member
0 Kudos

Hello,

There is one standard node function copyvalue available in XI, what I need now is the counterpart of copyvalue, actually the source structure has more than one elements which should be mapped to one repeated structure.

One example as in help.sap.com documented, just anotherway around.

source

customer (0..unbounded)

name 1

street 1

city 1

zipcode 1

target

partner (0..unbounded)

name 1

addrDate ( 0..unbounded)

street, city, zipcode, should generate in this case 3 addrDate in partner under one partner Element.

Is there some standard way to do it in message mapping or should I write UDF for this ? Thanks for help !

regards,

Hai

Accepted Solutions (1)

Accepted Solutions (1)

former_member187437
Contributor
0 Kudos

Hi,

By right clicking the addrData node in the Target message type and selecting Duplicate option, you can create 3 addrData nodes. For the first node, you map street, and for the second node, map City.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi, Hai:

I did similar scenario recently, and it is not possible without using UDF.

The problem is there is no standard function that get the number of elments (I mean nodes) under one particular context, if there is one, this scenario can be easily handled.

Regards.

Liang

Former Member
0 Kudos

Hi Liang,

it is actually quite simple with the duplicate subtree function, you don't need the UDF. Try it out.

regards,

Hai

Former Member
0 Kudos

Thanks Hai.

Nice to know.

Liang

Former Member
0 Kudos

Hi Liang,

We have a similiar kind of problem.We have to repeat segments in the same context.

We will try using the duplicate subtree but also wanted to know how you solved the same issue using UDF.

If you can provide with the code would be gr8.

If you want me to opena new thread I can.

Many thanks.

regards

ahmed

Former Member
0 Kudos

Hi

Why do you need the function calculating number of nodes? If you want to produce the same number of elements on the target side, you just map the field directly without any function.

With the original problem in the start of this topic - that's another problem. That's grouping addresses based on customer name.

It can be solved by standard functions if the customer segments are sorted by name. Otherwise it can be done only with UDFs

Best regards

Dmitry

Former Member
0 Kudos

Hi, parvez:

Since the thread has been closed, I did not watch it, I am not sure if you are still want to know UDF solution, if yes, can you open new thread, then I response from there.

Thanks

Liang

Former Member
0 Kudos

Hi,

In the message mapping in the target structure just do duplicate subtree on the field addrDate to get it 3 times.

after that just map

street-->addrdate

city-->addrdate[1]

zipcode-->addrDate[2]

Hope this will help you.

**Reward points if helpful.

--Sankar Choudhury

former_member518917
Participant
0 Kudos

Hi,

You can create multiple addrDate (here 3) under partner using duplicate subtree and map the three fields to each subtree.

Former Member
0 Kudos

Hi,

if the length of your elements in the source structure is fix you can use the substring standard function.

Regards

Patrick

Former Member
0 Kudos

Hi Patrick,

First there are not fixed length, it is just three different xml element in the customer. Apart from this fact, how could substring function produce 3 addrDate element within the correct context in this case ? I don't understand it all, please clearify.

Thanks.

Hai

Former Member
0 Kudos

Hi,

sorry there was a misunderstanding at my side.

Regards

Patrick