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: 

Need to extract only file name from path.........

Former Member
0 Kudos

Hi All,

I have a parameter.This calls the function

"CALL FUNCTION 'F4_FILENAME' to get the file from C drive.

After selecting the file the path is displayed in the Parameter field.

My problem is I need to extract only file name from the path.Please advice.

Example : Prameter id C:\folder\file.xls

I shd extract only file.xls from the path.Please advice.

2 REPLIES 2

Former Member

Hi,

Use the below logic:

data: begin of itab,

val type char20,

end of itab.

SPLIT l_f_path AT '\' INTO TABLE itab.

The last record of the internal table holds the file name.

describe table itab lines l_f_lines.

read itab index l_f_lines.

l_f_filaname = itab-val.

Hope this helps u.

Former Member
0 Kudos

Hi,

Please find this following article is helpful or not.

http://sap.ittoolbox.com/groups/technical-functional/sap-dev/f4-function-for-directory-902891

Thanks

Koffer

Edited by: Koffer Shen on Dec 25, 2007 9:43 AM