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

Problems with class CL_GUI_FRONTEND_SERVICES

Former Member
0 Likes
845

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.

1 ACCEPTED SOLUTION
Read only

LucianoBentiveg
Active Contributor
0 Likes
549

Becose that class is for presentation server. You can't use it with application server.

Try FM F4_DXFILENAME_TOPRECURSION, may be helps.

Regards.

2 REPLIES 2
Read only

LucianoBentiveg
Active Contributor
0 Likes
550

Becose that class is for presentation server. You can't use it with application server.

Try FM F4_DXFILENAME_TOPRECURSION, may be helps.

Regards.

Read only

0 Likes
549

@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 .