on 04-26-2007 1:52 PM
I have the following issue.
SOURCE:
CUST
Cust NR = 1
Name = A
CUST
Cust NR =3
Name = C
CUST
Cust NR = 2
Name = B
ITEM
Cust NR = 1
ItemName = ff
Amount = 20
ITEM
Cust NR = 1
ItemName = gg
Amount = 30
ITEM
Cust NR = 2
ItemName = yy
Amount = 25
ITEM
Cust NR = 3
ItemName = uu
Amount = 50
ITEM
Cust NR = 2
ItemName = ee
Amount = 80
Based on the above I want my target structure to then show
CUST
Cust NR = 1
Name = A
ITEM
Cust NR = 1
ItemName = ff
Amount = 20
ITEM
Cust NR = 1
ItemName = gg
Amount = 30
CUST
Cust NR = 2
Name = B
ITEM
Cust NR = 2
ItemName = yy
Amount = 25
ITEM
Cust NR = 2
ItemName = ee
Amount = 80
CUST
Cust NR = 1
Name = A
ITEM
Cust NR = 3
ItemName = uu
Amount = 50
So as you can see basically I want to group all of my items with their relevant customer....
I am able to do it when all items and customers appear in numerical order but everything goes wrong when I get customer 3 first or item 2 followed by 5 or so on...
I guess I want to group the relevant item nodes and al of there subelements with the relevane customer node and its subelements...
Message was edited by:
SAP XI
Hi,
Try this :
CUST-->CUST
Cust_NR--->Cust_NR
Name--->Name
3 inputs to UDF...same UDF we are using everywhere
Cust_NR->RemoveContext->UDF->SplitByValue[Each Value]>ITEM
Cust_NR->RemoveContext->UDF
Cust_NR->RemoveContext->UDF
CUST_NR(from CUST node)--->Cust_NR
Cust_NR->RemoveContext->UDF->SplitByValue[Each Value]>ItemName
Cust_NR->RemoveContext->UDF
ItemName>RemoveContext->UDF
Cust_NR->RemoveContext->UDF->SplitByValue[Each Value]>Amount
Cust_NR->RemoveContext->UDF
Amount-->RemoveContext->UDF
UDF with 3 input: a,b,c and result list
for(int i = 0 ; i < a.length ; i++)
{
for(int j = 0 ; j < b.length ; j++)
{
if(a<b>[</b>i<b>]</b>.equals(b[j]))
{
result.addValue(c[j]);
}
}
}
Hope this works.
Thanks,
Maheshwari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this link:
Covers grouping and aggregation of data in XML nodes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Use FormatByexample function in message mapping to group the items
or write a UDF to group by using Vectors or Hashmap.
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
Yes correct, then in that case , the only one option is write the UDF in that use Vectors or Hashmap to hold the list and group accordingly.Actually we have one example in mapping patterns
see the below link to know more about ,mapping patterns
http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
Regards
Chilla
HI,
In above link goto page no 150 around for mapping patterns
and do accordingly , there you can find the code
the input parameters are first CUST NR,
rest of the Item parameters whatever you want to group under Cust NR..
and before each input change the context to top root node, or removecontext and map to UDF.. after that use to map to target node. check the queue each stage by right click on each item..
and if you dont have the Context change in receiver side , then use Splitbyvalue fnction also..
Regards
Chilla
<i>reward points if it is helpful..</i>
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.