cancel
Showing results for 
Search instead for 
Did you mean: 

IDOC to file mapping issue

Former Member
0 Kudos

Hello all,

My IDOC structure is as below :

<?xml version="1.0" encoding="UTF-8"?>

<ORDERS05>

      <E1EDK14 SEGMENT="">

         <QUALF>Z03</QUALF>

         <ORGID>AB-13254-ER</ORGID>

      </E1EDK14>

      <E1EDK14 SEGMENT="">

         <QUALF>Z06</QUALF>

         <ORGID>AB-2662-ER</ORGID>

      </E1EDK14>

   </IDOC>

</ORDERS05>

The mapping is done in this way :

       ORGID---->substring(3..8)-->

QUALF--->EqualS ----->if  then else------->OrderNumber

Constant(Z06)-->

              Constant(000000)----->

I am getting result as Ordernumber = 0000 because it's always taking the first value of the QUALF .What need to be done such that it takes the rest of the nodes too and show the correct value as OrderNumber = "2662"?

Thanks in advance !!

Regards,

Sambaran

Accepted Solutions (0)

Answers (7)

Answers (7)

ambrish_mishra
Active Contributor
0 Kudos

Hi Sambaran,

You can use a higher context of the parent segment of the fields ORGID and QUALF and use ifWithoutElse (Keep Suppress value unchecked). After this mapping, you can use MapwithDefault function. It should work. For using standard substring function, make sure you have checked the length before you apply substring else it will result in mapping failure.

Ambrish

Former Member
0 Kudos

Hi friends,  Thank you so much for your help, this issue have been resolved few weeks back ! thanks ! 🙂  Regards, Sambaran

ambrish_mishra
Active Contributor
0 Kudos

Good to know its resolved. please mark the question as answered.

gagandeep_batra
Active Contributor
0 Kudos

Hi Pradhan,

if i am understand correctly i think this is done by simple way, as i try without any change of context and getting the require output, check you have given the right input  with case sensitive.

Regards

Gagan

Former Member
0 Kudos

Make the context of QUALF and ORGID to higher context.

Former Member
0 Kudos

Hi,

Make the context of QUALF and ORGID to higher node. Check the below mapping.

former_member184681
Active Contributor
0 Kudos

Hi Sambaran,

Here is how I would personally, map it, it should work without UDFs:

QUALF --> EqualsS(Constant Z06) --> ifWithoutElse( ORGID -->substring(3..8) ) -->

collapseContexts --> mapWithDefault(000000) --> OrderNumber

Also, make sure ORGID is always long enough, otherwise mapping will go into error.

Regards,

Greg

Former Member
0 Kudos

Hi Sambaran,

According to your requirement, if any <QUALF> is Z06 you need to pass the corresponding <OrgID>.

Use a UDF for the the above. Remove context for both <QUALF> and <ORGID> and give it as input to the UDF.

<ORGID> -->

                    UDF_ORGID_FROM_Z06--->substring(3..8) ---> OrderNumber

<QUALF>--->

Small piece of code that you will require:

int sum=0000;

          for (int i=0;i<a.length;i++)

          {

                    if(QUALF[i].equals("Z06")

                         sum = ORGID[i];

                             

            }

return sum;

Former Member
0 Kudos

Hi Tejas, Thank you so much for your input.I just wonder what would be the input parameters for my UDF? are you sure,PI accepts the IDOC fields in UDF like this?   Thanks for help !

Former Member
0 Kudos

HI Sambaran,

SAP PI/XI converts all incoming Idocs/File in short the source into XML for mapping purposes. The only language the SAP XI mapping understands is XML.

These nodes as mentioned above would be XML nodes and they will surely work. The two inputs would be the data coming in <ORGID> and <QUALF> node.

We could have used the substring function in the UDF itself but since its available in Graphical Mapping. I have made the UDF output the QUALF which corresponds to ORDIG Z06 and then used the Substring function to take only 2662 as output.

As a correction to above function you can just make the int sum = 00000000; so that there is no error during substring.

Thanks & Regards,

Tejas Bisen

former_member184789
Active Contributor
0 Kudos

Hi

Make the context of QUALF to higher node i.e right click on QUALF & make its context to immediately higher node. Dont change anything else

Former Member
0 Kudos

Hi, Thanks for ur input.For QUALF,I have three contaxts : E1EDK14,IDOC and ORDERS05. I tried three of them but this couldnt solve the problem..  Sambaran

Former Member
0 Kudos

Is it possible by graphical mapping or I need to use UDF?