Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ANY IDEA TO GET THE NAME OF THE FILE

Former Member
0 Kudos
111

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 .

1 ACCEPTED SOLUTION

Former Member
0 Kudos
85

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.

4 REPLIES 4

Former Member
0 Kudos
85

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

former_member156446
Active Contributor
0 Kudos
85

Former Member
0 Kudos
86

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.

faisal_altaf2
Active Contributor
0 Kudos
85

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