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: 

DataSet text file to internal table

Former Member
0 Kudos

Hi,

I have an XML file which is stored in AL11 as a one line string like below:

<?xml version="1.0" encoding= "UTF-8"?><GrpHdr><Matnr>1234567</matnr><MTART>type</MTART><MATKL>group</MATKL><BISMT>00000123</BISMT><VOLUM>17</VOLUM></GrpHdr>

I used:

DATA: lv_data TYPE string.

OPEN DATASET file1 FOR INPUT IN TEXT MODE ENCODING UTF-8. and READ DATASET

DO.

READ DATASET file1 INTO lv_data.

**lv_data will contain the same string line as the file appears in AL11.

ENDDO.

My questions is, how can I assign/map the fields in the file to my internal table of type customized table and store the new record in DB table?

Thank you,

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Thanks everybody for your help. I have used below guide with exactly the same and it works just as I wanted.

Guide towards a simple conversion of an XML file to ABAP Internal table, using XML parsing

Thank you.

5 REPLIES 5

former_member200338
Active Contributor
0 Kudos

you can use transformation. Have a look on call transformation id in SDN

ipravir
Active Contributor
0 Kudos

Hi Eman,

If your process is very much frequent use, and there sould not be any changes in future, then i Suggest to go from creation a Transformation for the related XML type.

Creating a Transformation Program -  ABAP Workbench Tools - SAP Library

Or your can use the below function module to read the store the XML informaiton in internal Table.

SWF_XML_TO_ABAP


or follow the below Link, which is related to your requirement.

Regards.

Praveer.

Former Member
0 Kudos

Hello Eman,

You can use transformation to map XML data into an internal table and vice-versa. Below are some links for your reference:

http://scn.sap.com/message/1283866#1283866

http://sapblog.rmtiwari.com/2009/04/generate-simple-transformation-for-xml.html

I found few other useful links, if you do not want to use transformation:

http://scn.sap.com/docs/DOC-24791

http://wiki.scn.sap.com/wiki/display/ABAP/Upload+XML+file+to+internal+table

http://scn.sap.com/thread/96971

With Regards,

Dipika.

Former Member
0 Kudos

Thanks everybody for your help. I have used below guide with exactly the same and it works just as I wanted.

Guide towards a simple conversion of an XML file to ABAP Internal table, using XML parsing

Thank you.

0 Kudos

Hi Eman,

I think the same link i have forward to you.

Regards.

Praveer.