02-10-2004 10:49 AM
Hi there,
I hope any one can help me. I created an XML file with the CALL TRANSFORMATION statement. I want to download the created file. Does any one no a way to do this?
Thx in advance.
Greetings Maarten
02-10-2004 4:20 PM
You have several options on how you want to receive the results of your call transformation. The following is from the on-line help:
Use addition 4a to transform into the XML document rxml. For the specification of rxml, you have the following three options:
The XML document can be stored in an ABAP variable rxml of the type STRING or XSTRING, or in an internal standard table sxml of the elementary line type C.
For rxml, you specify an interface reference variable of the type IF_IXML_OSTREAM that points to an IXML output stream.
For rxml, you specify an interface reference variable of the type IF_IXML_DOCUMENT that points to an IXML document.
With the stream factory you have several options. Before you call your CALL TRANSFORMATION, you setup your stream factory for these different options.
1. You want to write the file to the application server file system. You want to create your OSTREAM as a binary string. In this example b_xml is an empty binary string. OSTEAM will be the reference variable of tyep IF_IXML_OSTREAM.
ostream =
streamfactory->create_ostream_xstring( b_xml ).
You get the output lenght with the following:
ressize = ostream->get_num_written_raw( ).
You can then send the entire string to the file system with the following:
transfer b_xml to filename1 length ressize.
2. You want to write the file to the Presentation server (Frontend). This time you will want to create a binary table. This way you can send the binary table to the frontend using GUI_DOWNLOAD or CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD.
refresh restab.
ostream =
streamfactory->create_ostream_itable( table = restab ).
RESTAB is a table of type RAW 4096 characters.
You can then download with the call to GUI_DOWNLOAD:
call function 'GUI_DOWNLOAD'
exporting
bin_filesize = ressize
filename = i_file
filetype = 'BIN'
tables
data_tab = restab
exceptions
others = 1.
02-10-2004 4:21 PM
Hello Thomas,
Thx for your detailed answer. I will try it at work and let you know if it worked.
Greetings Maarten.