Sunday, May 11, 2008

SAP ABAP Function Module to Read Files and Directories from the Presentation Server

SAP ABAP Function Module to Read Files and Directories from the Presentation Server

The following function module reads files and directories from the presentation server and stores it in the internal table. This fucntion module can be used to read all the files and directories from the entered directory.

TMP_GUI_DIRECTORY_LIST_FILES

Please find a program that shows the parameters that need to be passed to this function module.

REPORT ZEX_GETDIRFROMPRE .


Parameters: p_dir(100) type c.

Data: d_filecount type i,
      d_dircount type i,
      int_filetab like SDOKPATH occurs 0 with header line,
      int_dirtable like SDOKPATH occurs 0 with header line.

CALL FUNCTION 'TMP_GUI_DIRECTORY_LIST_FILES'
  EXPORTING
    DIRECTORY        = p_dir
   FILTER            = '*.*'
 IMPORTING
   FILE_COUNT        = d_filecount
   DIR_COUNT         = d_dircount
  TABLES
    FILE_TABLE       = int_filetab
    DIR_TABLE        = int_dirtable
 EXCEPTIONS
   CNTL_ERROR       = 1
   OTHERS           = 2
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


1 comment: