Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XML to ABAP internal table

Former Member
0 Likes
657

Hi, I have this xml file in my local directory: /usr/sap/tmp/vestiario.xml with this structure:


<NewDataSet> 
   <elenco> 
     <MATRMEC>005724Y</MATRMEC> 
     <CODTAGLIAART>T108 </CODTAGLIAART> 
     <CODTAGLIA>8 </CODTAGLIA> 
     <DESCRIZIONEMATERIALE>GUANTI DI PELLE UOMO </DESCRIZIONEMATERIALE> 
  </elenco> 
  <elenco>
     <MATRMEC>036097E</MATRMEC> 
     <CODTAGLIAART>T42 </CODTAGLIAART>
     <CODTAGLIA>2 </CODTAGLIA> 
     <DESCRIZIONEMATERIALE>CALZE COLLANT </DESCRIZIONEMATERIALE>
  </elenco> 
</NewDataSet>

Now I want to read this xml and fill an internal table with data.

How can I do it step by step?

Help me please. THANKS

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
612

Create a [Simple Transformation|http://help.sap.com/saphelp_nw04/helpdata/en/a9/001540bf1af72ee10000000a1550b0/frameset.htm] and call it from your ABAP program. More info in previous discussions in these forums.

Thomas

Hi, I have this xml file in my local directory: /usr/sap/tmp/vestiario.xml with this structure:


<NewDataSet> 
   <elenco> 
     <MATRMEC>005724Y</MATRMEC> 
     <CODTAGLIAART>T108 </CODTAGLIAART> 
     <CODTAGLIA>8 </CODTAGLIA> 
     <DESCRIZIONEMATERIALE>GUANTI DI PELLE UOMO </DESCRIZIONEMATERIALE> 
  </elenco> 
  <elenco>
     <MATRMEC>036097E</MATRMEC> 
     <CODTAGLIAART>T42 </CODTAGLIAART>
     <CODTAGLIA>2 </CODTAGLIA> 
     <DESCRIZIONEMATERIALE>CALZE COLLANT </DESCRIZIONEMATERIALE>
  </elenco> 
</NewDataSet>

Now I want to read this xml and fill an internal table with data.

How can I do it step by step?

Help me please. THANKS

3 REPLIES 3
Read only

Former Member
0 Likes
612

Hi,

Try searching the forum.

Check this links:

Regards,

Gilberto Li

Read only

ThomasZloch
Active Contributor
0 Likes
613

Create a [Simple Transformation|http://help.sap.com/saphelp_nw04/helpdata/en/a9/001540bf1af72ee10000000a1550b0/frameset.htm] and call it from your ABAP program. More info in previous discussions in these forums.

Thomas

Read only

0 Likes
612

I created this XSLT for my XML but it does not work fine. Can someone help me please?



<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">

<tt:root name="T_ELENCO" type="?"/>
<tt:root name="MATRICOLA" type="?"/>
<tt:root name="TAGLIA" type="?"/>
<tt:root name="CODICE" type="?"/>
<tt:root name="DESCRIZ" type="?"/>


<tt:template>



<NewDataSet>
    <tt:loop name="elenco" ref="T_ELENCO">
    <elenco>
       <MATRMEC><tt:value ref="MATRICOLA"/></MATRMEC>
       <CODTAGLIAART><tt:value ref="TAGLIA"/></CODTAGLIAART>
       <CODTAGLIA><tt:value ref="CODICE"/></CODTAGLIA>
       <DESCRIZIONEMATERIALE><tt:value ref="DESCRIZ"/></DESCRIZIONEMATERIALE>
     <elenco>
    </tt:loop>
</NewDataSet>



</tt:template>

</tt:transform>