‎2006 Dec 13 10:27 PM
Hi gurus
iam converting sap data into xml and now iam able to download the file onto presentation server properly.
now i want to write the file onto application server.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_ostream TYPE REF TO if_ixml_ostream,
l_renderer TYPE REF TO if_ixml_renderer,
l_document TYPE REF TO if_ixml_document.
..............
............
l_streamfactory = l_ixml->create_stream_factory( ).
l_ostream = l_streamfactory->create_ostream_itable(
table = l_xml_table ).
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
Saving the XML document
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'c:\satish\sample_trans.xml'
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
‎2006 Dec 14 1:40 PM
Is there any one who can help me. Help will be greatly appreciated with points.
‎2006 Dec 14 2:49 PM
Hi satya,
Do you want it programatically or using some transaction.
1.
if it is transaction then use CG3Z transaction.
give the PC path(source), and appl server path(target)
you can uplaod it directly.
2.
if u want it programatically, try this:
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.
regards,
Kumar
‎2006 Dec 14 11:52 PM
HI KUMAR
I TRIED THAT IT DIDNT WORK.
DATA: XML_TABLE TYPE TABLE OF XML_LINE.
.........
L_OSTREAM = L_STREAMFACTORY->CREATE_OSTREAM_ITABLE(
TABLE = XML_TABLE ).
........
CLEAR P_FILE.
CONCATENATE SY-DATUM4(2) SY-DATUM6(2) SY-DATUM(4) INTO V_DATLO.
CONCATENATE P_OUT V_DATLO P_OFILE '.XML' INTO P_FILE.
OPEN DATASET P_FILE FOR OUTPUT IN BINARY MODE." ENCODING DEFAULT.
IF SY-SUBRC = 0.
LOOP AT XML_TABLE INTO XML_TABLE_WA.
TRANSFER XML_TABLE_WA TO P_FILE.
ENDLOOP.
ELSE.
MESSAGE E001(02) WITH 'UNABLE TO OPEN THE FILE FOR OUTPUT'.
WRITE 😕 'UNABLE TO OPEN THE FILE FOR OUTPUT'.
ENDIF.
CLOSE DATASET P_FILE.