Friday, October 18, 2013

SAP Abap how to delete a directory from the presentation server (front end)




Hi folks,

here a little program to remove e directory on the presentation server.
Enjoy!

REPORT ZDIR.

parameters: p_dir type rlgrap-filename .

at selection-screen on value-request for p_dir .

  CALL FUNCTION 'F4_FILENAME'
  EXPORTING
   PROGRAM_NAME = SYST-CPROG
   DYNPRO_NUMBER = SYST-DYNNR
   FIELD_NAME = 'P_DIR'
  IMPORTING
   FILE_NAME = p_dir
.
start-of-selection .

  CALL FUNCTION 'GUI_REMOVE_DIRECTORY'
   EXPORTING
   DIRNAME = p_dir
  EXCEPTIONS
   FAILED = 1
   OTHERS = 2.

if sy-subrc eq 0.
  write:/ 'directory: ' , p_dir , ' removed.'.
endif.