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 Processing (XML file data to ABAP internal table).

Former Member
0 Likes
782

Hi,

I have a an XML file and i need to send the data to internal table. I suppose i have written the program correctly.

But the transformation program may not be correct.

So can one please tell me the transformation program c o d e or guide me to write the transformation code. Below are details of XML file and my program.

XML File

<?xml version="1.0" encoding="UTF-8" ?>

- <aeRequestOutputType>

+ <trackingInfo>

+ <JMSHeaders>

- <ns:__caret_reply_caret_ZBAPI xmlns:ae="http://www.tibco.com/" xsi:type="ns:__caret_reply_caret_ZBAPI_">

+ <RETURN>

- <T__TRADE__DATA>

- <item>

<BUKRS>1111</BUKRS>

<HKONT>22222</HKONT>

</item>

- <item>

<BUKRS>3333</BUKRS>

<HKONT>44444</HKONT>

</item>

</T__TRADE__DATA>

</ns:__caret_reply_caret_ZBAPI__TRADE__ACC__DOC__POST_caret_ZBAPI__TRADE__ACC__DOC__POST>

</aeRequestOutputType>

My Program

REPORT ZTEST13.

DATA : BEGIN OF itab OCCURS 0,

f(255) TYPE c,

END OF itab.

DATA : t001 TYPE TABLE OF ZTEST_ST_UB. "(structure has few variables like hkont,bukrs)

DATA: xmlupl TYPE string .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'c:\sap_output_xml.txt'

FILETYPE = 'ASC'

tables

data_tab = itab .

LOOP AT itab.

CONCATENATE xmlupl itab-f INTO xmlupl.

ENDLOOP.

CALL TRANSFORMATION ZTEST_ST_UB2

SOURCE XML xmlupl

RESULT root = t001.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
618

Hi,

use class cl_xml_document and method import_from_file inorder to read the xml file to internal table.

go trough this [LINK|http://wiki.sdn.sap.com/wiki/display/ABAP/UploadXMLfiletointernal+table] for detial code.

Regards,

Shanmugavel chandrasekaran

3 REPLIES 3
Read only

Former Member
0 Likes
619

Hi,

use class cl_xml_document and method import_from_file inorder to read the xml file to internal table.

go trough this [LINK|http://wiki.sdn.sap.com/wiki/display/ABAP/UploadXMLfiletointernal+table] for detial code.

Regards,

Shanmugavel chandrasekaran

Read only

0 Likes
618

Hi,

Use ixml classes

Regards,

sravan.

Read only

0 Likes
618

|Hi Everybody.

I have a same issue.

I need to read a XML file and map all the element attributes to a internal tables.

Do you have a sample to read elements from XML string and insert into the internal tables.

I found samples about the class IXML, but these aren't so clear.

Thanks in advance.

Regards.