Application Development and Automation 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: 
Read only

Directory Existence Check on Application Server

Former Member
0 Likes
7,950

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

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

6 REPLIES 6
Read only

Former Member
0 Likes
2,946

Hi,

check this FM

EPS_GET_DIRECTORY_PATH

regards

vijay

Read only

0 Likes
2,946
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.
Read only

Former Member
0 Likes
2,946

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

Read only

0 Likes
2,946

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

Read only

Former Member
0 Likes
2,946

Use PFL_CHECK_DIRECTORY

Read only

Former Member
0 Likes
2,946

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.