cancel
Showing results for 
Search instead for 
Did you mean: 

A question about Graphical Mapping

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

praveen_sutra
Active Contributor
0 Kudos

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

Answers (2)

Answers (2)

0 Kudos

Hi Peter,

You can achieve requirement by using 'If' and 'If without else'  functions as well. PFB the screen shot.

Note that the context of QUALF and IDTNR should be raised to E1EDP01.

Regards,

Sudha

Ryan-Crosby
Active Contributor
0 Kudos

Hi Peter,

Will you only have '001' and '003' as qualifiers or are there others as well?

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi Ryan,

good question. At the moment i see only 003 and 001. But i need to get first 003 if not exist then i should take IDTNR from 001.

Thank you,

PM

Ryan-Crosby
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi again,

the clou is i can only take one of the IDTNR. For example in first Item was two IDTNR and i should prefer IDTNR from QUALF 003 and ignore 001.

Thank you again,

PM

Ryan-Crosby
Active Contributor
0 Kudos

Hi Peter,

The use of collapseContext at the context level shown will ensure only one IDTNR value per ITEM in the target.

Regards,

Ryan Crosby