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

Writing from internal table to xml format

Former Member
0 Likes
1,090

Hi,

I searched all the forum and I have a question on writing the data from internal table in xml format to the file on app.server.

Data: ITAB1 TYPE TABLE OF SPFLI,

L_XML TYPE REF TO CL_XML_DOCUMENT.

SELECT * FROM SPFLI INTO TABLE ITAB1.

  • CREATE THE XML OBJECT

CREATE OBJECT L_XML.

  • CONVERT THE DATA TO XML

CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB1[] ).

after this how to move the XML data in the object to a file on app.server.

Thanks

Hi,

I searched all the forum and I have a question on writing the data from internal table in xml format to the file on app.server.

Data: ITAB1 TYPE TABLE OF SPFLI,

L_XML TYPE REF TO CL_XML_DOCUMENT.

SELECT * FROM SPFLI INTO TABLE ITAB1.

  • CREATE THE XML OBJECT

CREATE OBJECT L_XML.

  • CONVERT THE DATA TO XML

CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB1[] ).

after this how to move the XML data in the object to a file on app.server.

Thanks

7 REPLIES 7
Read only

Former Member
0 Likes
888

Hi Ram,

Did you try using OPEN DATASET, TRANSFER & CLOSE DATASET?

Regards,

Satish

Read only

0 Likes
888

Satish,

Transfer from where?

CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB1[] ).

In here the xml is created.. how to get the data out?

Read only

0 Likes
888

You have data in ITAB1 right?

Loop at ITAB1 into wa1.
 Transfer wa1 to dataset.
endloop.

Regards,

Satish

Read only

0 Likes
888

p_ufile is the path of the application server

p_output is the internal table with data to be moved to app serv.

OPEN DATASET p_ufile FOR OUTPUT IN TEXT MODE.

LOOP AT p_output INTO wa_file.

TRANSFER wa_file TO p_ufile.

CLEAR wa_file.

ENDLOOP.

CLOSE DATASET p_ufile.

for XML I guees the path p_ufile ill be <b>sap/usr/tmp/file.xml</b>

Read only

0 Likes
888

satish,

ITAB[] is internal table with data not xml formated

if I use the class

CALL METHOD L_XML->DISPLAY( ).

it will display all the xml format with ITAB data.. I want instead of display write to a file on app.server.

Read only

0 Likes
888

Ram,

Did you check this post

Regards,

Satish

Read only

0 Likes
888

Satish,

Yes, I did. But most of them are unhelpful.