Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Directory Existence Check on Application Server

former_member927251
Active Contributor
0 Kudos

Is there any function module to check whether a given directory exists on Application Server or not.

6 REPLIES 6

former_member188685
Active Contributor
0 Kudos

Hi,

check this FM

EPS_GET_DIRECTORY_PATH

regards

vijay

0 Kudos
CALL FUNCTION 'EPS_GET_DIRECTORY_PATH'
* EXPORTING
*   EPS_SUBDIR                   = 'log'
   DIR_NAME                     = 'DIR_TMP'
* IMPORTING
*   DIR_NAME                     =
 EXCEPTIONS 
  INVALID_EPS_SUBDIR           = 1
  SAPGPARAM_FAILED             = 2
  BUILD_DIRECTORY_FAILED       = 3
   OTHERS                       = 4
          .
if sy-subrc <> 0.
"the directory not present.
endif.

former_member927251
Active Contributor
0 Kudos

Hi Vijay,

How should I use the parameter EPS_SUBDIR in the function module. If I don't pass it then it gives error for the valid directory too.

Thanks in advance

0 Kudos

This works pretty good for me.



REPORT ZRICH_0001 .

type-pools: abap.

data: path type string.
data: result type abap_bool.


path = '\<host>usrsapTSTSYS'.


CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
  EXPORTING
    DIRECTORY            = path
  RECEIVING
    RESULT               = result
  EXCEPTIONS
    CNTL_ERROR           = 1
    ERROR_NO_GUI         = 2
    WRONG_PARAMETER      = 3
    NOT_SUPPORTED_BY_GUI = 4
    others               = 5.

if result = 'X'.
  Write:/ 'Directory Exists'.
else.
  Write:/ 'Directory not found'.
endif.

Regards,

Rich Heilman

Former Member
0 Kudos

Use PFL_CHECK_DIRECTORY

former_member927251
Active Contributor
0 Kudos

Hi All,

I have found out one function module RZL_READ_DIR_LOCAL which works fine to check the existence of the directory on the application server.

Thanks a lot to all of you who have replied to the query.