on 07-08-2016 9:39 AM
Hi All.
This is my first question on SCN so pardon if I overstep on any rules.
I'm mapping a ORDERS05 IDOC to another XML document.
On the ORDERS05 <E1EDP01 SEGMENT="1"> contains some of the material information and it CHILD node <E1EDP19 SEGMENT="1"> contains material numbers. I have removed some of the ELEMENTS to simplyfy my example.
I want to map the <IDTNR> where <QUALF>Z02</QUALF> to my target XML structure with is a single NODE structure for material.
This works fine in the QUALIFIER exists and I have the context on the E1EDP19 level. If the <QUALF>Z02</QUALF> segment is missing I want to use the IDTNR from <QUALF>001</QUALF> and I can't get it right. I have tried changing the context to E1EDP01 but then the queues are missalinged as the E1EDP19 with <QUALF>010</QUALF> has no IDTNR.
So my questions is can this be solved with Graphic mapping or may a UDF?
I could always do it by writing a XSLT but that feels like a cop out instead of using the ESB mapping.
<E1EDP01 SEGMENT="1">
<POSEX>00010</POSEX>
<E1EDP19 SEGMENT="1">
<QUALF>010</QUALF>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>Z02</QUALF>
<IDTNR>100000999</IDTNR>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>000000000010000615</IDTNR>
<KTEXT>Hungry Lion Chips 6X2.5Kg</KTEXT>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>16009650906107</IDTNR>
</E1EDP19>
Various Mapping that I have done so far
Thank you all for your assistance in this regard.
Hi Derick!
You could use MapWithDefault to add value for missing IDTNR element.
I'm not at work now so I can't try it myself, but:
IDTNR-MapWithDefault-RemoveContexts-FormatByExample(QUALF in context of E1EDP01).
Thus you should get the correct items count for IDTNR queue in context of E1EDP01 and use it for substitution.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy.
The mapping you suggested worked for what we needed.
Below is an example of the mapping that worked should someone else wish to do the same.
Herewith issues that needs to be noted.
If the 001 QUALF NODE is found before the Z02 then it will use the IDTNR for 001.
If both QUALF elements are missing it will move the IDTNR value one context up.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghuraman
Herewith the UDF that I wrote.
int ItemCount=0;
for( int i=0; i< QUALF.length; i++) {
if (QUALF[i].equals("Z02")) {
result.addValue(IDTNR[i]);
ItemCount++;
break;
}
}
if (ItemCount ==0){
result.addValue("ZZZZZZZZZ");
}
The function and some additional mapping does work if the Z02 qualifier is there however if it is not the entries move up on the context and you are left with the wrong entries in your end destination.
If the function could be modified to check for both entries in the results and if a result for a context is blank it could default a entry for E1EDP01 should no entries be found in this context it would be the best solution but my java skills is zero to none and I suspect I will have to go for a Java course should I wish to further work with UDF's.
I also tried
int ItemCount=0;
for( int i=0; i< QUALF.length; i++) {
if (QUALF[i].equals("Z02")) {
result.addValue(IDTNR[i]);
ItemCount++;
break;
}
}
but that leaves you with the BLUE SUPPRESS values and I could not find a UDF example that was successfull in removing them.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.