‎2016 Jan 06 10:00 AM
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
‎2016 Jan 13 10:54 AM
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.
‎2016 Jan 06 11:07 AM
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!!
‎2016 Jan 06 11:30 AM
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.
‎2016 Jan 06 11:55 AM
Has the file copy completed before you attempt to delete the file ?
‎2016 Jan 06 12:00 PM
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.
‎2016 Jan 06 12:09 PM
I think you need to check the variable which holds the file name.
‎2016 Jan 06 12:14 PM
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.
‎2016 Jan 06 12:15 PM
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.
‎2016 Jan 13 10:00 AM
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.
‎2016 Jan 13 10:54 AM
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.