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: 

Convert an internal table from ABAP to an xml file on the Unix server

Former Member
0 Kudos

I'm trying to convert an internal table to an xml file. This file will be downloaded to a unix server. Can someone help?

5 REPLIES 5

0 Kudos

I think what you gave me works for downloading in the foreground to your hard drive. I want to do a transfer to a unix directory.

0 Kudos

Hello Linda,

You can combine the code given by Mahalakshmi with something like this:

CALL FUNCTION 'FILE_GET_NAME'

EXPORTING

logical_filename = 'YOUR_LOGICAL_FILE_NAME

parameter_1 = l_file_name_xml

IMPORTING

file_name = l_file_server

EXCEPTIONS

file_not_found = 1

OTHERS = 2.

IF sy-subrc = 0.

TRY.

OPEN DATASET l_file_server FOR OUTPUT. "<IN TEXT MODE> <ENCODING DEFAULT>.

ENDTRY.

IF sy-subrc = 0.

LOOP AT lt_xml INTO ls_xml.

TRANSFER ls_xml TO l_file_server.

ENDLOOP.

CLOSE DATASET l_file_server.

ENDIF.

ENDIF.

You need to have the server path defined (look at the paths with tcode AL11) and the file logical name with tcode FILE

Best regards,

Andri

0 Kudos

Thanks. Do you know how to create the schema?

0 Kudos

Thanks, but it's not working correctly. It splits up the file within the brackets. This is just an example. It right justifies the amount and leaves spaces. Basically, it's not formatting correctly. Is there something that I'm missing?

A name contained an invalid character. Error processing resource 'file:///C:/ONESD/xml_inv.xml'. Line 4, Position 9

YPE_DESC>Non-City Customer</FUND_TYPE_DESC><APPL_CODE>A00</APPL_CODE><APPL_CODE_NAME>SDDPC-Corp E...