on 06-13-2012 4:01 AM
Hi,
I have a requirement to create an output structure based on amalgamating the contents of two input structures. At present I am having issues managing to correctly link the two structures.
The cardinality of the structures in ORG_DATA 1:n and SITE_DATA 1:n. and a match will always be found. A likely scenario is that many SITE_DATA records will need to reference each ORG_DATA record. Both of these structures are at the same level in the xml document.
Each input SITE_DATA record should create an outbound SKU_DATA record. The majority of the output fields are contained in the SITE_DATA record but the field VTEXT_ORG needs to be looked up in the ORG_DATA structure using field VKORG as a key.
I have tried various combinations in the graphical mapper but have been unable to correctly create the output structure. Would be grateful for any suggestions on how this can be achieved.
Input Structure
<data>
<ORG_DATA>
<VKORG>A01</VKORG>
<VTEXT_ORG>Sales Org 1</VTEXT_ORG>
</ORG_DATA>
<ORG_DATA>
<VKORG>B01</VKORG>
<VTEXT_ORG>Sales Org 2</VTEXT_ORG>
</ORG_DATA>
<SITE_DATA>
<MATNR>12345</MATNR>
<WERKS>ABCD</WERKS>
<BUTXT>Site 1</BUTXT>
<VKORG>A01</VKORG>
</SITE_DATA>
<SITE_DATA>
<MATNR>67890</MATNR>
<WERKS>DEFG</WERKS>
<BUTXT>Site 2</BUTXT>
<VKORG>B01</VKORG>
</SITE_DATA>
<SITE_DATA>
<MATNR>54321</MATNR>
<WERKS>XYZG</WERKS>
<BUTXT>Site 3</BUTXT>
<VKORG>A01</VKORG>
</SITE_DATA>
</data>
Output Structure
<SKU_DATA>
<MATNR>12345</MATNR>
<WERKS>ABCD/WERKS>
<BUTXT>Site 1</BUTXT>
<VKORG>A01</VKORG>
<VTEXT_ORG>Sales Org 1</VTEXT_ORG>
</SKU_DATA>
<SKU_DATA>
<MATNR>67890</MATNR>
<WERKS>DEFG</WERKS>
<BUTXT>Site 2</BUTXT>
<VKORG>B01</VKORG>
<VTEXT_ORG>Sales Org 2</VTEXT_ORG>
</SKU_DATA>
<SKU_DATA>
<MATNR>54321</MATNR>
<WERKS>XYZG</WERKS>
<BUTXT>Site 3</BUTXT>
<VKORG>A01</VKORG>
<VTEXT_ORG>Sales Org 1</VTEXT_ORG>
</SKU_DATA>
Hi.
You need to use an UDF by Context. Try this.
The UDF has tree parameters.
1.- /ORG_DATA/VKORG (Change Context)
2.- /ORG_DATA/VTEXT_ORG (Change Context)
3 . /SITE_DATA/VKORG (Change Context)
....Parameters----UDF --- SplitByValue--->VTEXT_ORG
Arg1 : Key
Arg2 : Description
Arg3 : KeySearch
Map map = new HashMap();
for( int i = 0; i < Key.length ; i ++){
map.put(Key[i].toString(),Description[i].toString());
}
for (int row = 0; row < KeySearch.length ; row ++){
result.addValue(map.get(KeySearch[row].toString()));
}
Regards
Lucho
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lucho,
Thanks for the reply and the mapping is now working much better. However there is still an issue. If there is a one to one correlation between the ORG segments and the SITE segments then the mapping functions correctly. However if there is a many to one (SITE to ORG) mapping then the mapping fails.
I have tried amending the context, Split by Value etc but to no avail.
Update - Now resolved by amending the contexts on the input.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
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.