10-17-2008 11:58 AM
Hi all,
I want to download data into application server in XLS format.
Is it possible through open dataset?
or how should I proceed for this
rgds,
Madhuri
10-17-2008 12:03 PM
10-17-2008 12:13 PM
Hi Phani,
I want to download the internal table data into APPLICATION SERVER in XML/ XLS format.
Is is possible using open dataset in text mode? or binary mode?
rgds,
Madhuri
10-17-2008 2:32 PM
I would open the dataset in text mode and use a suitable encoding for your locale.
10-18-2008 9:10 AM
Hi Steve ,
Thanks for the response,
Is there any drawback of saving file with .xls rather than .csv?
regards,
Madhuri
10-17-2008 12:03 PM
Please see this page for info on how to create an XML file that be read by Excel:
[https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/exporting%2bdata%2bto%2bexcel%2b-%2bxml%2bto%2bthe%2brescue]
Edited by: Steve Higton on Oct 17, 2008 1:04 PM
10-17-2008 12:04 PM
Hi!
Use mask = .xls to download excel format file in the application server.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = c_x
mask = '.xls'
CHANGING
file_name = v_file
EXCEPTIONS
mask_too_long = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
And then you can use FM gui_download.
Download the file to local file
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_file2
filetype = 'ASC'
write_field_separator = c_x
dat_mode = c_x
TABLES
data_tab = i_tab
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
Hope this would help you.
10-17-2008 2:17 PM
Hi Amanda,
Thanks for your response.
I want to download the file in application server and not local server.
As far as I know, GUI_DOWNLOAD can be used for local server only.
rgds,
Madhuri
10-18-2008 10:25 AM
data : abc type string.
data : begin of itab occurs 0,
data type string.
end of itab.
concatinate all variables to abc.
move abc to itab.
DESCRIBE TABLE itab LINES lincnt.
concatinate lincnt to filename seprated by ' .xsl'
OPEN DATASET filename FOR APPENDING IN TEXT MODE ENCODING DEFAULT.
LOOP AT itab INTO wa_itab
abc = wa_itab-data.
TRANSFER abc TO filename.
ENDLOOP.
CLOSE DATASET filename.
thanx
kk.