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: 

download data into application server in XLS format

Madhurivs23
Participant
0 Kudos

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

8 REPLIES 8

Former Member
0 Kudos

Hi,

What is your exact requirement?

Thanks,

Phani Diwakar.

0 Kudos

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

0 Kudos

I would open the dataset in text mode and use a suitable encoding for your locale.

0 Kudos

Hi Steve ,

Thanks for the response,

Is there any drawback of saving file with .xls rather than .csv?

regards,

Madhuri

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

0 Kudos

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

former_member342104
Participant
0 Kudos

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.