on 11-01-2012 5:27 PM
Hi Group,
I am having one requirement to convert deep structure in to flat structure can any body help with the below example:
Source file structure looks like below:
HDR 1
VEN 0..1
GROUP 0..Unbound
DA 0..Unbound
NOC 0..Unbound
Source
-------
<HDR>
<Date>20090419</Date>
</HDR>
<VEN>
<VId>IND</VId>
<Name>DEL</SupplierName>
<GROUP>
<GroupId>P</GSPGroupId>
<GroupName>Western</GSPGroupName>
<DA>
<DId>EEE</DId>
<DName>Electricity</DName>
<NOC>
<Id>1</Id>
<SId>0188</SId>
<LId>3</LId>
<DisId>EELC</DisId>
<PTR>01191</PTR>
<Value1>0.000</Value1>
<Value2>0</Value2>
<Value3>58.137</Value3>
<Value4>1</Value4>
<Value5>0.000</Value5>
</NOC>
<NOC>
<Id>2</Id>
<SId>0189</SId>
<LId>4</LId>
<DisId>EELC1</DisId>
<PTR>01192</PTR>
<Value1>0.001</Value1>
<Value2>1</Value2>
<Value3>59.137</Value3>
<Value4>2</Value4>
<Value5>1.000</Value5>
</NOC>
</DA>
</GROUP>
</VEN>
Target
------
<MT_TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>1</Id>
<SId>0188</SId>
<LId>3</LId>
<DisId>EELC</DisId>
<PTR>01191</PTR>
<Value>0.000</Value>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>1</Id>
<SId>0188</SId>
<LId>3</LId>
<DisId>EELC</DisId>
<PTR>01191</PTR>
<Value>0</Value>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>1</Id>
<SId>0188</SId>
<LId>3</LId>
<DisId>EELC</DisId>
<PTR>01191</PTR>
<Value1>58.137</Value1>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>1</Id>
<SId>0188</SId>
<LId>3</LId>
<DisId>EELC</DisId>
<PTR>01191</PTR>
<Value1>1</Value1>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>1</Id>
<SId>0188</SId>
<LId>3</LId>
<DisId>EELC</DisId>
<PTR>01191</PTR>
<Value1>0.000</Value1>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>2</Id>
<SId>0189</SId>
<LId>4</LId>
<DisId>EELC1</DisId>
<PTR>01192</PTR>
<Value>0.001</Value>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>2</Id>
<SId>0189</SId>
<LId>4</LId>
<DisId>EELC1</DisId>
<PTR>01192</PTR>
<Value>1</Value>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>2</Id>
<SId>0189</SId>
<LId>4</LId>
<DisId>EELC1</DisId>
<PTR>01192</PTR>
<Value1>59.137</Value1>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>2</Id>
<SId>0189</SId>
<LId>4</LId>
<DisId>EELC1</DisId>
<PTR>01192</PTR>
<Value1>2</Value1>
</TRG>
<TRG>
<VId>IND</VId>
<GroupId>P</GSPGroupId>
<DId>EEE</DId>
<Id>2</Id>
<SId>0189</SId>
<LId>4</LId>
<DisId>EELC1</DisId>
<PTR>01192</PTR>
<Value1>1.00</Value1>
</TRG>
</MT_TRG>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may consider creating another node for value in the intermediate mapping and populate the 'Value' field value and use the suggestion with field 'Value' as reference by Raja above.
The output of the intermediate mapping would be as below.
HDR 1
VEN 0..1
GROUP 0..Unbound
DA 0..Unbound
NOC 0..Unbound
Value 0...Unbound
Warm Regards,
Karthik
If you want to use only graphical mapping, then intermediate mapping looks like the only goto solution for hierarchy like this. You should duplicate values of the parent node for each of the occurence of the child node.
Steps:
1. create a target node 'Values' under NOC
2. populate all the value fields under this new node 'values'
3. create seperate target NOC node for each value in node 'Values'
4. create seperate target DA node for each NOC node
5. create seperate target GROUP node for each DA node.
6. then you can target root tag 'TRG' with VEn value and field under the newly created fields under target node 'GROUP'.
Note: each step you will be using node function 'UseOneAsMany' http://help.sap.com/saphelp_nw04//helpdata/en/ef/df564b6aa24fc9ab0d685460747de5/content.htm
Other options include XSLT and Java Mapping.
Warm Regards,
Karthik
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.