Skip to Content
avatar image
Former Member

To get files created on aparticular date?

Hi all,

i need to get all the files created on Application server on a particular date (Like today).

Can u suggets any Function module for that?

Regards,

Mohsin

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Nov 07, 2008 at 01:25 PM

    May be u can try the FM EPS_GET_FILE_ATTRIBUTES

    For details check this sample code:

    REPORT ZEXAMPLE.
    
    CONSTANTS DAYS1980     TYPE I VALUE 3652.
    
    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' LOWER CASE.
    
    DPATH = P_PATH.
    
    CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
    
         EXPORTING
    
              DIR_NAME               = DPATH
    
         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.
    
      LOOP AT DLIST.
    
        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
    
             EXCEPTIONS
    
                  READ_DIRECTORY_FAILED  = 1
    
                  READ_ATTRIBUTES_FAILED = 2
    
                  OTHERS                 = 3.
    
        IF SY-SUBRC EQ 0.
    
          FATTR-FILE_NAME = DLIST-NAME.
    
          APPEND FATTR.
    
        ENDIF.
    
      ENDLOOP.
    
      SORT FATTR BY FILE_NAME.
    
      LOOP AT FATTR.
    
        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.
    
        SUBTRACT DAYS1980 FROM MDATE.
    
        WRITE: / FATTR-FILE_NAME,
    
                 FATTR-FILE_SIZE,
    
                 MDATE,
    
                 MTIME.
    
      ENDLOOP.
    
    ENDIF.
    

    Add comment
    10|10000 characters needed characters exceeded