‎2008 Feb 29 4:56 PM
Hi,
Is there any FM/Method that returens the file type (TXT, XLS, DAT ...) for a specific file ?
‎2008 Feb 29 5:35 PM
‎2008 Feb 29 5:35 PM
‎2008 Feb 29 5:37 PM
No,
There is function module which returns the file path,
Cheers,
Chandru
‎2008 Feb 29 7:34 PM
I don't think so...But you can do this...
DATA: FILE TYPE STRING,
EXT(3) TYPE C,
LONG TYPE I.
FILE = 'C:\DOCS\HELLO_WORLD.DOC'.
LONG = STRLEN( FILE ).
LONG = LONG - 3.
EXT = FILE+LONG(3).
WRITE:/ EXT.
You can make a custom FM...
Greetings,
Blag.
‎2008 Feb 29 7:44 PM
Hi,
check FM /SAPSLL/CORE_KPRO_FILE_EXT_GET
REPORT ztest_cha1.
DATA : v_ext TYPE string.
CALL FUNCTION '/SAPSLL/CORE_KPRO_FILE_EXT_GET'
EXPORTING
iv_file_string = 'TEMP1.TXT'
IMPORTING
ev_file_extension = v_ext.
SHIFT v_ext LEFT.
WRITE : v_ext.
‎2008 Feb 29 7:48 PM
also try this'
REPORT ztest_cha1.
DATA: lext(3) TYPE c,
lfile LIKE pcfile-path.
MOVE 'TEMp1.XLS' TO lfile.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = lfile
IMPORTING
extension = lext.
WRITE : lext.
‎2008 Feb 29 7:51 PM
Thanks for all your answers.
Somtimes the file name doesn't contain the the file type (abc.txt or just abc). so the last 4 characters won't contain the file type.
‎2008 Mar 13 9:08 AM
Hi Rotem,
Have you find the answer?
Now i have the same requirement. Can you please share the answer?
...Naddy
‎2008 Mar 13 1:56 PM
‎2008 Mar 13 5:16 PM
Hi Naddy,
I have forced the user to enter a file name with the wanted extension.
I haven't found a way to get the file type without an extension