cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

DIrectory path to select a folder

Former Member
0 Likes
4,080

Can any one tell me if there is a Function module that will display the windows directory path and returns the filenames in the selected folder when F4 help is clicked.Currently I am using

cl_gui_frontend_services=>directory_browse

But please let me know if ther is any function module which gives me the same functionality as the above method does.

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Likes

Hi Sridhar,

try using the FM TMP_GUI_DIRECTORY_LIST_FILES. It might work.

Former Member
0 Likes

Hi

Check these codes


selection-screen begin of block b1 with frame .
Parameters File(100) lower case.
selection-screen end of block b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.
  CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
*     DEF_FILENAME           = ' '
      DEF_PATH               = '*.*'
*     MASK                   = ' '
*     MODE                   = ' '
*     TITLE                  = ' '
    IMPORTING
      FILENAME               = FILE
*     RC                     =
           .

or


PARAMETERS:P_FILE LIKE RLGRAP-FILENAME.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_FILENAME'
 EXPORTING
   PROGRAM_NAME        = SYST-CPROG
   DYNPRO_NUMBER       = SYST-DYNNR
  IMPORTING
   FILE_NAME           = P_FILE.

Former Member
0 Likes

Hi Sridhar,

WS_FILENAME_GET consits of classes only. i feel calling the method cl_gui_frontend_services=>directory_browse is the best solution. why do you want to go for Function module is there any specific requirements..

please let me know.

Note: it is adviced to use class methods rather than FM's

Regards

vijay

Former Member
0 Likes

Hi,

You can use this FM -'EPS_GET_DIRECTORY_LISTING' along with other F4 function modules which select the directory.

jayanthi_jayaraman
Active Contributor
0 Likes

Hi,

Here is the sample code.Kindly reward points by clicking the star on the left of reply,if it helps.

PARAMETERS P_FILE LIKE RLGRAP-FILENAME.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.

PERFORM SUB_F4_FILEPATH USING 'P_FILE' P_FILE.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_PATH = P_FILE

MASK = ',..'

MODE = '0 '

TITLE = 'Choose File'

IMPORTING

FILENAME = P_FILE

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5.

Former Member
0 Likes

Hi,

USe the below FM to get the files in an Application Server directory.

CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'

EXPORTING

dir_name = p_dir_name

TABLES

dir_list = i_files.

Best Regards,

vijay

Former Member
0 Likes

USe Function Module WS_FILENAME_GET.

Hope it works.

Thanks

Suresh

Former Member
0 Likes

HI.

Use F4_FILENAME .

Thats the best option.

Thanks and regards,

Maheshwari.V

Former Member
0 Likes

You can use function module KD_GET_FILENAME_ON_F4

A sample code can be seen in the following SAP program.

RFEBJP00. Refer to line 115 and below.

Reward points if it helps.

Regards,

Ankur Bhandari

Former Member
0 Likes

Hi

You can use <b>F4_FILENAME</b> .

Hope This Info Helps YOU.

<i>Reward Points If It Helps YOU.</i>

Regards,

Raghav

Former Member
0 Likes

hi sridhar,

1. F4_FILENAME

This is the Fm.

regards,

amit m.

Former Member
0 Likes

F4_FILENAME_GET or use

call function 'KD_GET_FILENAME_ON_F4'

changing

file_name = file

exceptions

mask_too_long = 1

others = 2.

if sy-subrc <> 0.

message 'Error in getting filename'.

endif.