cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping help required

Former Member
0 Kudos

Hi Experts,

Please help me on mapping logic,

If I receiver multiple Elemica Orders from source system then I have to create multiple IDocs ,I have developed logic working fine without any issues,

Now my requirement got changed, if order number same for multiple Elemica Orders then I have to create only one IDoc with multiple Text IDS, if ORDERS number different then I have to create multiple IDocs.

How can I achieve this requirement

My source structure

MT_Orders
        Elemica_Orders    1 to unbounded
             OrderNumber
             MaterialNumber
             TrasactionNumber
             BillingReference

Target Structure

ORDERS05
        IDoc
          E1EDK01
          E1EDK14
          E1EDK02
          E1EDKPT1
             E1EDP19
             E1EDPT01
               TextID

Many thanks,

Jam

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Do a check on OrderNumber field from your source system, and count the distinct ones. Store that value in a variable and map that variable to the IDOC node.

This will generate same number of IDOCs as per your calculation stored in your variable.

regards,

Former Member
0 Kudos

Hi Experts ,

below is the sample file and expected format,

Source:

MT_Orders
        <Elemica_Orders>
             <OrderNumber>12345</ OrderNumber>
             <MaterialNumber>5678</ MaterialNumber>
             <TrasactionNumber>345678</TrasactionNumber>
             <BillingReference>34567890< /BillingReference>
        </Elemica_Orders>
       <Elemica_Orders>
             <OrderNumber>12345</ OrderNumber>
             <MaterialNumber>5656</ MaterialNumber>
             <TrasactionNumber>7887</TrasactionNumber>
             <BillingReference>907534< /BillingReference>
        </Elemica_Orders>
      <Elemica_Orders>
             <OrderNumber>4567</ OrderNumber>
             <MaterialNumber>5656</ MaterialNumber>
             <TrasactionNumber>7887</TrasactionNumber>
             <BillingReference>9075< /BillingReference>
        </Elemica_Orders

Expetced OutPut :

ORDERS05
        IDoc
          E1EDK01
          E1EDK14
          E1EDK02
          E1EDKPT1
             E1EDP19  5678
             E1EDPT01
               TextID     34567890
          E1EDKPT1
             E1EDP19   5656
             E1EDPT01
               TextID     907534
        IDoc
          E1EDK01
          E1EDK14
          E1EDK02
          E1EDKPT1
             E1EDP19   5656(material number)
             E1EDPT01
                 TextID     9075

Kind Regards,

Jam

0 Kudos

Hi Jam,

one way to achieve this is write a UDF with one input, that is OrderNumber and inside try to count the number of IDOCs which need to be generated on the target. The code can be like this:

Vector vec = new Vector();

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

{

if(!vec.contains(a<i>))

{

vec.add(a<i>) ;

}

}

for(int j = 0;j<vec.size();j++)

result.addValue( vec.get(j).toString() );

while creating the UDF select CONTEXT. and map this to the IDOC on the target.

Hope it'll solve ur problem.....

Regards

Venkat

Former Member
0 Kudos

hi,

what i have suggested you earlier, in that kindly replace Elemica_Orders segment with Orders_Number and then try, this mapping is working perfectly for me in some what similar requirement. Kindly change the contect of Order_Numbers segment to top level and check.

Regards,

NJ

Former Member
0 Kudos

Hi Experts,

many thkanks for your valuable inputs,

but it is not working out,the real probelm i was facing here is "I am able to genarate multiple IDocs",but if Ordernumber eual to the other orders then i have to genarate multiple E1EDKPT1 Node multiple Times.

how can i write this Logic.

Kind Regards,

Jam

0 Kudos

Hi,

in order to generate E1EDKPT1segments you can make use of one more UDF, while creating the UDF select Context and in side the UDF sort the Order Numebrs.

OrderNumer -


> UDF for Sorting -


> First Arg of FormatByExample

OrderNumber -


> UDF for Sorting -


> SplitByValue -


