Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

 
REPORT  zdemo.
CONSTANTS days1980     TYPE i VALUE 3652.
DATA: linelength TYPE i VALUE 0.
DATA: linelength1 TYPE i VALUE 0.
DATA: text TYPE string.

DATA: dlist    LIKE epsfili OCCURS 0 WITH HEADER LINE,
      dpath    LIKE epsf-epsdirnam,
      pfile    LIKE epsf-epsfilnam,
      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.
PARAMETER p_file(50) TYPE c DEFAULT ' '  LOWER CASE.
dpath = p_path.
pfile = p_file.

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.
    linelength = STRLEN( dlist-name ).
    linelength = linelength - 3.
    linelength1 = STRLEN( p_file ).
    linelength1 = linelength1 - 3.

    IF dlist-name+linelength(3) = p_file+linelength1(3).
      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.
    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.

  • No labels