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: 

how to download XML file to SAP application server

Former Member
0 Kudos

Hello,

Could you please advise how can we download XML string to SAP application server.

I have used call transformation like below in my program .

data type of xml_result is xstring.

Appreciate your help on this

data :xml_result TYPE xstring.

CALL TRANSFORMATION zxml_wom SOURCE tl_xml_wstone = it_source RESULT XML xml_result.

Thanks in advance.

1 ACCEPTED SOLUTION

VijayCR
Active Contributor

Hello Abhis,

Take the result parameter and

do the below code :

     open dataset w_file_name for output
        in binary mode.
        if sy-subrc eq 0.
          transfer xml_result to  w_file_name

          close dataset  w_file_name

        endif.

w_file_name should be your application server path file name.

Let me know if this works.

Thanks,

Vijay.

7 REPLIES 7

nabheetscn
Active Contributor
0 Kudos

use open dataset etc to qrite contents of XML_RESULT to applciation server

Former Member
0 Kudos

Hi,

Try to use OPEN DATASET.

Regards,

RT.

Former Member
0 Kudos

Hi Abhis,

You can try yhr following t-codes.

Download file from Application server

Tcode: CG3Y

Upload files to Application Server

Tcode: CG3Z

Regards,

Ashish Kumar

VijayCR
Active Contributor

Hello Abhis,

Take the result parameter and

do the below code :

     open dataset w_file_name for output
        in binary mode.
        if sy-subrc eq 0.
          transfer xml_result to  w_file_name

          close dataset  w_file_name

        endif.

w_file_name should be your application server path file name.

Let me know if this works.

Thanks,

Vijay.

Former Member
0 Kudos

Thank you very much vijay  ..it solved my problem...

Former Member
0 Kudos

Hi,

write below logic to download XML file into application server.

 

 

TYPES: BEGIN OF ty_xml,
             xml_line
TYPE txt255,
             END OF ty_xml,

DATA: lv_xml TYPE char128,

          it_xml type standard table of ty_xml,

          st_xml type ty_xml.

*Here lv_xml is a file.

*Populate it_xml internal table with xml data

OPEN DATASET lv_xml FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
IF sy-subrc = 0.

LOOP AT it_xml INTO st_xml.


ENDLOOP.


CLOSE DATASET lv_xml.

TRANSFER st_xml-xml_line TO lv_xml.


ENDIF.

0 Kudos

Thank you guys for your help.

We should use binary mode.