Value Help for Browsing Server Files
Sometimes file processor reports need give support to the users, to browse files on the ABAP Server. The below snippet gives a solution for this, tested on ECC systems. The user can use a search help to trigger a dialog for browsing server files. Optional parameters are start folder and file mask.
TABLES: cffile. SELECT-OPTIONS: s_files FOR cffile-filename NO INTERVALS. AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_files-low. lcl_helper=>browse_server_file( * EXPORTING * i_start_path = p_fname * i_filemask = '*.xml' CHANGING c_path = s_files-low ).
CLASS lcl_helper DEFINITION. PUBLIC SECTION. "! Browse file on OS level "! @parameter i_start_path | Start directory "! @parameter i_filemask | File Mask "! @parameter c_path | Chosen file CLASS-METHODS browse_server_file IMPORTING i_start_path TYPE clike OPTIONAL i_filemask TYPE csequence OPTIONAL CHANGING c_path TYPE clike. ENDCLASS. CLASS lcl_helper IMPLEMENTATION. METHOD browse_server_file. DATA: fullpath TYPE string, last_backslash_pos TYPE i. TRY. "Value help for OS level file browse on ABAP server CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE' EXPORTING directory = i_start_path filemask = i_filemask IMPORTING serverfile = c_path EXCEPTIONS canceled_by_user = 1 OTHERS = 2. IF sy-subrc <> 0. RETURN. ENDIF. CATCH cx_root. RETURN. ENDTRY. ENDMETHOD. ENDCLASS.
Share this content: