BAPI to delete an excel file on local pc from R/3
In our requirement, we have an excel file in Local pc(in network). We want to delete this excel file from R/3 .
Is their any RFC/BAPI for deleting this excel file.Could you suggest any?
Valter Oliveira replied
I could suggest you FM GUI_DELETE_FILE that probably do the same.
But please don't be "afraid" of method. They are faster than function modules. Check this example.
CLASS cl_gui_frontend_services DEFINITION LOAD. DATA: data_tab TYPE STANDARD TABLE OF file_info. DATA: wa TYPE file_info. DATA: w_count TYPE i. CALL METHOD cl_gui_frontend_services=>directory_list_files EXPORTING directory = p_dirin files_only = 'X' directories_only = space CHANGING file_table = data_tab count = w_count. IF sy-subrc NE 0. EXIT. ENDIF. LOOP AT data_tab INTO wa. CONCATENATE p_dirin wa-filename INTO w_filename. CONCATENATE p_dirout wa-filename INTO w_copyout. CALL METHOD cl_gui_frontend_services=>file_copy EXPORTING SOURCE = w_filename DESTINATION = w_copyout overwrite = 'X' EXCEPTIONS cntl_error = 1 error_no_gui = 2 wrong_parameter = 3 disk_full = 4 access_denied = 5 file_not_found = 6 destination_exists = 7 unknown_error = 8 path_not_found = 9 disk_write_protect = 10 drive_not_ready = 11 not_supported_by_gui = 12 OTHERS = 13. CHECK sy-subrc EQ 0. CALL METHOD cl_gui_frontend_services=>file_delete EXPORTING filename = w_filename CHANGING rc = w_rc. ENDLOOP.