on 05-23-2006 4:28 PM
Hi All,
I have the fallowing situation in my map:
The source is an XML document containing order information. This document contains multiple orders. Each order has 1 header and multiple items information, as following (example):
<ORDER>
<HEADER>
<NUMBER></ NUMBER>
<TYPE></TYPE>
<ORDER_ITEMS>
<ITEM> <ITEM_NUMBER></ITEM_NUMBER
<QTITY></ QTITY>
</ITEM>
</ORDER _ITEMS>
<HEADER>
</ORDER>
The result of the mapping/transformation will contain a row for each item. Each row will contain the header information from the source, and the item information, as following (example):
<ORDER>
<NUMBER></ NUMBER>
<TYPE></TYPE>
<ITEM_NUMBER></ITEM_NUMBER
<QTITY></QTITY>
</ITEM>
</ORDER>
I did the mapping but only one thing is not working:
All my header information in the target is coming from the first order. So no matter how many orders I put in the source, the target result is generated right for all item information, but the header is always the same.
This is the mapping witch I am doing for the header information:
Item ->
copyPerValue* -> Split by value -> Number
Number ->
copyPerValue: Java function
for (int i=0; i<a.length; i++) {
result.addValue(b[0]);
}
Tks a lot,
Daniela Machado
Hi Daniela,
you should use function useOneAsMany. See also the attached <a href="/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool">weblog</a>
Regards,
Claus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Claus,
I removed the copyPerValue function and put the useOneasMany one.
But when I test it with more then one order, I got an error:
RuntimeException in Message-Mapping transformation: Exception:[com.sap.aii.mappingtool.tf3.IllegalInstanceException: Too many values in first queue in function useOneAsMany. It must have the same number of contexts as second queue.] in class com.sap.aii.mappingtool.flib3.NodeFunctions method useOneAsMany[, , ]
Daniela,
there are two things to look at:
1) Check that you have the context for each input variable set to the correct value
2) useOneAsMany only works if you always have at least one line item for each header line. Otherwise it will fail. In that case you would need to use one of the other options mentioned in the weblog.
If you can you post the sample XML you use for your testing, I can have a look at it and give you a better answer on what the problem is.
Regards,
Claus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Let me guess here that from b[] you are getting header information in your function. Now you have done result.addValue(b[0]). that is every time you are using first element of header array. I suppose you want to use different header for all orders. Now for that you have to adjust your array element for b[]. Here using b[0] every time will not work. Now I don't have clear picture about what is that actually you need but i guess this will help.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.