‎2008 Oct 15 1:08 PM
Hello,
is there any class or FM that allow to get file extension?
Thanks.
‎2008 Oct 15 1:26 PM
‎2008 Oct 15 1:10 PM
Hi
I think u can use SPILT AT '.' in file name variable to get file extension.
FM not required.
With Regards,
Dwaraka.S
‎2008 Oct 15 1:12 PM
Hi,
No sush FM as per my search.
One suggestion is, get the file name in a variable,
then split it into two.
example:
DATA: str1 TYPE string,
str2 TYPE string,
str3 TYPE string,
itab TYPE TABLE OF string,
text TYPE string.
text = `What a drag it is getting old`.
SPLIT text AT space INTO: str1 str2 str3,
TABLE itab.
‎2008 Oct 15 1:13 PM
Hi,
You can do it with a small code.
Once you get the file name get the string length. From the string lenth get the last three letter of the file name it will give you your extenstion.
Example : W_fnam(100) type c value 'D:\test.txt',
w_strlen type i,
w_ext(3) type c.
w_strlen = strlen (w_fnam).
w_strlen = w_strlen - 3.
w_ext = w_strlen+0(3).
write: w_ext.
The output is TXT.
Regards,
Pramod
‎2008 Oct 15 1:13 PM
May be the folder has a '.' in its name. I thinks that this solution doesn´t work in my system.
‎2008 Oct 15 1:15 PM
Hi
Use the FM
SODIS_GET_FILE_EXTENSION
Give the eniter fielname as the input eg; SAMPLE.DAT then the output will be .DAT
regards
Pavan
‎2008 Oct 15 1:26 PM