on 01-19-2009 3:21 AM
Hi,
I am working on Idoc to file scenario...My input and output structures like below...
Idoc:
ZOrderInfo 1----99999
OrderNumber 0---1
ZItem 1----99999
Quantity 0---1
File:
Item
OrderNumber 0-1
Quantity 0-1
Problem : I need to produce Item nodes in output structure based on OrderNumber. like for 4 order numbers in source need to 4 Item segments.
a) Summation: If any duplicate Ordernumber comes in picture...we need to omit that and need to take the quantity from that...do summation and send to target.
like OrderNumber -1...quantity -10 and Ordernumber -1 ....quantity -20
Need to produce only one ordernumber -1 with the quantity of 10+20 =30.
b) If the Ordernumber not present in any segment....Need to pass the quantity as is...
any suggestions would be appreciated.
-Esha.
Hi Esha,
Just check my article it has example that you can use to accomplish you requirment
Thanks
Sunil Singh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Sunil...I am almost done with the changes....
But...I have only one query - If the Ordernumber node not present in the input pay load- I need to pass the quantity value as is.
So that....need to check all segment first and process...I am doing that...Its not working though...Can you help me out.
-E
Hi Esha,
I have uploaded the Screen shot at http://www.4shared.com/file/81372898/6bdf9682/New_Microsoft_Office_Word_Document__5_.html
Just download it and use, I have tested the Functionality it is working fine.
I havent added any description is required revert back.
Thanks
Sunil Singh
Sunil,
I have made the changes as you suggested...and I got an exception for the SortBY key node function.
and the exception is....
Exception:com.sap.aii.mappingtool.tf3.IllegalInstanceException: Queues have different lengths in function sortByKey in class com.sap.aii.mappingtool.flib3.NodeFunctions method sortByKey.
any suggestion would be appreciated.
-Esha
Give me your source File.
It looks like the No of Nodes for Order No and Quantity are not same.
(Right click on both the input and see if the no.f input for both are same).
I had assumed that no of both the inputs will be same. Any how send me your Input structure i will handle that also.
Thanks
Sunil Singh
Sunil,
Note: In this input Idoc - It has 3 segments, 2 segments have same ordernumber and 1 segment doesn't have order number.
And I am expecting two Item nodes in output structure - One with quantities summation (500 +500 =1000) for the same order number and One with no ordernumber and quantity as is (600).
Hope my requirements clear to you! Please help me with the valueable suggestions!
My input structure - IDoc:
<?xml version="1.0" encoding="UTF-8"?>
<ZORDR01>
<IDOC BEGIN="">
<EDI_DC40 SEGMENT="">
<TABNAM/>
<MANDT/>
<DOCNUM/>
<DOCREL/>
<STATUS/>
<DIRECT/>
<OUTMOD/>
<EXPRSS/>
<TEST/>
<IDOCTYP/>
<CIMTYP/>
<MESTYP/>
<MESCOD/>
<MESFCT/>
<STD/>
<STDVRS/>
<STDMES/>
<SNDPOR/>
<SNDPRT/>
<SNDPFC/>
<SNDPRN/>
<SNDSAD/>
<SNDLAD/>
<RCVPOR/>
<RCVPRT/>
<RCVPFC/>
<RCVPRN/>
<RCVSAD/>
<RCVLAD/>
<CREDAT>20080310</CREDAT>
<CRETIM>104301</CRETIM>
<REFINT/>
<REFGRP/>
<REFMES/>
<ARCKEY/>
<SERIAL/>
</EDI_DC40>
<Z1ORDAPH SEGMENT="">
<ORDNO>1234567890</ORDNO>
<DATE/>
<Z1ORDAPL SEGMENT="">
<ORDAPQTY>500</ORDAPQTY>
</Z1ORDAPL>
</Z1ORDAPH>
<Z1ORDAPH SEGMENT="">
<DATE/>
<Z1ORDAPL SEGMENT="">
<ORDAPQTY>600</ORDAPQTY>
</Z1ORDAPL>
</Z1ORDAPH>
<Z1ORDAPH SEGMENT="">
<ORDNO>1234567890</ORDNO>
<DATE/>
<Z1ORDAPL SEGMENT="">
<ORDAPQTY>500</ORDAPQTY>
</Z1ORDAPL>
</Z1ORDAPH>
</IDOC>
</ZORDR01>
Hello Esha,
I found two conflicting statement in your requirment:
I need to produce Item nodes in output structure based on OrderNumber. like for 4 order numbers in source need to 4 Item segments
and then in your secopnd requirement you said if OrderNumber is not present then pass the quantity as it is.
As in this case there wont be any parent (No item node will be created) then sending quantity doesn't makes sense.
Also if there are Multiple Nodes in which there is no OrderNumber do i have to sum the Quantity as it is possible that there could be more than one Node in which there in No orderNumber then this will become like duplicated OrderNumer Scenario.
As number of item at the output side is dependent on the OrderNumber. So if OrderNumber get repeated then is it required to create the Item node for those repeated node also or I have to create the Item Fields only for unique values of ItemNumbers.
Kindly clear me on this.
Thanks
Sunil Singh
use this UDF
for(int i = 0 ; i <var1.length; i++)
{
if(!var1<i>.equals("[]"))
{
result.addValue(var2<i>);
}
}
change the mapping as
OrderNumber->MapWithDefault (Put "[]" value as defautl) it is first input to the UDF (It will act as a var1)
second input will be Quantity. Now give the Output of this function(UDF) as first input to the SortByKey and second input as OrderNumber . rest of the things will be same.
Thanks
Sunil Singh
Hi esha,
Try the below mapping.
1.OrderNumbermapwithdefault(Function)removecontextsplitybyvalue(valuechange)collapsecontext---Item
2.OrderNumbermapwithdefault(Function)removecontextsplitybyvalue(valuechange)collapsecontext---splitbyvalue(eachvalue)OrderNumber(Target)
3.Quantity(Change the context to idoc) Formatbyvalue>
OrderNumbermapwithdefault(Function)removecontextsplitybyvalue(valuechange)
->Sum(Statistic Function)Quantity(Target).
Regards,
Prakasu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i thing your quantity not passed in a single queue.
Just made a small change in your mapping.after the quantity add the remove context function and map the field to formatby example.
(quantityremovecontext) should be mapped with first node of formatbyexample.
Regards,
Prakasu
Edited by: prakasu on Jan 19, 2009 7:33 AM
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.