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: 

save XML to SAP Server

Former Member
0 Kudos

Dear experts.

we have the SAP release 4,6c

I should save a XML file to the Application server

he problem is when i make the validation of the file an error occured.

If foud many samles which work on a higher relaese.

What can i do

Thanks

Frank

My Code

OPEN DATASET lv_file FOR OUTPUT in binary mode.

IF sy-subrc NE 0.

exit.

ENDIF.

*" IN BINARY MODE.

LOOP AT gt_gaeb_xml INTO gs_xml.

TRANSFER gs_xml TO lv_file.

IF sy-subrc NE 0.

exit.

ENDIF.

ENDLOOP.

CLOSE DATASET lv_file.

3 REPLIES 3

Former Member
0 Kudos

Frank

You need do create a XSTRING as a result of a Simple xml transformation. Then you can make :

OPEN DATASET fname FOR OUTPUT IN BINARY MODE.

TRANSFER XML_content TO FNAME.

CLOSE DATASET FNAME.

The 'XML_content' is a xtring. Example :

CALL TRANSFORMATION 'tranformation name'

SOURCE ficheiroexecucao = gt_source[]

RESULT XML xml_result.

OPEN DATASET fname FOR OUTPUT IN BINARY MODE.

TRANSFER xml_result TO FNAME.

CLOSE DATASET FNAME.

This works Fine!!

Best regards,

MR.

0 Kudos

Hello,

Transformation doesn't work on 4.6 system.

You need to carry some string manipulation by converting XSTRING to STRING.

Thanks,

Augustin.

Former Member
0 Kudos

Hi,

Please transfer Data into XML format.

Please look into following link,

/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach

Then use following code to transfer it to Application server,

DATA rec(80). "Adjust as per requirement/OS limits

OPEN DATASET filepath FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

LOOP AT l_xml_table into rec.

TRANSFER rec TO filepath.

ENDLOOP.

CLOSE DATASET filepath.

For operation on application server please look following link,

https://wiki.sdn.sap.com/wiki/display/Snippets/WorkingWithFiles?showChildren=true#children

Thanks & regards,

ShreeMohan