‎2007 May 17 6:11 PM
I need to extract the file type from the name of a file. For example:
C:\dir\files\filename.txt
extension = txt
D:\filedir\morefiles\filename.html
extension = html
What is the best way to do this?
‎2007 May 17 6:18 PM
Hi,
You can use the function module CH_SPLIT_FILENAME
Give the file name as input.
It will split and get you the extension..
Thanks,
Naren
‎2007 May 17 6:13 PM
HI
FIND statement
DATA:
c TYPE STRING,
p(1) TYPE C,
off TYPE I,
len type i,
ext type string.
c = 'C:\filename.txt'.
p = '.'.
FIND p IN c MATCH OFFSET off.
len = off + 1.
ext = c+len.
write ext.
OR
DATA: C LIKE SDBAH-ACTID,
EXT LIKE SDBAD-FUNCT.
CALL FUNCTION 'SPLIT_FILENAME'
EXPORTING
long_filename = 'C:\FILENAME.TXT'
IMPORTING
PURE_FILENAME = C
PURE_EXTENSION = EXT
.
WRITE: C, EXT.
Regards
SAB
‎2007 May 17 6:18 PM
Hi,
You can use the function module CH_SPLIT_FILENAME
Give the file name as input.
It will split and get you the extension..
Thanks,
Naren
‎2007 May 17 6:21 PM
try this one
SO_SPLIT_FILE_AND_PATH
gives u the path and the filename
Regards