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: 

what does the function module split_filename do?

Former Member
0 Kudos

what does the function module split_filename do?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

It splits the file name Loke,

full Name = 'C:\TEMP\TMP\TEST.XLS'

Path shell be 'C:\TEMP\TMP'

File shell be 'TEST.XLS'.

Sample code :

PARAMETERS: FULLNAME TYPE RLGRAP-FILENAME .

DATA: STRIPPED TYPE RLGRAP-FILENAME.

DATA: FILE_PATH TYPE RLGRAP-FILENAME.

CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

EXPORTING

FULL_NAME = FULLNAME

IMPORTING

STRIPPED_NAME = STRIPPED

FILE_PATH = FILE_PATH

  • EXCEPTIONS

  • X_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Thanks,

Reward If Helpful.

7 REPLIES 7

Former Member
0 Kudos

Hi,

It splits the file name Loke,

full Name = 'C:\TEMP\TMP\TEST.XLS'

Path shell be 'C:\TEMP\TMP'

File shell be 'TEST.XLS'.

Sample code :

PARAMETERS: FULLNAME TYPE RLGRAP-FILENAME .

DATA: STRIPPED TYPE RLGRAP-FILENAME.

DATA: FILE_PATH TYPE RLGRAP-FILENAME.

CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

EXPORTING

FULL_NAME = FULLNAME

IMPORTING

STRIPPED_NAME = STRIPPED

FILE_PATH = FILE_PATH

  • EXCEPTIONS

  • X_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Thanks,

Reward If Helpful.

0 Kudos

Hi,

It splits the file name with extension AND the Path.

If Filename is <b>C:\documents and settings\folder\filename.txt</b>

CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

EXPORTING

FULL_NAME = "Your Entire Filename of Type FULL_NAME"

IMPORTING

STRIPPED_NAME = "Your FileName" "i.e.Filename.txt

FILE_PATH = "Your File Path" "C:\documents and settings\folder

  • EXCEPTIONS

  • X_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

Former Member
0 Kudos

This FM splits the Filename and extension

say your filename is TEST.TXT, output will be

TEST

TXT

Message was edited by:

Chandrasekhar Jagarlamudi

Former Member
0 Kudos

Hi,

This FM splits the file name and its extension.

example:

/oracle/BCE/saptrace/background/alert_BCE.log

It will return

PURE_FILENAME: alert_BCE

PURE_EXTENSION:log

Regards,

Vinodh

Former Member
0 Kudos

The function module splits the complete filename into filename and extension.

Former Member
0 Kudos

HI THERE,

THIS MIGHT GIVE YOU A BETTER IDEA

PUT THE FILE NAME IN THE SCREEN C:\Documents and Settings\arehman\Desktop\New Folder

REPORT ZAS_FILENAME.

PARAMETERS: FULLNAME TYPE RLGRAP-FILENAME .

*DATA: STRIPPED TYPE RLGRAP-FILENAME.

*DATA: FILE_PATH TYPE RLGRAP-FILENAME.

DATA: STRIPPED TYPE STRING.

DATA: FILE_PATH TYPE STRING.

CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'

EXPORTING

FULL_NAME = FULLNAME

IMPORTING

STRIPPED_NAME = STRIPPED

FILE_PATH = FILE_PATH

  • EXCEPTIONS

  • X_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

write:/'FILENAME', STRIPPED,/'FILE_PATH', FILE_PATH.

HOPE THE MIGHT HELP

ANUJ

Former Member
0 Kudos

Hi Sai,

For simpler understanding.

go to SE37, Enter SO_SPLIT_FILE_AND_PATH and execute.

In next screen, give any file name and path in your system eg \Documents and Settings\USR\Desktop\test.txt ...

and execute.

you can see results for yourself.

you can also test other simple funtional modules for yourself like simlar way.

Award me. If helpful.

Regards

Venkat