on 05-14-2010 7:08 AM
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
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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
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
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)-->|
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
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-->|
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.