Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Directory Selection?

Former Member
0 Kudos

Hello All,

How we can select one directory name in to the selection screen. Which Function Module can I use for that?

Thanks in Advance

regards,

LIJO

4 REPLIES 4

Former Member
0 Kudos

Check FM RZL_READ_DIR_LOCAL

Regards,

Santosh

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'F4_DXFILENAME_4_DYNP'

EXPORTING

dynpfield_filename = p_file

dyname = sy-cprog

dynumb = sy-dynnr

filetype = c_p

location = c_a

server = space.

Message was edited by:

Jayanthi Jayaraman

Former Member
0 Kudos

use module FM RZL_READ_DIR_LOCAL

pass the dir eg 'C:'

it will return iternal table with all the contents

or try another method

AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.

REFRESH: it_tab[].

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = 'Select File'

default_filename = '*.pdf'

file_filter = '*.pdf'

CHANGING

file_table = it_tab

rc = gd_subrc.

READ TABLE it_tab INTO wa_tab INDEX 1.

IF NOT wa_tab IS INITIAL.

file = wa_tab-filename.

ELSE.

MESSAGE s000(0k) WITH 'Please enter valid file name'(001).

STOP.

ENDIF.

START-OF-SELECTION.

SET SCREEN 100.

reward if useful

Message was edited by:

Sumesh Nair

Former Member
0 Kudos

Hi Lijo ,

You can use the following function module

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

program_name = syst-repid

dynpro_number = syst-dynnr

  • MASK = WA_MASK

CHANGING

file_name = fname

EXCEPTIONS

mask_too_long = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.