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

CL_GUI_FRONTEND_SERVICES

Former Member
0 Likes
1,508

Hi experts,

I am new to OO concept in ABAP.Can any body give the example code for using the following method?

CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

Suppose i have 2 XML files in a directory 'dir' in C drive.

Thanks in Advance.

Hi experts,

I am new to OO concept in ABAP.Can any body give the example code for using the following method?

CL_GUI_FRONTEND_SERVICES=>DIRECTORY_LIST_FILES

Suppose i have 2 XML files in a directory 'dir' in C drive.

Thanks in Advance.

6 REPLIES 6
Read only

andreas_mann3
Active Contributor
0 Likes
987

hi,

look here:

A.

Read only

0 Likes
987
data: ifile type table of string.
data: xfile type string.
data: xcount type i.
 
 
call method cl_gui_frontend_services=>directory_list_files
  exporting
    directory                   = 'C:'
*    FILTER                      = '*.*'
     FILES_ONLY                  = 'X'
*    DIRECTORIES_ONLY            =
  changing
    file_table                  = ifile
    count                       = xcount
  exceptions
    cntl_error                  = 1
    directory_list_files_failed = 2
    wrong_parameter             = 3
    error_no_gui                = 4
    others                      = 5.
 
 
loop at ifile into xfile.
  write:/ xfile.
endloop.
Read only

0 Likes
987

Hi all,

Thanks .In This Method, in the exporting parameter directory can we give a path from a different server that means other than R/3 server? If so How can we give that?

Regards

Read only

Former Member
0 Likes
987

Hi!!

it would be like this other case, you can use partner button to build it, first you put the class and after in the next screen th method.

regards

CALL METHOD cl_gui_frontend_services=>directory_exist

EXPORTING

directory = ruta_aux3

RECEIVING

result = lf_subrc

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

wrong_parameter = 3

not_supported_by_gui = 4

OTHERS = 5.

Read only

Former Member
0 Likes
987

hi ravi,

check these threads...

hope this helps,

do reward if it helps,

priya.

Read only

Former Member
0 Likes
987

Hi Ravi,

Do this way ...

CALL METHOD cl_gui_frontend_services=>DIRECTORY_LIST_FILES
    EXPORTING  directory        = file_path
               filter           = 'image*'
               files_only       = 'X'
               directories_only = SPACE
    CHANGING   file_table       = files
               count            = rc
    EXCEPTIONS OTHERS           = 1.

Check this Link for reference..

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/sdn-misc/word%20te...

Regards,

Santosh