abap分割路径和文件名

abap分割路径和文件名

读取该字符串C:\ABC\DEF\HIJ\1000002201.xls中的1000002201.xls

方法1:

利用系统的function

SO_SPLIT_FILE_AND_PATH – 将一个包含路径的全文件名分割为文件名和路径

方法2:

写代码:

split full_name at l_delimiter into table lt_split.
describe table lt_split lines l_lines.
* only path has been given
if l_lines eq 1.
    move full_name to file_path.
    clear stripped_name .
    exit.
endif.
* path and name have been found
loop at lt_split into ls_split.
    if sy-tabix < l_lines.
      concatenate file_path ls_split l_delimiter into file_path.
    else.
      stripped_name = ls_split.
    endif.
endloop.

posted @ 2011-09-18 02:11  VerySky  阅读(1959)  评论(0)    收藏  举报