on 05-25-2014 6:32 PM
Dear friends,
I’ve a question about a graphical mapping in PI…
We got the below Input Values. Based on the values for QUALF, I’ve to create IDTNR if QUALF = "003" exist then take IDTNR at the target structure. If not then take QUALF = "001" IDTNR.
<IDOC>
<E1EDP01>
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>000000000010000001</IDTNR>
<KTEXT>ARTIKEL</KTEXT>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>2199900000999</IDTNR>
</E1EDP19>
</E1EDP01>
<E1EDP01>
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>000000000010000002</IDTNR>
<KTEXT>ARTIKEL</KTEXT>
</E1EDP19>
</E1EDP01>
<E1EDP01>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>2199900000999</IDTNR>
</E1EDP19>
</E1EDP01>
</IDOC>
Can you please tell me how to achieve this?
Needed Output Structure;
<ROOT>
<ITEM>
<IDNR>2199900000999</IDNR>
</ITEM>
<ITEM>
<IDNR>000000000010000002</IDNR>
</ITEM>
<ITEM>
<IDNR>2199900000888</IDNR>
</ITEM>
</ROOT>
Your help is greatly appreciated,
Kind regards,
PM
Hi Peter,
You can achieve this by using a simple UDF
String str = "";
for(int i=0;i<var1.length;i++)
{
if (var1[i].equals("001") )
str = var2[i];
}
if(str.equals(""))
str = var2[0];
result.addValue(str);
it will fetch the value based on qualifier value mentioned in UDF.
In this UDF i have taken as "001". You can change it accordingly.
and if "001" is not available it will fetch the first value from the queue.
hope this helps.
thanks and regards,
Praveen T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
Will you only have '001' and '003' as qualifiers or are there others as well?
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
You could do it like this but the moment you have qualifiers '002' or anything above '003' then you would have to handle it differently:
The context for the source QUALF & IDTNR are changed to E1EDP01 and the sort order is descending. SAP has given some functions as part of the B2B add-on to handle situations like this, but if you do not have that then you could certainly use a similar approach in a UDF should you have other qualifiers to deal with.
Regards,
Ryan Crosby
User | Count |
---|---|
93 | |
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.