Tuesday, December 20, 2011

abap : How to save a file using a dialog box

*Selecting a file to save too, plus inserting default file extension .xls
tables rlgrap.

DATA: ld_filename TYPE string,
ld_path TYPE string,
ld_fullpath TYPE string,
ld_result TYPE i,
gd_file TYPE c.

selection-screen begin of block m with frame.
PARAMETERS: p_file TYPE rlgrap-filename.
selection-screen end of block m.

* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

* 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.
p_file = ld_fullpath.


source :
http://www.sapdev.co.uk/file/file_objsave.htm

No comments:

Post a Comment