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: 

cl_gui_frontend_services=>directory_delete

0 Kudos

Hi experts,

I am using this class to delete a directory on the local client pc. I have access to read/write in the folder and I am prompted if I want to give SAP GUI access to delete the directory. When I click yes, I get the exception 'Unknown Error'.

Any ideas?

Thanks,

Martin

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Martin,

The following sample code should work. Please let me know in case of any issues.

DATA: oref TYPE REF TO cl_gui_frontend_services.

DATA: directory TYPE string, retcode   TYPE i.

START-OF-SELECTION.

   CREATE OBJECT oref.

   oref->directory_browse( CHANGING selected_folder = directory ).

   oref->directory_delete( EXPORTING directory = directory

                                      CHANGING rc           = retcode ).


Thanks

RM

3 REPLIES 3

Former Member
0 Kudos

Hi Martin,

The following sample code should work. Please let me know in case of any issues.

DATA: oref TYPE REF TO cl_gui_frontend_services.

DATA: directory TYPE string, retcode   TYPE i.

START-OF-SELECTION.

   CREATE OBJECT oref.

   oref->directory_browse( CHANGING selected_folder = directory ).

   oref->directory_delete( EXPORTING directory = directory

                                      CHANGING rc           = retcode ).


Thanks

RM

Sandra_Rossi
Active Contributor
0 Kudos

Not authorized? Try with other directories. I have the same kind of issue, and I came to the conclusion that some directories have different Windows owners. I can access them from Windows, but not from the SAP GUI. I also had the surprise that the same directory can be accessed using 2 paths (as we can see in Windows), and only one of them can be accessed from the SAP GUI. Moreover, if you use Citrix or softwares like that, it may be different.

I found out, that the issue is due to the folder not being empty. I have deleted the files in the folder before folder deletion, and then it works just fine.

Thanks,

Martin