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: 

how to get the filename only

Former Member
0 Kudos

hello friends,

I am currently using the function module WS_FILENAME_GET for the user to select the file.

now what this function module return is the complete path, now i want only the filename and not the whole path, also the user will be choosing files from different folders and drives all the time so the path is not pre defined .

can any1 help me in getting only the filename from the whole path ?????

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos

hi Amit,

I am not sure if I fully understand, what do you want, but you can:

SPLIT path INTO itab AT '/'.

this splits the path into an internal table, now the name of the file will be in the last line of the internal table.

hope this helps

ec

3 REPLIES 3

Former Member
0 Kudos

hi ,

here is a chance to give the filename separately ,

and path separately check this example,

AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

DEF_FILENAME = 'test.txt'

DEF_PATH = 'C:\MSOFFICE\EXCEL\EXAMPLES'

MASK = ',.,..'

MODE = 'O'

TITLE = TEXT-F4F

IMPORTING

FILENAME = FILE

EXCEPTIONS

INV_WINSYS = 01

NO_BATCH = 02

SELECTION_CANCEL = 03

SELECTION_ERROR = 04.

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

reward points if useful,

venkat.

JozsefSzikszai
Active Contributor
0 Kudos

hi Amit,

I am not sure if I fully understand, what do you want, but you can:

SPLIT path INTO itab AT '/'.

this splits the path into an internal table, now the name of the file will be in the last line of the internal table.

hope this helps

ec

Former Member
0 Kudos

Use function module:

PC_SPLIT_COMPLETE_FILENAME