on 03-08-2011 4:32 PM
Hi Experts
I Have the following structure
<Header>
<segment_1>
<belnr>10000</belnr>
<\segment_1>
<segment_1>
<belnr>10000</belnr>
<\segment_1>
<segment_1>
<belnr>10000</belnr>
<\segment_1>
<segment_3>
<packnr>ECC</packnr>
<\segment_3>
<segment_3>
<packnr>EDD</packnr>
<\segment_3>
</Header>
To the target structur which is a flat file , I have to map the paknr twice , hence we will have 2 lines in the target structure
but I have also to map the belnr in segment_1.that it will correspond to the number of lines obtaines by the segment_3
that means I have to map the belnr only twice.
I have tried with several node function but the third segment_1 is always puched to the next line.
please advice.
I am expecting your belner will be same all the time .
Like in your example . So you can use
belner (Context Should be on segment_1) - >
Copy Value ->
segment_3 -> Use One as Many -> Target .
Packnr ->
CopyValue : Copies value on target side only once, no matters how many times the element repeated on source side. i.e it suppress the sender value.
Use OneAsmany has three Input .
First Input - > Value need to be repeat .
Second - > First value will be repeat on the basis of second input ( I mean No of times) in your case 2.
Third Input -> based on this value, It will Insert Context in Output Queue. i.e 1000 , Conext Change , 1000
Note: Second and Third input should has equal no of values.
Regards
Prabhat Sharma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
My understanding is that the belnr should repeat as many times as of packnr...
then try using useoneasmany node functions and check it out..
HTH
Rajesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
copy and paste expected target structure also
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again
This is the target structure
<order>
<header>
</header>
<Item>
<f1></f1>
<f2></f2>
<f3></f3>
<TARGETBELNR></TARGETBELNR>
<TARGETPACKNR></TARGETPACKNR>
</Item>
</order>
Item node has to be created as many times as <segment_3> occurs , that is twice in this case
paknr should be mapped to <TARGETPACKNR> , in this case twice.
and belnr should be mapped to <TARGETBELNR> but only twice as we have only to lines with the Item
I hope it is clear
Thanks
Hi, Malu:
Try this first, and let us know what is the outcome:
<segment_3> -
> <Item>
/segment_1/belnr --->/Item/TARGETBELNR
/segment_3/packnr --->/Item/TARGETPACKNR
I think it should be working, even the queue length for /segment_1/belnr is 3, sinc target parent node item only has 2, it it should get only first two values from the queue.
Regards
Liang
Hi all
by trying Liang suggestion , it is puching the last belnr to the next target item node .
In the Use One as Many suggested by Prabhat I am having this error
Runtime exception when processing target-field mapping /ns0:Shipment/Order/Item/LAUFTNR; root message: Exception:[com.sap.aii.mappingtool.tf7.FunctionException: Too few values in the first queue in function useOneAsMany. It must have the same number of contexts as the second queue] in class com.sap.aii.mappingtool.flib7.NodeFunctions method useOneAsMany[[Ljava.lang.String;@218e681e, [Ljava.lang.String;@c559ac8, [Ljava.lang.String;@4824c6cb, com.sap.aii.mappingtool.tf7.rt.ResultListImpl@66775e6d, com.sap.aii.mappingtool.tf7.rt.Context@26d87aa9]
besides using the copy value will always take the first value and repeat it , even if we hvae another value for another node , so I took it out but still have the error mentioned.
Prabhat can yoy please state exactly how the parameter for use one as many should be
BR
Use one as many has three input q's. First input would be the single value you want to pass as many (get only the single belner value). Second input would be the number of times the value has to be passed. Third would be the how you want the contexts to be inserted between values.
There should be some problem with the way you have given the inputs (esp wrt to the contexts/ values inside one set of contexts); that is why you are getting the error you have mentioned.
Check the below link which explains how each fn is being used. Go to the One as many function here.
http://wiki.sdn.sap.com/wiki/display/XI/Explainnodefunctions
Hi SXMI
I have triede the Use one as many , it will only take the first belnr for alle the Item line
The source can have multiple Header with different belnr and packnr each time
like this
<Header>
<segment_1>
<belnr>10000</belnr>
<\segment_1>
<segment_1>
<belnr>10000</belnr>
<\segment_1>
<segment_1>
<belnr>10000</belnr>
<\segment_1>
<segment_3>
<packnr>ECC</packnr>
<\segment_3>
<segment_3>
<packnr>EDD</packnr>
<\segment_3>
</Header>
<Header>
<segment_1>
<belnr>20000</belnr>
<\segment_1>
<segment_1>
<belnr>20000</belnr>
<\segment_1>
<segment_1>
<belnr>20000</belnr>
<\segment_1>
<segment_3>
<packnr>ABB</packnr>
<\segment_3>
<segment_3>
<packnr>ACC</packnr>
<\segment_3>
</Header>
Probably I am doing something wrong but I can not figure oute what is it
Thanks
Hi,
If i understood u correctly..then go with the below suggested UDF and mapping:
UDF1: Context: All values of a queue
for (int i=0;i<a.length;i++)
{
result.addValue(b<i>);
}
1) Segment_3 -> Item
2) Segment_3----
>
-
UDF1------TARGETPACKNR
paknr->removeContext->
3) Segment_3----
>
-
UDF1------TARGETBELNR
belnr ->removeContext->
Thanks
Amit
User | Count |
---|---|
77 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
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.