Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Reg: Saving the file

Hi Gurus,

In my requirent i want to save the data on presentation server,

but i want a Pop-up like in windows word, i know the using method cl_gui_frontend_services=>file_save_dialog we get the pop up. But how to save the data in internal table when the Pop-up come. Please help me.

Tags:
replied

hi

U can check this link

http://www.sapdevelopment.co.uk/file/file_updown.htm

This method of file download with check uses the latest techniques

and achieves a very neat solution

DATA: ld_filename TYPE string,

ld_path TYPE string,

ld_fullpath TYPE string,

ld_result TYPE i.

Display save dialog window

CALL METHOD cl_gui_frontend_services=>file_save_dialog

EXPORTING

window_title = ' '

DEFAULT_EXTENSION = 'xls'

default_file_name = 'accountsdata'

INITIAL_DIRECTORY = 'c:\temp\'

CHANGING

filename = ld_filename

path = ld_path

fullpath = ld_fullpath

user_action = ld_result.

Check user did not cancel request

CHECK ld_result EQ '0'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = ld_fullpath

filetype = 'ASC'

APPEND = 'X'

write_field_separator = 'X'

CONFIRM_OVERWRITE = 'X'

TABLES

data_tab = it_datatab[] "need to declare and populate

EXCEPTIONS

file_open_error = 1

file_write_error = 2

OTHERS = 3.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

filename = p_pfile

filetype = 'ASC'

filetype = 'DAT' (Tab delimited)

IMPORTING

filesize = size "10/02/02

filelength = size "10/02/02

TABLES

data_tab = xls_tab

EXCEPTIONS

file_open_error = 1

OTHERS = 2.

IF sy-subrc 0.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

filename = p_pfile

filetype = 'WK1'

IMPORTING

filesize = size

TABLES

data_tab = xls_tab

EXCEPTIONS

file_open_error = 1 "10/02/02

others = 2. "10/02/02

invalid_filesize = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

customer_error = 7.

IF sy-subrc NE 0.

WRITE: / 'Download file', p_pfile,

'has error with condition code', sy-subrc.

STOP.

ENDIF.

ENDIF.

Hope this helps.

regards

satish

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question