cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help on Mapping Logic

former_member234749
Participant
0 Kudos

Hi All,

Please help on the below mapping logic.

Target IDoc Structure:

<IDOC>

   <E1MBXYH>

         </F1>

         </F2>

         <E1MBXYI>

           </F1>

           </F2>

           <ZXYZSEG>

                </F1>

                </F2>

Mapping 1 - E1MBXYI generation:       

Here my requirement is that I need to generate the item segment <E1MBXYI> based on the “Delivery item number” and “SAP delivery number” fields which are coming from file.

I need to generate 3 IDocs based on “SAP delivery number” field and in 1st Idoc the E1MBXYI needs to be generated only once and in the 2nd IDoc two E1MBXYI needs to be generated ( for all unique delivery item numbers in the context will have to be generated one item segment – for two 000010 delivery item numbers, one item segment and for 000020 one more item segment) and in the third Idoc again two E1MBXYI segments have to be generated (in third context - one E1MBXYI for two 000010 and another one E1MBXYI for two 000020)

Mapping 2 – ZXYZSEG generation:

As per the above test data, in first Idoc only one Z segment needs to be generated under the item segment(E1MBXYI) and in the second Idoc there are two 000010(second context - delivery item number) so two times the Z segment needs to be generated under the first item segment and in the same idoc one more Z segment to be created under the second item segment, and finally in the third Idoc, two Z segments (two 000010) to be generated under the first item segment and again two Z segments(for two 000020) needs to be created under the second item segment.

Please help me how can I achieve the above requirement.

Thanks in Advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

  Hello,

Try this:

1) E1MBXYI


Execution type: all values of a context

Input: var1

String initial = "";

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

{

if(!var1[i].equals(initial))

{

result.addValue(var1[i]);

initial = var1[i];

}

}

I am assuming that u will get sorted values, if not then use sort function also.

Mapping:

Ur main logic (i.e. till format by example) - UDF - E1MBXYI


2) ZXYZSEG


Mapping:

Ur main logic (i.e. till format by example) - SplitByValue(each value) - ZXYZSEG

Note - I have just provided u the hint for the segments, but for field mapping u have to play around with the context. In addition to that, test above UDF with lot of combinations because i haven't tested ur mapping condition

Thanks

Amit Srivastava



Message was edited by: Amit Srivastava

former_member234749
Participant
0 Kudos

Thank you Amit!

I am able generate the segment E1MBXYI as per your suggestion but the logic which you suggested for the ZXYZSEG generation will not work for me.

I am expecting the out put as below.

<IDOC>

   <E1MBXYH>

         </F1>

         </F2>

         <E1MBXYI>

            </F1>

            </F2>

            <ZXYZSEG>

                </F1>

                </F2>

</IDOC>

<IDOC>

   <E1MBXYH>

         </F1>

         </F2>

         <E1MBXYI>

            </F1>

             </F2>

             <ZXYZSEG>  - (000010)

                </F1>

                </F2>

             <ZXYZSEG> -  (000010)

                </F1>

                </F2>

          <E1MBXYI>

                </F1>

                </F2>

                <ZXYZSEG> - (000020)

                     </F1>

                     </F2>

</IDOC>

<IDOC>

   <E1MBXYH>

         </F1>

         </F2>

         <E1MBXYI>

              </F1>

              </F2>

              <ZXYZSEG>  - (000010)

                   </F1>

                   </F2>

               <ZXYZSEG> -  (000010)

                    </F1>

                    </F2>

         <E1MBXYI>

               </F1>

                </F2>

                <ZXYZSEG> - (000020)

                     </F1>

                     </F2>

                  <ZXYZSEG> - (000020)

                     </F1>

                     </F2>

</IDOC>

Thanks

Former Member
0 Kudos

Hello,

I have just realized that instead of split byValue(value change) i have written split by value (each value)

So try this:

Ur main logic (i.e. till format by example) - SplitByValue(value change) - ZXYZSEG

Thanks

Amit Srivastava

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

You can use this mapping for E1BMXYI:

ZXYZSEG mapping is already answered by Amit.

Regards,

Mark