‎2007 May 22 11:01 AM
Is there an existing function module that will retrieve file attributes such as file size, date modified, file type, etc.?
Thank you very much in advance.
‎2007 May 22 11:09 AM
hi,
chk this
REPORT zzzz66 .
TABLES epsf.
PARAMETERS dir LIKE epsf-epsdirnam DEFAULT '/home/user1/'.
PARAMETERS file LIKE epsf-epsfilnam DEFAULT 'file001.dat'.
DATA mtime TYPE p DECIMALS 0.
DATA time(10).
DATA date LIKE sy-datum.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = file
dir_name = dir
IMPORTING
file_size = epsf-epsfilsiz
file_owner = epsf-epsfilown
file_mode = epsf-epsfilmod
file_type = epsf-epsfiltyp
file_mtime = mtime
EXCEPTIONS
read_directory_failed = 1
read_attributes_failed = 2
OTHERS = 3.
*The subroutine p6_to_date_time_tz is sap std present in rstr0400.
PERFORM p6_to_date_time_tz(rstr0400) USING mtime
time
date.
WRITE: / mtime,
/ date, time.Rgds
Reshma
‎2007 May 24 1:13 PM
Thank you very much Reshma.
I would just like to ask if my file is located at my local drive (e.g.'C:'), can I get its file attributes? I executed the codes you posted but I failed to retrieve its attributes. How can I correct it? Million thanks Reshma.
*--- code
REPORT ZZZZ66 .
TABLES EPSF.
PARAMETERS DIR LIKE EPSF-EPSDIRNAM DEFAULT 'C:'.
PARAMETERS FILE LIKE EPSF-EPSFILNAM DEFAULT 'textfile.txt'.
DATA MTIME TYPE P DECIMALS 0.
DATA TIME(10).
DATA DATE LIKE SY-DATUM.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
FILE_NAME = FILE
DIR_NAME = DIR
IMPORTING
FILE_SIZE = EPSF-EPSFILSIZ
FILE_OWNER = EPSF-EPSFILOWN
FILE_MODE = EPSF-EPSFILMOD
FILE_TYPE = EPSF-EPSFILTYP
FILE_MTIME = MTIME
EXCEPTIONS
READ_DIRECTORY_FAILED = 1
READ_ATTRIBUTES_FAILED = 2
OTHERS = 3.
*The subroutine p6_to_date_time_tz is sap std present in rstr0400.
PERFORM P6_TO_DATE_TIME_TZ(RSTR0400) USING MTIME
TIME
DATE.
WRITE: / MTIME,
/ DATE, TIME.
‎2007 May 24 1:53 PM
Hello,
I think this code works with file on your application server, not on your local disk
You have first to upload it.