Here is the simple solution for a problem that we frequently faced, splitting path and file name from files full path.
DATA : lv_file_path TYPE string VALUE 'C:\inetpub\wwwroot\welcome.png'.
DATA : lv_path_only type string ,
lv_filename_only type string.
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = lv_file_path
IMPORTING
stripped_name = lv_path_only
file_path = lv_filename_only
EXCEPTIONS
x_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
RESULT :
LV_PATH_ONLY >> 'welcome.png'
LV_FILENAME_ONLY >> 'C:\inetpub\wwwroot\'
No comments:
Post a Comment