cancel
Showing results for 
Search instead for 
Did you mean: 

question of UseOneAsMany

Former Member
0 Kudos

hi, guru

I have a source as below

<source>

<record typeA="xx" typeB="yy">

<name>name1</name>

</record>

<record typeA="xx" >

<name>name2</name>

</record>

</source>

I'd like to create output as

<target>

<record>

<type>typeA</type>

<value>xx</value>

<name>name1</name>

</record>

<record>

<type>typeB</type>

<value>yy</value>

<name>name1</name>

</record>

<record>

<type>typeA</type>

<value>xx</value>

<name>name2</name>

</record>

</target>

How do I write this mapping? UseOneAsMany? please help , thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

anybody can help?

Former Member
0 Kudos

Hi,

here you need to use the count of the attributes and pass it to the function of useone as many second and third values and use name1 as the first field...

HTH

Rajesh

Former Member
0 Kudos

here you need to use the count of the attributes and pass it to the function of useone as many second and third values and use name1 as the first field...

HTH

Rajesh

thanks, but how can count the attribtues for there are two different attributes. Can you show me the details

Former Member
0 Kudos

Its usually used when we want a field value from source(occurence 0..1 or 1..1) to be repeated multiple times in target structure.

Following link would give you more on useOneAsMany : http://help.sap.com/saphelp_nw04/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/frameset.htm

Regards

Soumen...

Former Member
0 Kudos

ts usually used when we want a field value from source(occurence 0..1 or 1..1) to be repeated multiple times in target structure.

Following link would give you more on useOneAsMany : http://help.sap.com/saphelp_nw04/helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/frameset.htm

Regards

Soumen...

Thanks, I did read this link, however I did not under the 3nd parameter well.

former_member200962
Active Contributor
0 Kudos

however I did not under the 3nd parameter well.

Did the below line did not help:

The field that can occur more than once is expected as the third parameter. In our example, this is name

If you see in the source XML that is shown in the help section you will find that name field occurs multiple times within an order node whereas type field ocurs just once hence type is the first parameter while name is the second parameter...you can even refer this blog which shows the similar behaviour without SpliByValue function.

Regards,

Abhishek.

Former Member
0 Kudos

Did the below line did not help:

The field that can occur more than once is expected as the third parameter. In our example, this is name

If you see in the source XML that is shown in the help section you will find that name field occurs multiple times within an order node whereas type field ocurs just once hence type is the first parameter while name is the second parameter...you can even refer this blog which shows the similar behaviour without SpliByValue function.

Regards,

Abhishek.

Thanks, but I think this help doc is a little different from my case.

I have 2 attributes typeA and typeB, they may or may not appear, I'm not sure how to use them as the parameters to UseOneAsMany.

former_member200962
Active Contributor
0 Kudos
have 2 attributes typeA and typeB, they may or may not appear, I'm not sure how to use them as the parameters to 
UseOneAsMany.

you cant use both of them, only one needs to be used.....and they need to be present if you want the source node (parameter1) to be repeated in the target some number of times.

Former Member
0 Kudos

>

>

have 2 attributes typeA and typeB, they may or may not appear, I'm not sure how to use them as the parameters to 
> UseOneAsMany.

> you cant use both of them, only one needs to be used.....and they need to be present if you want the source node (parameter1) to be repeated in the target some number of times.

sorry for again.

I think I'm not smart enough to understand ti.

Can you write down the detailed mapping for my case? I'm a newbie of PI, you answer will be really help.