2009 Apr 24 11:14 AM
Hi Experts,
I have a requirement that i need to capture the last word
For eg : i have a file name
c:/example/example2/hi.txt
i need to capture hi.txt into a variable
2009 Apr 24 11:19 AM
>
> i got it
>
> 'SO_SPLIT_FILE_AND_PATH'
>
> we can use this fm
So mark the question as answered.
2009 Apr 24 11:19 AM
2009 Apr 24 11:19 AM
try this
DATA: it_file TYPE TABLE OF string,
wa_file LIKE LINE OF it_file,
w_lines TYPE i,
w_file1 TYPE string,
w_file2 TYPE string.
w_file1 = 'C:\Documents and Settings\abc.def\asdfgh\abcde\filename.csv'.
SPLIT w_file1 AT '\' INTO TABLE it_file.
DESCRIBE TABLE it_file LINES w_lines.
READ TABLE it_file INTO wa_file INDEX w_lines.
WRITE: wa_file.
2009 Apr 24 11:19 AM
>
> i got it
>
> 'SO_SPLIT_FILE_AND_PATH'
>
> we can use this fm
So mark the question as answered.
2009 Apr 24 11:26 AM
Hi, Matt
I think better to lock this now?
Thanks and Best Regards,
Faisal
2009 Apr 24 11:21 AM
Use the FM: PC_SPLIT_COMPLETE_FILENAME
The parameter FILE_WITH_EXT will give you what you wanted.
Regards,
Ravi
2009 Apr 24 11:23 AM
2009 Apr 24 11:24 AM
hi ,
try to use the split statement .
example :
data : str type string ,
BEGIN OF t OCCURS 0,
line(10) TYPE c,
END OF t.
str = 'c:/example/example2/hi.txt' .
split str at '/' into TABLE t .
regards
2009 Apr 24 11:25 AM
DATA: str1 TYPE string,
str2 TYPE string,
str3 TYPE string,
itab TYPE TABLE OF string,
text TYPE string.
text = `What a drag it is getting old`.
SPLIT text AT space INTO: str1 str2 str3,
TABLE itab.
Above one is example how to split and store that data in variables or in any internal table.
SPLIT (YOUR FILE PATH) AT '/' INTO ( VAR1 VAR2 VAR3).
Hope this help ful
2009 Apr 24 11:28 AM
hi,
data temp type string,
file type string value 'c:/example/example2/hi.txt'.
temp = file.
revese temp.
search for '/' in temp .
if sy-subrc = 0.
find the index from starting to the index u can store in some other variable.
endif.
hope it will help u.
~linganna
Edited by: katigiri linganna on Apr 24, 2009 12:29 PM