Correlation function: Ws_query: Determines whether the folder path exists. Gui_create_directory: Create folder. Checks whether the specified folder exists and creates a new folder if it does not exist. Report z_example_01. Parameter:l_file type LocalFile. Data:status Type C. The path to the Save folder Data:begin of folder occurs 0, Dire type LocalFile, End of folder. "Saves the folder path recognition symbol. Data:begin of sign occurs 0, SIG Type C, End of sign. Start-of-selection. Clear:folder[],sign[],status. "New folder path recognition symbol, if no relevant symbol is invalid path Sign-sig = '/'. Append sign. Sign-sig = ' \ '. Append sign. Search L_file for sign. "Determines if the folder path string is valid, invalid exit If SY-SUBRC <> 0. Message e005 (zmess) with ' not valuable directory! '. Exit. Else. "Check if the folder already exists Perform checkdir using l_file changing status. If status = 1. Message e005 (zmess) with ' The Directory is exit! '. Exit. endif. endif. Split l_file at sign into table folder. Read Table folder index 1. L_file = Folder-dire. " The first behavior letter of the inner table Loop at folder. "Iterates through the folder characters, checks if the path exists, and does not create the If Sy-tabix > 1. Concatenate l_file ' \ ' Folder-dire into L_file. Perform checkdir using l_file changing status. If status = 0. Perform createrdir using L_file. endif. endif. Endloop. *--------------------------------------------------------- *-Check if the path exists, the function returns 1, there is no return 0-------- *--------------------------------------------------------- Form checkdir using dir type localfile changing ret type C. Call FUNCTION ' Ws_query ' Exporting * Environment = FILENAME = DIR QUERY = ' DE ' * WINID = Importing RETURN = RET EXCEPTIONS Inv_query = 1 No_batch = 2 Frontend_error = 3 OTHERS = 4. EndForm. "Checkdir *--------------------------------------------------------- *-----Create folders based on path---------------------------------- *--------------------------------------------------------- FORM createrdir USING DIR TYPE localfile. Call FUNCTION ' Gui_create_directory ' Exporting DIRNAME = DIR EXCEPTIONS FAILED = 1 OTHERS = 2. WRITE:/' CREATE DIRECTOR success,path: ', DIR. EndForm. "Createrdir |