‎2009 Sep 30 11:16 PM
We are on ECC6.0 & one of the old programs uses SKTX_DIRECTORY_SELECT.
Can I use CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE for my purpose to choose the folder.
Thanks,
Kiran
‎2009 Oct 01 3:37 AM
Hi Kiran,
<li>I could not find that function module SKTX_DIRECTORY_SELECT in 4.6 and ECC 6.0 also. But anyhow you seem to be looking for function module or method which needs to select directory with a dialog.
<li>Try this way.
Thanks
Venkat.OREPORT ztest_program.
DATA: window_title TYPE string VALUE 'Set download directory'.
DATA: sapworkdir TYPE string VALUE 'C:\'.
PARAMETERS folder TYPE string.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR folder.
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = window_title
initial_folder = sapworkdir
CHANGING
selected_folder = folder
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.
IF folder IS INITIAL.
MESSAGE 'No folder has been selected' TYPE 'S'.
EXIT.
ENDIF.
START-OF-SELECTION.
WRITE folder.
‎2009 Sep 30 11:28 PM
Make sure the types of initial folder and picked folders are strings.
CL_GUI_FRONTEND_SERVICES=>directory_browse( exporting initial_folder = initialFolder
changing selected_folder = pickedFolder
exceptions cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3 ).
‎2009 Sep 30 11:32 PM
Initial Folder is not a mandatory one. Can you please explain the purpose of this.
Thanks,
Kiran
‎2009 Sep 30 11:48 PM
It will give you a popup which will allow to browse the directories in windows.
‎2009 Oct 01 3:15 AM
Thanks. But when I select a folder, it doesn't come on to the parameter box.
Thanks,
Kiran
‎2009 Oct 01 3:24 AM
try using DIRECTORY_GET_CURRENT method of the class after DIRECTORY_BROWSE
‎2009 Oct 01 3:32 AM
Hi Kartik,
That did not work.
data: p_sel_folder type string,
p_ini_folder type string.
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = 'Choose a Folder for the Export Data.'
initial_folder = p_ini_folder
CHANGING
selected_folder = p_sel_folder
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.
CALL METHOD cl_gui_frontend_services=>directory_get_current
CHANGING
current_directory = p_sel_folder
EXCEPTIONS
directory_get_current_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks,
Kiran
‎2009 Oct 01 3:37 AM
Hi Kiran,
<li>I could not find that function module SKTX_DIRECTORY_SELECT in 4.6 and ECC 6.0 also. But anyhow you seem to be looking for function module or method which needs to select directory with a dialog.
<li>Try this way.
Thanks
Venkat.OREPORT ztest_program.
DATA: window_title TYPE string VALUE 'Set download directory'.
DATA: sapworkdir TYPE string VALUE 'C:\'.
PARAMETERS folder TYPE string.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR folder.
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = window_title
initial_folder = sapworkdir
CHANGING
selected_folder = folder
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.
IF folder IS INITIAL.
MESSAGE 'No folder has been selected' TYPE 'S'.
EXIT.
ENDIF.
START-OF-SELECTION.
WRITE folder.
‎2009 Oct 01 4:05 AM
Thanks Venkat.
I forgot to pass my directory back to selection-screen parameter.
Regds,
Kiran