1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
parameters: pFolder like rlgrap-filename memory id MFOLDER. at selection-screen on value-request for pFolder. data: objFile type ref to cl_gui_frontend_services. data: pickedFolder type string. data: initialFolder type string. if sy-batch is initial. create object objFile. if not pFolder is initial. initialFolder = pFolder. else. objFile->get_temp_directory( changing temp_dir = initialFolder exceptions cntl_error = 1 error_no_gui = 2 not_supported_by_gui = 3 ). endif. objFile->directory_browse( exporting initial_folder = initialFolder changing selected_folder = pickedFolder exceptions cntl_error = 1 error_no_gui = 2 not_supported_by_gui = 3 ). if sy-subrc = 0. pFolder = pickedFolder. else. write: / 'An error has occured picking a folder'. endif. endif. ----------------或者--------------------------------------- DATA: LW_PATH TYPE STRING . CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_BROWSE EXPORTING WINDOW_TITLE = '选择文件目录' * initial_folder = 'C:' CHANGING SELECTED_FOLDER = LW_PATH EXCEPTIONS CNTL_ERROR = 1 ERROR_NO_GUI = 2 NOT_SUPPORTED_BY_GUI = 3 OTHERS = 4. IF SY-SUBRC 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. P_PATH = LW_PATH . |
2019
08-29
08-29