2009 Mar 27 3:41 PM
Hi guys , i´m using method cl guifrontend_services=>file_open_dialog to search any file in my hard disc, with that ,I get the whole path, however I only want the name of the file , eg.
G:MusicGuns N' RosesG N' R Liespatience.mp3 i only want "patience " any ideas. thank you .
2009 Mar 27 3:54 PM
Try
DATA: BEGIN OF itab1 OCCURS 0,
word(40),
END OF itab1,
l_lines TYPE i.
SPLIT file_name AT '\' INTO TABLE itab1.
DESCRIBE itab1 LINES l_lines.
READ TABLE itab1 INDEX l_lines.
This will put each bit of text between the '/' into a separate line in table itab1. If you read the last line, you'll get the last bit of the text which is your file name.
2009 Mar 27 3:45 PM
Hi,
Please search in SDN forums with the keyword "split file name", I am sure you will get lot of threads which already discuss about this.
Thanks
Naren
2009 Mar 27 3:51 PM
2009 Mar 27 3:54 PM
Try
DATA: BEGIN OF itab1 OCCURS 0,
word(40),
END OF itab1,
l_lines TYPE i.
SPLIT file_name AT '\' INTO TABLE itab1.
DESCRIBE itab1 LINES l_lines.
READ TABLE itab1 INDEX l_lines.
This will put each bit of text between the '/' into a separate line in table itab1. If you read the last line, you'll get the last bit of the text which is your file name.
2009 Mar 27 3:55 PM
Hi,
Please Don't Use All Caps in subject next time
Use FMs: SO_SPLIT_FILE_AND_PATH or SPLIT_FILENAME these will solve out your problem,
Best Regards,
Faisal