Application Development 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: 

Reading complex file in ABAP internal table.

Former Member
0 Kudos

I have a following XML file. and I want to read it in internal Table with deep structure.

<?xml version="1.0" encoding="utf-16" ?>

- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">

- <asx:values>

- <TAB>

- <item>

<CATALOGUEREQUESTIDID>5</CATALOGUEREQUESTIDID>

<MBRSH>Chemical Industry</MBRSH>

<MTART>Spare Parts</MTART>

<WERKS>Spare Parts Warehouse</WERKS>

<MAKTX>Lubricant,Oil Graphite></MAKTX>

<MEINS>Bottle</MEINS>

<MATKL>Spare parts - General</MATKL>

<BRGEW>10</BRGEW>

<GEWEI>G</GEWEI>

<NTGEW>9</NTGEW>

<VOLUM>1</VOLUM>

<VOLEH>L</VOLEH>

<EKGRP>Buyer 1</EKGRP>

<XCHPF>NO</XCHPF>

<EKWSL>-15, -10, -05</EKWSL>

<WEBAZ>2</WEBAZ>

<INSMK>NO</INSMK>

<KZKRI>NO</KZKRI>

<MFRPN>SHELL</MFRPN>

<MFRNR>WD-40</MFRNR>

- <DRGNUM>

<ZEINR>C-39166</ZEINR>

<ZEIAR>KKK</ZEIAR>

<ZEIVR>3</ZEIVR>

<BLATT>4</BLATT>

<AESZN>12</AESZN>

<ZEIFO>A3</ZEIFO>

<BLANZ>12</BLANZ>

</DRGNUM>

- <DRGNUM>

<ZEINR>C-39167</ZEINR>

<ZEIAR>KKK</ZEIAR>

<ZEIVR>3</ZEIVR>

<BLATT>4</BLATT>

<AESZN>12</AESZN>

<ZEIFO>A3</ZEIFO>

<BLANZ>12</BLANZ>

</DRGNUM>

- <DRGNUM>

<ZEINR>C-39168</ZEINR>

<ZEIAR>KKK</ZEIAR>

<ZEIVR>3</ZEIVR>

<BLATT>4</BLATT>

<AESZN>12</AESZN>

<ZEIFO>A3</ZEIFO>

<BLANZ>12</BLANZ>

</DRGNUM>

</item>

</TAB>

</asx:values>

</asx:abap>

+I for this I have created a internal table as; +

types : begin of DRGNUM,
        ZEINR(10),
        ZEIAR(5),
        ZEIVR(5),
        BLATT(5),
        AESZN(5),
        ZEIFO(5),
        BLANZ(5),
       end of DRGNUM.

data : begin of item occurs 0,
       CATALOGUEREQUESTIDID,
       MBRSH(20),
       MTART(15),
       WERKS(30),
       MAKTX(40),
       MEINS(10),
       MATKL(30),
       BRGEW(5),
       GEWEI(2),
       NTGEW(5),
       VOLUM(5),
       VOLEH(2),
       EKGRP(10),
       XCHPF(3),
       EKWSL(15),
       WEBAZ(2),
       INSMK(2),
       KZKRI(2),
       MFRPN(5),
       MFRNR(5).
data : DRGNUM type  ZDRGNUM.
data:  end of item.

...............
..............
..............
*XML
call transformation ('ID')
source xml xmlupl
result tab = item[]

.

The problem is that for DRGNUM nodes in XML I can only manage to get last DRGNUM node data in the internal table.

How can I get all the 3 items for DRGNUM in the Internal table ?

Your help is appreciated.

Edited by: Hasan Bin Tariq on May 6, 2009 11:12 AM

2 REPLIES 2

former_member226203
Active Contributor
0 Kudos

u need to create three files with 3 different data in DRGNUM.

i.e, in the 1st file give the 1st set of data for drgnum and

in the 2nd file, u will hve 2nd set of data for DRGNUM and the rest will data will be same without any change. simliarly do the 3rd file.

and try to get into the internal table now.

0 Kudos

The file is coming from external system. So I have to find a solution to read it in the deep structured internal table.