sapdev logo background
sapdev logo sapdev logo
Comments

Get list of files within specific directory or SAP Application server




ABAP code for retrieving list of files contained within specific Application server directory(SAP).

*&---------------------------------------------------------------------*
*& Report  ZDIRFILES                                                   *
*&---------------------------------------------------------------------*
REPORT  ZDIRFILES    .


PARAMETER: p_fdir            type pfeflnamel DEFAULT '/usr/sap/tmp'.

data: begin of it_filedir occurs 10.
        include structure salfldir.
data: end of it_filedir.


************************************************************************
*START-OF-SELECTION
START-OF-SELECTION.
* Get Current Directory Listing for OUT Dir
  call function 'RZL_READ_DIR_LOCAL'
       exporting
            name     = p_fdir
       tables
            file_tbl = it_filedir.

* List of files are contained within table it_filedir
  loop at it_filedir.
    write: / it_filedir-NAME.
  endloop.




comments powered by Disqus