> Second Arg of FormatByExample

option for SplitByValue (ValueChange)

pass the output of FormatByExample to the target node.

sample code for above UDF is like:

Arrays.sort(a);
for(int i = 0; i<a.length ;i++)
result.addValue(a<i>);

Regards

Venkat

Former Member
0 Kudos

Hi Gv,

many thanks for your reply,if you have PI system can you pls try my requirement,and upload this image in any website , i can look in to that. my server down that is the reason.

regards,

Jam

Former Member
0 Kudos

Try this..

OrderNumber--->RemoveContext--->Sort-->Split by Value (on Value Change)-->Collapse Context-->IDOC

Now since you have to generate E1EDKPT1 multiple times so that you can fill multiple TextID..

                                         Elemica_Orders-->RemoveContext-->|
                                                                          formatByExample--->E1EDKPT1
OrderNumber--->RemoveContext--->Sort-->Split by Value (on Value Change)-->|

BillingReference--->SplitByValue--->TextID

Former Member
0 Kudos

many many thanks sarver,my server down once it is up, i will test it and let you know..

You guys really help full..hats off to sdn and experts.

Kind Regards,

Jam

Former Member
0 Kudos

Small Correction in TextID mapping otherwise you will not get the correct values in correct place.. do the same for other fields under same segment.

                             OrderNumber-->RemoveContext--->|
		                                             SortByKey--->|
                         BillingReference-->RemoveContext-->|             |
                                                                          |                          
									   formatByExample--->SplitbyValue(Each value)--->TextID
   OrderNumber--->RemoveContext--->Sort-->SplitbyValue(on Value Change)-->|

Former Member
0 Kudos

Hi Sarvesh,

many thanks,my requirement working partially,

MT_Orders
         <Elemica_Orders>
              <OrderNumber>12345</ OrderNumber>
              <MaterialNumber>5678</ MaterialNumber>
              <TrasactionNumber>345678</TrasactionNumber>
              <BillingReference>34567890< /BillingReference>
        </Elemica_Orders>
       <Elemica_Orders>
             <OrderNumber>45678</ OrderNumber>
             <MaterialNumber>5656</ MaterialNumber>
              <TrasactionNumber>7887</TrasactionNumber>
              <BillingReference>907534< /BillingReference>
         </Elemica_Orders>
       <Elemica_Orders>
              <OrderNumber>12345</ OrderNumber>
              <MaterialNumber>5656</ MaterialNumber>
              <TrasactionNumber>7887</TrasactionNumber>
              <BillingReference>9075< /BillingReference>
         </Elemica_Orders

Expetced OutPut :

ORDERS05
        IDoc
          E1EDK01
          E1EDK14
           E1EDK02
         E1EDKPT1
             E1EDP19  5678
              E1EDPT01
                TextID     34567890
           E1EDKPT1
             E1EDP19   5656
              E1EDPT01
                TextID     907534(this value not correct)
        IDoc
          E1EDK01
           E1EDK14
           E1EDK02
          E1EDKPT1
            E1EDP19   5656(material number)
              E1EDPT01
                 TextID     9075(this value not correct)

If Source file not coming in orders like some times first and 3 rd order contains same order number 2 nd order number will be different,

in this case my text id value not getting what i am expecting.

kind regards,

Jam

Former Member
0 Kudos

I am not sure what went wrong in your mapping but my previous mapping logic is working fine for TextID without any problems. Anyway try with below mapping. (I just removed the formatByExample, because there is no need.)

     OrderNumber--->RemoveContext--->|
 		                      SortByKey--->SplitbyValue--->TextID
 BillingReference--->RemoveContext-->|

Former Member
0 Kudos

Previous Logic working fine...many many thanks.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

probably your mapping should be like

Elemica_Orders->Sort>Split by Value (Value Change)>Collapse Context>Idoc

Kindly check the context of source field Elemica_Orders

Regards,

NJ

Edited by: nishu jain on May 14, 2010 8:16 AM