2014 Aug 14 10:28 AM
Hi,
I'm having this program that's supposed to copy files from directories within the application server
into other directories there.
I used the method "copy_files_local" as advised in another thread of the class cl_cts_language_file_io.
The problem is that I'm getting an exception when it uses the 'esp_get_file_attributes' function with sy-subrc=2
meaning it failed to read the file's attributes.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
file_name = im_source_file
dir_name = im_source_directory
IMPORTING
file_size = lv_source_file_size
EXCEPTIONS
read_directory_failed = 1
read_attributes_failed = 2
OTHERS = 3.
I for now just used hard codes for the directories and files addresses as I wanted to see if that method works first.
According to the raised exception I assume it's not the cause of the problem but here's the call method code anyway.
CALL METHOD cl_cts_language_file_io=>copy_files_local
EXPORTING
im_source_file = 'P&G_URI.btw'
im_source_directory = '\sapprdap1_MIG'
im_target_file = 'P&G_URI.btw'
im_target_directory = '\hq-plabels-dev'
im_overwrite_mode = SPACE
EXCEPTIONS
open_input_file_failed = 1
open_output_file_failed = 2
write_block_failed = 3
read_block_failed = 4
close_output_file_failed = 5
others = 6
.
IF sy-subrc = 0.
MESSAGE 'Operation Succeeded' TYPE 'S'.
ELSE.
MESSAGE 'Operation Failed' TYPE 'E'.
ENDIF.
Any ideas?
Thanks in advance,
Daniel.
2014 Aug 14 11:24 AM
Hi,
Did you checked for authorizations for writing into that directory ? You are getting subrc = 2 which says that it is not able to create an output file in that location.
2014 Aug 14 11:27 AM
2014 Aug 14 11:35 AM
As also suggested by Sander, check if the directory has been maintained in tcode AL11. SAP system can only access the directories listed in AL11. So, if it is not there then it has to be added.
2014 Aug 14 11:29 AM
Normally your 'regular' server directory will be something like:
/usr/interface/<SYSID>/
have you checked AL11 that this directory is available?
2014 Aug 14 11:47 AM
Hi Daniel,
Application server Operating system is windows ? If No then directory will start with /sapprdap1_MIG
Thanks & Regards,
Arun
2014 Aug 14 12:01 PM
yes it is windows.
I tried different variations of this, lastly tried this one looking carefully for caption and got sy-subrc=5.
** Addresses are the same as last time, for some reason when I pasted the addresses here it copied them partially.
im_source_file = 'P&G_Uri.btw'
im_source_directory = '\\hq-plabels-dev\Labels\RLabel'
im_target_file = 'P&G_Uri.btw'
im_target_directory = '\\sapprdap1\inventory\MBMM_MIGO'
im_overwrite_mode = SPACE
2014 Aug 14 12:07 PM
Please check for authorizations using the function module AUTHORITY_CHECK_DATASET
for the output directory