‎2006 Aug 02 1:29 PM
Hi.
I already searched for a solution in the forum, but haven't found anything yet.
I use the method to check if a directory exists and the one to list the files. The user can specify the directory on the Appl.-Server via SELECTION-SCREEN. First the code:
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
EXPORTING
DIRECTORY = l_unixpath
RECEIVING
RESULT = l_count_unixdir
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES
EXPORTING
DIRECTORY = l_unixpath
CHANGING
file_table = l_itab_unixdir
count = helpvar
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
WRONG_PARAMETER = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5.
IF l_count_unixdir = 'X'.
WRITE: / 'Directory Exists'.
READ TABLE l_itab_unixdir INDEX 1 INTO l_unixdir.
WRITE:/ helpvar.
WRITE:/ l_unixdir.
WRITE
ELSE.
WRITE:/ 'Directory not found'.
ENDIF.Now my problem:
l_unixpath is '/', the result is: Directory exists, but helpvar is 0, l_itab_unixdir is empty;
l_unixpath is '/usr/sap/', the result is: Directory not found <b>(but the directory exists!)</b>;
l_unixpath is 'c:/', the result is: Directory exists, helpvar is 47, l_unixdir is "Documents and Settings".
Why it's working with the Windows-Path but not with Unix? Thanks for your answers.
‎2006 Aug 02 1:32 PM
Becose that class is for presentation server. You can't use it with application server.
Try FM F4_DXFILENAME_TOPRECURSION, may be helps.
Regards.
‎2006 Aug 02 1:32 PM
Becose that class is for presentation server. You can't use it with application server.
Try FM F4_DXFILENAME_TOPRECURSION, may be helps.
Regards.
‎2016 Mar 11 10:05 AM
@Luciano bentivegna
thank you for your answer.
i am trying
"CL_GUI_FRONTEND_SERVICES "
for application layer .
so when ever i an checking the method "DIRECTORY_EXIST" even tho directory exist also the result value is space .