Sometimes a program wants to save a file locally on the user’s computer via the SAP Gui. In these cases it is usual that one of the fields of the selection screen is the location of the folder on the local disk.
This is a way of initialising this field with the temporary folder of the SAP Gui:
PARAMETERS: p_path TYPE string. AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path. CALL METHOD cl_gui_frontend_services=>directory_browse EXPORTING initial_folder = p_path CHANGING selected_folder = p_path. INITIALIZATION. CALL METHOD cl_gui_frontend_services=>get_sapgui_workdir CHANGING sapworkdir = p_path. CALL METHOD cl_gui_cfw=>flush.
Thanks to Sérgio Fraga for the tip.
And thank you HatM for the photo.
Greetings from Abapinho.