cancel
Showing results for 
Search instead for 
Did you mean: 

Files in a directory on presentation server

Former Member
0 Kudos

Hello all,

Do you know which FM or class to use to get a list with files from a local directory.

There is a function Z_DIR_GET_FILES, which does this thing but the file name is trucated if it have more than 21 characters.

Thank you!

Bogdan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

Answers (2)

Answers (2)

Former Member
0 Kudos

TRY THIS , THIS IS VERY SIMPLE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR F_NAME.

CALL FUNCTION 'NAVIGATION_FILENAME_HELP'

IMPORTING

SELECTED_FILENAME = F_NAME.

OR

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = PRG_NAME

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ' '

IMPORTING

FILE_NAME = F_NAME

EXCEPTIONS

OTHERS = 1.

PLEASE EXPLAIN IN DETAIL , IF YOUR QUESTION IS SOMETHING ELSE.

Former Member
0 Kudos

Check this one.

FORM f9008_f4_hlp_for_pc_file.
  DATA: li_filetable TYPE STANDARD TABLE OF file_table,
        lv_return TYPE i,
        lw_filetable TYPE file_table.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
     EXPORTING
       window_title            = 'Select file for download'
       default_extension       = '.txt'
       initial_directory       =  'C:'
     CHANGING
       file_table              = li_filetable
       rc                      = lv_return
     EXCEPTIONS
       file_open_dialog_failed = 1
       cntl_error              = 2
       error_no_gui            = 3
       OTHERS                  = 4
           .
  IF sy-subrc <> 0.
    MESSAGE e006 WITH text-077.
  ELSE.
    READ TABLE li_filetable INTO lw_filetable INDEX 1.
    v_fnam = lw_filetable-filename.
  ENDIF.

In adition to that there are

CALL METHOD cl_gui_frontend_services=>DIRECTORY_LIST_FILES

EXPORTING

CALL METHOD cl_gui_frontend_services=>DIRECTORY_GET_CURRENT

EXPORTING

This will Returns the Current Directory

U can have a look into the methods.

Hope this helps.