Save File Dialog!

This will show you how to popup the save file dialog from selection screen. You can facilitate selection of file without manually entering file path.

Selection:

Result dialog:

DATA: gv_filename TYPE string,
gv_path TYPE string,
gv_result TYPE i.

SELECTION-SCREEN BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS: p_path TYPE string LOWER CASE.                         “File path
SELECTION-SCREEN END OF BLOCK b4.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.

* Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
*      window_title      = ‘ ‘
default_extension = ‘txt’
default_file_name = ‘file_name’
initial_directory = ‘C:’
CHANGING
filename          = gv_filename
path              = gv_path
fullpath          = p_path
user_action       = gv_result.

Leave a Reply

Your email address will not be published. Required fields are marked *