Skip to Content
author's profile photo Former Member
Former Member

How to Get File attributes of an application server files

Hi All,

I need to get the files from Application Server. If the date range and path is given on the selection screen, based on that i need to get files from the application server file. Can anybody help me? Is there any SAP Function module?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2006 at 05:34 AM

    Hai Suresh,

    just check this link....

    list-of-files-in-application-server

    Regards,

    Srikanth.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2006 at 06:30 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2006 at 06:37 AM

    hi,

    Try this FM EPS_GET_FILE_ATTRIBUTES.

    hope this helps,

    priya.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2006 at 06:37 AM

    Hi,

    You can create an F4 help for application server:

    is-f4-help-possible-for-application-server

    Also chek this link:

    how-to-search-for-a-file-at-application-server

    Hope it helps you.

    Regards,

    Anjali

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2006 at 07:06 AM

    HI,

    Refer this thread:

    get-file-file-attributes

    Regards,

    Gayathri

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2006 at 07:22 AM

    Hi suresh,

    1. u can try this program (just copy paste)

    2. It will give on selection screen.

    a) Path

    b) Date

    and it will list out all the related file.

    3.

    REPORT abc.

    *----


    • DATA

    *----


    TYPES: name_of_dir(1024) TYPE c,

    name_of_file(260) TYPE c,

    name_of_path(1285) TYPE c.

    DATA: BEGIN OF file,

    dirname TYPE name_of_dir, " name of directory. (possibly

    " truncated.)

    name TYPE name_of_file, " name of entry. (possibly

    " truncated.)

    type(10) TYPE c, " type of entry.

    len(8) TYPE p, " length in bytes.

    owner(8) TYPE c, " owner of the entry.

    mtime(6) TYPE p, " last modification date, seconds since 1970

    mode(9) TYPE c, " like "rwx-r-x--x": protection mode.

    useable(1) TYPE c,

    subrc(4) TYPE c,

    errno(3) TYPE c,

    errmsg(40) TYPE c,

    mod_date TYPE d,

    mod_time(8) TYPE c, " hh:mm:ss

    seen(1) TYPE c,

    changed(1) TYPE c,

    END OF file.

    DATA : allfile LIKE file OCCURS 0 WITH HEADER LINE.

    *----


    • SELECTION SCREEN

    *----


    PARAMETERS : path(260) TYPE c DEFAULT '/usr/sap/trans' LOWER CASE.

    PARAMETERS : mydate TYPE sy-datum DEFAULT sy-datum.

    *----


    • START OF SELECTION

    *----


    START-OF-SELECTION.

    PERFORM getallfiles USING path.

    BREAK-POINT.

    *----


    show date files

    WRITE :/ '----


    FILES OF DATE ' , mydate.

    LOOP AT allfile WHERE mod_date = mydate.

    IF allfile-type CS 'file'.

    WRITE :/ allfile-name.

    ENDIF.

    ENDLOOP.

    *----


    show all files

    SKIP.

    SKIP.

    WRITE :/ '----


    ALL FILES & DIRECTORIES'.

    LOOP AT allfile .

    WRITE :/ allfile-name .

    ENDLOOP.

    *----


    • FORM

    *----


    FORM getallfiles USING mypath .

    REFRESH allfile.

    CLEAR allfile.

    CALL 'C_DIR_READ_FINISH' " just to be sure

    ID 'ERRNO' FIELD file-errno

    ID 'ERRMSG' FIELD file-errmsg.

    CALL 'C_DIR_READ_START' ID 'DIR' FIELD mypath

    • ID 'FILE' FIELD a_generic_name

    ID 'ERRNO' FIELD file-errno

    ID 'ERRMSG' FIELD file-errmsg.

    DO.

    CLEAR file.

    CALL 'C_DIR_READ_NEXT'

    ID 'TYPE' FIELD file-type

    ID 'NAME' FIELD file-name

    ID 'LEN' FIELD file-len

    ID 'OWNER' FIELD file-owner

    ID 'MTIME' FIELD file-mtime

    ID 'MODE' FIELD file-mode

    ID 'ERRNO' FIELD file-errno

    ID 'ERRMSG' FIELD file-errmsg.

    IF sy-subrc = 1.

    EXIT.

    ENDIF.

    PERFORM p6_to_date_time_tz(rstr0400) USING file-mtime

    file-mod_time

    file-mod_date.

    allfile = file.

    APPEND allfile.

    ENDDO.

    ENDFORM. "GETALLFILES

    *----


    • FORM

    *----


    FORM p6_to_date_time_tz USING gmtime

    asc_time

    asc_date.

    DATA: opcode TYPE x,

    unique, not_found,

    timestamp TYPE i,

    date TYPE d,

    time TYPE t,

    tz LIKE sy-zonlo,

    timestring(10),

    abapstamp(14),

    abaptstamp TYPE timestamp.

    timestamp = gmtime.

    IF sy-zonlo = space.

    • Der Benutzer hat keine Zeitzone gepflegt: nehme lokale des App. Srv.

    CALL FUNCTION 'TZON_GET_OS_TIMEZONE'

    IMPORTING

    ef_timezone = tz

    ef_not_unique = unique

    ef_not_found = not_found.

    IF unique = 'X' OR not_found = 'X'. .

    tz = sy-tzone.

    CONCATENATE 'UTC+' tz INTO tz.

    ENDIF.

    ELSE.

    tz = sy-zonlo.

    ENDIF.

    • wandle den Timestamp in ABAP Format um und lass den ABAP konvertieren

    opcode = 3.

    CALL 'RstrDateConv'

    ID 'OPCODE' FIELD opcode

    ID 'TIMESTAMP' FIELD timestamp

    ID 'ABAPSTAMP' FIELD abapstamp.

    abaptstamp = abapstamp.

    CONVERT TIME STAMP abaptstamp TIME ZONE tz INTO DATE date

    TIME time.

    IF sy-subrc <> 0.

    date = abapstamp(8).

    time = abapstamp+8.

    ENDIF.

    WRITE: time(2) TO timestring(2),

    ':' TO timestring+2(1),

    time2(2) TO timestring3(2),

    ':' TO timestring+5(1),

    time4(2) TO timestring6(2).

    MOVE timestring TO asc_time.

    MOVE date TO asc_date.

    ENDFORM. "P6_TO_DATE_TIME_TZ

    *

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 23, 2020 at 11:20 AM
    DATA: DLIST LIKE EPSFILI OCCURS 0 WITH HEADER LINE, 
           DPATH LIKE EPSF-EPSDIRNAM, 
           MDATE LIKE SY-DATUM, 
           MTIME LIKE SY-UZEIT, 
           POINT_IN_TIME TYPE I.
    DATA:BEGIN OF FATTR OCCURS 0, 
          FILE_NAME LIKE EPSF-EPSFILNAM, 
          FILE_SIZE LIKE EPSF-EPSFILSIZ, 
          FILE_OWNER LIKE EPSF-EPSFILOWN, 
          FILE_MODE LIKE EPSF-EPSFILMOD, 
          FILE_TYPE LIKE EPSF-EPSFILTYP, 
          FILE_MTIME(12),
         END OF FATTR.
    
    PARAMETER P_PATH(50) TYPE C DEFAULT '/TMP' LOWERCASE.
    DPATH = P_PATH.
    
    CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
    EXPORTING
      DIR_NAME = DPATH   "/tmp
    TABLES
      DIR_LIST = DLIST
    EXCEPTIONS
      INVALID_EPS_SUBDIR =1
      SAPGPARAM_FAILED =2
      BUILD_DIRECTORY_FAILED =3
      NO_AUTHORIZATION =4
      READ_DIRECTORY_FAILED =5
      TOO_MANY_READ_ERRORS =6
      EMPTY_DIRECTORY_LIST =7
    OTHERS=8.
    IF SY-SUBRC EQ 0.
    CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
    EXPORTING
      FILE_NAME = DLIST-NAME
      DIR_NAME = DPATH IMPORTING
      FILE_SIZE = FATTR-FILE_SIZE
      FILE_OWNER = FATTR-FILE_OWNER
      FILE_MODE = FATTR-FILE_MODE
      FILE_TYPE = FATTR-FILE_TYPE 
      FILE_MTIME = FATTR-FILE_MTIME.
    ENDIF.
    *for creation date & time of above application server file
     POINT_IN_TIME = FATTR-FILE_MTIME.
    
     CALL FUNCTION 'POINT_IN_TIME_CONVERT'
      EXPORTING
      POINT_IN_TIME = POINT_IN_TIME
      IMPORTING
      DATE = MDATE
      TIME = MTIME
      EXCEPTIONS OTHERS = 1. 
    *While testing the above FM in SE37.The exact file name or directory name as present in AL11 
    *(Case sensitive) should be given input to FM in debugging mode. Otherwise we get 
    * READ_DIRECTORY_FAILED error..
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.