01-14-2015 8:05 AM
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,
01-14-2015 12:21 PM
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.
01-14-2015 8:36 AM
you can use transformation. Have a look on call transformation id in SDN
01-14-2015 9:05 AM
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.
01-14-2015 9:55 AM
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.
01-14-2015 12:21 PM
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.
01-14-2015 1:30 PM
Hi Eman,
I think the same link i have forward to you.
Regards.
Praveer.