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: 

XML file download

divsmart
Participant

Hi Experts,

I need to download the XML file format which was done.

But here my issue was ;When i download the XML some dump showing as 'Blue highlighted'

Please advice.

DATA: ld_filename TYPE string,
file_path TYPE string,
l_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
lv_path TYPE rlgrap-filename,"string,
lv_data TYPE string.
DATA: gs_name(30) TYPE c VALUE '_Material Received'.

DATA: ls_string TYPE string.

LOOP AT lt_last1 INTO ls_last1.

gs_xml-line = '<Material Received>'.
APPEND gs_xml TO gt_xml.

gs_xml-line = '<Receiving Number>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = ls_last1-mblnr .
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Receiving Number>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = '<Line Item>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = ls_last1-zeile .
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Line Item>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = '<Purshase Order>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = ls_last1-ebeln .
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Purshase Order>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = '<Part Number>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = ls_last1-matnr .
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Part Number>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = '<Unit Of Entry >' .
APPEND gs_xml TO gt_xml.

gs_xml-line = ls_last1-erfme .
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Unit Of Entry >' .
APPEND gs_xml TO gt_xml.

gs_xml-line = '<Qty Of UOM>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = ls_last1-erfmg .
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Qty Of UOM>' .
APPEND gs_xml TO gt_xml.

gs_xml-line = '<Quantity >' .
APPEND gs_xml TO gt_xml.

gs_xml-line = ls_last1-menge.
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Quantity >' .
APPEND gs_xml TO gt_xml.

gs_xml-line = '<Vendor name >' .
APPEND gs_xml TO gt_xml.

gs_xml-line = ls_last1-name1.
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Vendor name >' .
APPEND gs_xml TO gt_xml.

gs_xml-line = '</Material Received>'.
APPEND gs_xml TO gt_xml.

lv_path = p_file.

CLEAR : lv_data.
CONCATENATE ls_last1-matnr '-' ls_last1-mblnr '-' ls_last1-zeile gs_name INTO lv_data.


* l_filename = p_file.
CONCATENATE lv_path lv_data'.XML' INTO ld_fullpath.
* CONCATENATE lv_path l_filename'.XML' INTO ld_fullpath.
* CONCATENATE l_filename '\' lv_data '.XML' INTO ld_fullpath.

*-----------------------------------------------------------------
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = ld_fullpath
filetype = 'DBF'
CHANGING
data_tab = gt_xml
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.

REFRESH:gt_xml.
CLEAR: ls_last,ls_last1,lv_path,file_path,l_filename,ld_fullpath.

ENDLOOP.
1 ACCEPTED SOLUTION

Tomas_Buryanek
Active Contributor

Why are you using filetype = 'DBF' ?

You should only use ASC for simple text files or BIN for binary files. Note that for binary files you always have to provide binary file size in parameter "bin_filesize". Otherwise your file will be corrupted.

Your sample code looks like simple text table so please try filetype = ASC.

-- Tomas --
4 REPLIES 4

matt
Active Contributor
0 Kudos

Edit your post and format your code using the "code" button.

Tomas_Buryanek
Active Contributor

Why are you using filetype = 'DBF' ?

You should only use ASC for simple text files or BIN for binary files. Note that for binary files you always have to provide binary file size in parameter "bin_filesize". Otherwise your file will be corrupted.

Your sample code looks like simple text table so please try filetype = ASC.

-- Tomas --

ThanksTomas Buryanek,

I changed the filetype to ASC .

No dump file or corrupt in my download XML file.

Thanks and regards,

Senthil Gajendran.

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert
0 Kudos

What is gt_xml? It's not defined in your code, but it seems to be important as it contains the data that later gets corrupted... Please provide the complete code.