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 error

Former Member
0 Likes
4,277

Hi Experts,

Scenario:

i have provided interface to user where all pdf files from desktop directory are listed in ALV.

clicking on any desired file that file is opened in SAP container.

then user clicks on move file button which moves that file from one desktop directory to another as maintained.

i am using following methods in sequence to check file existence, then copy to destination and then delete from source.

FILE_EXIST

FILE_COPY

FILE_DELETE

I am facing issues with following methods of class CL_GUI_FRONTEND_SERVICES

FILE_COPY

FILE_DELETE

Only in fewer cases ( 1 or 2 out of 100 files ), file is not moved as either of above mentioned methods give exception as "Access Denied".

Not able to find exact reason for above behavior.

Kindly guide through this

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,745

Hello friends,

Issue is resolved, so closing this thread.

Few files which were facing error for FILE_COPY and FILE_DELETE with "Access Denied" exception.

All those files have "Read-Only" ticked in their properties.

So, as read-only property is removed files are moving correctly.

Thanks to all for your time and suggestions.

9 REPLIES 9
Read only

Chintu6august
Contributor
0 Likes
2,745

Hi,

FILE_COPY

ACCESS_DENIED thrown  If either the source file cannot be accessed for reading or the new file cannot be created in the specified directory.


FILE_DELETE

ACCESS_DENIED thrown if the account with which the user is logged on to the PC has not the permissions required to delete the file.

thanks!!

Read only

0 Likes
2,745

Thanks for your reply

But user has full authorization and permission to read write copy and delete file.

because all files are moved successfully except 1 or 2 files only.

Read only

0 Likes
2,745

Has the file copy completed before you attempt to delete the file ?

Read only

Former Member
0 Likes
2,745

yes file is copied completely.

in such cases where delete is failed, i have two copies of that file one in source and second in destination.

Read only

0 Likes
2,745

I think you need to check the variable which holds the file name.

Read only

0 Likes
2,745

These methods have importing parameter as STRING

so i am using the same for variable which holds file path.

any other aspect which can be checked for that variable.

Read only

0 Likes
2,745

it's not about length it's about the variable holds the file name or not where it's giving exception of ACCESS DENIED while deleting.

Read only

former_member241258
Active Participant
0 Likes
2,745

HI,

try.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_COPY
   EXPORTING
     SOURCE               = 'C:\Documents and Settings\krishnamurthy\Desktop\ticket.pdf'
     DESTINATION          = 'C:\Documents and Settings\krishnamurthy\Desktop\Invoice Process\ticket5.pdf'
   EXCEPTIONS
     CNTL_ERROR           = 1
     ERROR_NO_GUI         = 2
     WRONG_PARAMETER      = 3
     DISK_FULL            = 4
     ACCESS_DENIED        = 5
     FILE_NOT_FOUND       = 6
     DESTINATION_EXISTS   = 7
     UNKNOWN_ERROR        = 8
     PATH_NOT_FOUND       = 9
     DISK_WRITE_PROTECT   = 10
     DRIVE_NOT_READY      = 11
     NOT_SUPPORTED_BY_GUI = 12
     OTHERS               = 13.

Read only

Former Member
0 Likes
2,746

Hello friends,

Issue is resolved, so closing this thread.

Few files which were facing error for FILE_COPY and FILE_DELETE with "Access Denied" exception.

All those files have "Read-Only" ticked in their properties.

So, as read-only property is removed files are moving correctly.

Thanks to all for your time and suggestions.