cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion

former_member188791
Participant
0 Kudos

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>

Accepted Solutions (0)

Answers (1)

Answers (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Are you sure your target strauctiure correct?

map like below

NOC-->TRG

then use UseOneAsMany and Split by Value functions like below

Former Member
0 Kudos

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

former_member188791
Participant
0 Kudos

Karthik/Raja,

Thank you for your response.

Yes the target structure is correct,without intermediate mapping is there any solution,in the above replies its not clear that how TRG tag will repeat based on Value1,Value2...Value5 for each NOC

former_member188791
Participant
0 Kudos

Hi Group,

Can any body suggest on my above issue.

Former Member
0 Kudos

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