on 06-18-2006 11:56 AM
My Source structure:
<IDOC> [1...1]
<ZCNT> [1....9999999]
<CCTNR></CCTNR> [0..1]
<ZARTICLE> [0.....9999999]
<field1></field1> [0...1]
<field2><field2> [0...1]
</ZARTICLE>
</ZCNT>
</IDOC>
My target structure:
<items> [0...1]
<item> [0...unbounded]
<fieldX>
</item>
<item> [0....unbounded>
<fieldu>
<fieldz>
</item>
</items>
My Source data:
<IDOC>
<ZCNT>
<CCTNR>123</CCTNR>
<ZARTICLE>
<field1>x</field1>
<field2>y</field2>
</ZAR|TICLE>
</ZCNT>
<CCTNR>456</CCTNR>
<ZCNT>
<ZARTICLE>
<field1>u</field1>
<field2>z</field2>
</ZAR|TICLE>
</ZCNT>
</IDOC>
My Requirement:
The first instance of ITEM must occur for every instance of ZCNT
The second instance of ITEM must occur for every instance of ZARTICLE
So my output should look like
<items>
<item>
<fieldx>123</fieldx>
</item>
<item>
<fieldu>x</fieldu>
<fieldz>y<fieldz>
</item>
<item>
<fieldx>456</fieldx>
</item>
<item>
<fieldu>u</fieldu>
<fieldz>z</fieldz>
</item>
</items>
My mapping:
IDOC -->ITEMS
ZCNT -->SPLITBYVALUE -->ITEM [first instance of ITEM]
CCTNR --> fieldx
ZARTICLE --> ITEM [2nd instance of ITEM]
field1 -->fieldu
field2 -->fieldz
The output I get is:
<items>
<item>
<fieldX>123</fieldx>
</item>
<item>
<fieldu>x</fieldu>
<fieldz>y<fieldz>
</item>
</items>
For some reason , I do not get the second set of values for both ZCNT and ZARTCILE. If I do remove contexts from the 2nd instance of item
ZARTICLE>removecontexts>ITEM [2nd instance of ITEM]
then the output I get is
<items>
<item>
<fieldX>123</fieldx>
</item>
<item>
<fieldu>x</fieldu>
<fieldz>y<fieldz>
</item>
<item>
<fieldu>u</fieldu>
<fieldz>z</fieldz>
</item>
</items>
But I do not get the 2nd instance of ZCNT. What we should keep in mind is that one ZCNT can have many ZARTICLES...so the number of contexts of
ZCNT need not necessarily match the number of contexts of ZARTICLES.
Is it feasible to get a structure as mentioned in my requirement. Your help would be most welcome.
Hi,
Did you try RemoveContext with SplitByValue ? If not try it once.
Following blog will give some good example-
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool
Regards,
Moorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you try
splitbyvalue-collapse contextZCNT
splitbyVaue----ZARCTICLE
Also, check on this:
Regards
Vijaya
It is not possible to have alternating nodes out of the box with the graphical mapping tool.
In yourcase I assume that the problem cannot be solved without using a UDF.
First create a target structure like this:
items
-> item
-> fieldx
fieldu
fieldz
The UDF for fieldX has to create a Queue with these entries:
123 - CC - CC - 456 - CC
The UDF for fieldu has to create this:
CC - x - CC - CC - u
In other words: The fieldX is assigned to the first and third occurance of item, fieldu is assinged to the second and fourth occurance of item.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.