on 10-26-2010 6:16 AM
I have the following 3 different situations
1-
<idoc>
<header>
<E1ED24 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
</E1EDL44>
</E1EDL37>
<E1EDL37 >
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
</E1EDL44>
</E1EDL37>
</header>
</idoc>
2 -
<idoc>
<header>
<E1ED24 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
</E1EDL44>
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
</E1EDL44>
</E1EDL37>
</header>
</idoc>
3-
<idoc>
<header>
<E1ED24 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>50</QTY>
</E1EDL44>
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>50</QTY>
</E1EDL44>
</E1EDL37>
<E1EDL37 >
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>100</QTY>
</E1EDL44>
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>100</QTY>
</E1EDL44>
</E1EDL37>
</header>
</idoc>
whenever the <E1EDL37 > <E1EDL44 ><POSNR> is equal to <E1ED24 ><POSNR>, then all the segments <E1EDL37 > should follow the idoc with the same PONR of the segment <E1ED24 > in this case it is 45. it can be more than one PONR and the belonging positions in each file .
in the the last situation 2 segment <E1EDL37 > should be created with 2 position each.
How can write one mapping program that reflects each situation.
and help is highly appreciated.
Thanks.
Can you be more specific on your scenario ? as in what is it end to end like IDOC to IDoc / IDoc to file ? Also, Can you correlate source and target structures and the mapping rules which you are trying to explain as from situation we cannot analyse situation and propose solution.
Please specify the mapping rule of condition which you have mentioned in your post with respect to target field mapping.
Regards,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit
Thanks for the answer
I will try to explain as good as I can
As mentioned I have the following 3 different situations
This is an Idoc to Idoc scenario
1 situation -
<idoc>
<header>
<E1ED24 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
</E1EDL44>
</E1EDL37>
<E1EDL37 >
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
</E1EDL44>
</E1EDL37>
</header>
</idoc>
I should have one Idoc for <PONR>45</PONR>
<idoc>
<header>
<E1ED24 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
</E1EDL44>
</E1EDL37>
<E1EDL37 >
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
</E1EDL44>
</E1EDL37>
</header>
</idoc>
And one Idoc for <PONR>46</PONR>
<idoc>
<header>
<E1ED24 >
<POSNR>000003</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>46</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>46</PONR>
</E1EDL41>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
<POSNR>000004</POSNR>
<QTY>100</QTY>
</E1EDL44>
</E1EDL37>
<E1EDL37 >
<E1EDL44 >
<POSNR>000004</POSNR>
<QTY>200</QTY>
</E1EDL44>
</E1EDL37>
</header>
</idoc>
2 siatuation -
<idoc>
<header>
<E1ED24 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000003</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>46</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000004</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>46</PONR>
</E1EDL41>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
</E1EDL44>
</E1EDL37>
<E1EDL37 >
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
</E1EDL44>
</E1EDL37>
<E1EDL37 >
<E1EDL44 >
<POSNR>000003</POSNR>
<QTY>100</QTY>
</E1EDL44>
<E1EDL44 >
<POSNR>000004</POSNR>
<QTY>200</QTY>
</E1EDL44>
</E1EDL37>
</header>
</idoc>
I should have one Idoc for <PONR>45</PONR> with 2 <E1EDL37 > and 2 positions
And one Idoc for <PONR>46</PONR> with only 1 segment <E1EDL37 > and 2 positions like this
<E1ED24 >
<POSNR>000003</POSNR>
<PONR>46</PONR>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<PONR>46</PONR>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
POSNR>000004</POSNR>
</E1EDL44>
<E1EDL44 >
<POSNR>000004</POSNR>
</E1EDL44>
</E1EDL37>
That is based on PONR , a new Idoc should be created for each new value.
this part is done by split by value for PONR
Sorry I will continue with other message
Hi
As I was having problem with the text editor this is the rest of the previous message
3 situation can have several </E1EDL37> for the same position
<idoc>
<header>
<E1ED24 >
<POSNR>000001</POSNR>
<QTY>100</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1ED24 >
<POSNR>000002</POSNR>
<QTY>200</QTY>
<E1EDL41>
<PONR>45</PONR>
</E1EDL41>
</E1EDL24>
<E1EDL37 >
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>50</QTY>
</E1EDL44>
<E1EDL44 >
<POSNR>000001</POSNR>
<QTY>50</QTY>
</E1EDL44>
</E1EDL37>
<E1EDL37 >
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>100</QTY>
</E1EDL44>
<E1EDL44 >
<POSNR>000002</POSNR>
<QTY>100</QTY>
</E1EDL44>
</E1EDL37>
</header>
</idoc>
whenever the <E1EDL37 > <E1EDL44 ><POSNR> is equal to <E1ED24 ><POSNR>, then this segment (<E1EDL37 >) should follow the idoc of that position.
This is can be done by format by example
My problem is the segment </E1EDL37> can occurs 1-n. as explained in the 3 situations.
And here I am having the problem.
I have tried with the UDF
public void Replicate37(String[] E1ED24POSNR, String[] E1EDL37POSNR, ResultList result, Container container) throws StreamTransformationException{
int i, j;
int a, b;
j = 0;
a = E1ED24POSNR.length;
b = E1EDL37POSNR.length;
if ( b > a ) {
result.addValue("");
}
else
{
for( i = 0; i < E1ED24POSNR.length; i++ )
{
for (j = 0; j<E1EDL37POSNR.length; j++ )
if (E1ED24POSNR<i>.equals(E1EDL37POSNR[j]) )
{
result.addValue("");
result.addContextChange();
}
else
{
continue ;
}
}
}
And mapped it to </E1EDL37> segment , but it is not being created correctly.
I hope it is a little more understandable now and really hope for some help
Thanks
Hi Merhej,
I assume: Even if there are multiple occurences of <E1ED24><POSNR> = <E1EDL37 > <E1EDL44 ><POSNR>, then also target node should be created as many times this condition is true for <E1EDL37 > <E1EDL44 ><POSNR>. Please confirm.
If so, you will need to write a UDF with 2 "for" loops. One for <E1ED24><POSNR> and another for <E1EDL37 > <E1EDL44 ><POSNR>. After checking the condition, please return a context change for every true condition. This when mapped to target node should create nodes as per your requirement.
Please let me know if this works.
Thanks
Jaya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
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.