Skip to Content
0
Former Member
Nov 07, 2006 at 06:59 PM

File Save Dialog: Writing data to a new File

485 Views

Hi ,

I am allowing user to save a file in a directory using file_save_dialog in cl_gui_frontend_services, so i can write data to it using gui_download.

When the user choose the file at the selection screen its not getting displayed in the parameter box.

I have used the following code.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR d_wfil.

PERFORM dest_local.

FORM dest_local .

DATA:

s1 TYPE string,

s2 TYPE string.

DATA: cv_filename TYPE string.

CALL METHOD cl_gui_frontend_services=>file_save_dialog

EXPORTING

window_title = 'File'

default_extension = 'TXT'

default_file_name = cv_filename

  • FILE_FILTER =

initial_directory = 'C:\Documents and Settings\root\Desktop'

  • WITH_ENCODING =

  • PROMPT_ON_OVERWRITE = 'X'

CHANGING

filename = s

path = s1

fullpath = cv_filename

  • user_action =

  • FILE_ENCODING =

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3

OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endform.