Problem solve Get help with specific problems with your technologies, process and projects.

Select directories and files using Object Methods

The following code uses SAP Objects to select directories and files.

The following code uses SAP Objects to select directories and files.

Version- 4.6c
**************************************
*" For Selecting a File
*"
*" code also demonstrates 
*" how to specify the file extension


tables rlgrap.

data: i_tab type filetable,
      vg_subrc type i.

selection-screen begin of block m with frame.
    select-options so_fpath for rlgrap-filename.
selection-screen end of block m.

at selection-screen on value-request for so_fpath-low.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    EXPORTING
        WINDOW_TITLE = 'Select File'
        DEFAULT_FILENAME = '*.txt'
        MULTISELECTION = 'X'
    CHANGING
        FILE_TABLE = i_tab
        RC = vg_subrc.

loop at i_tab into so_fpath-low.
    so_fpath-sign = 'I'.
    so_fpath-option = 'EQ'.
    append so_fpath.
endloop.

*"
****************************************


**************************************
*" For Selecting a Directory

data: v_path type string.

parameters: v_path2 like rlgrap-filename.

at selection-screen on value-request for v_path2.
    
    CALL METHOD cl_gui_frontend_services=>directory_browse
        EXPORTING window_title = 'Windows Title'
                        initial_folder = 'C:'
        CHANGING selected_folder = v_path.

    CALL METHOD cl_gui_cfw=>flush.

    concatenate v_path '' into v_path2.

*"
****************************************
This was last published in June 2002

Dig Deeper on SAP Basis administration and NetWeaver administration

PRO+

Content

Find more PRO+ content and other member only offers, here.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchManufacturingERP

SearchOracle

SearchDataManagement

SearchAWS

SearchBusinessAnalytics

SearchCRM

SearchContentManagement

SearchFinancialApplications

Close