‎2010 Mar 24 2:05 PM
Hello ,
I use the command OPEN DATA SET in order to upload file content from server ,
the problem is that i getting error :_No such file or directory ._
the file is exist in server I can see it when i put the path on windows start->run
and i give the permission for the folder to everyone .
1. My question is what i miss here
2. when i do little test and try to use GUI_UPLOAD i see the file content so i don't understand what is wrong here the file is not on my local PC
Regards
James
‎2010 Mar 24 2:13 PM
Hello,
What do you mean by server? Which server is it? Check whether the file is available in the application server through the transaction AL11. Only then will OPEN DATASET will work.
Vikranth
‎2010 Mar 24 2:13 PM
Hello,
What do you mean by server? Which server is it? Check whether the file is available in the application server through the transaction AL11. Only then will OPEN DATASET will work.
Vikranth
‎2010 Mar 24 2:19 PM
HI Vikranth ,
The file is not exist in AL11 ,it's exist on my colleague server
why do we have to use AL11 ,what is it ?
Regards
James
‎2010 Mar 24 2:33 PM
Hello James,
AL11 is the transaction code used to view the files in the Application server of the SAP system. OPEN DATASET is only used to read the files available in the application server. If the file is available in your colleague's server, OPEN DATASET will not work. If GUI_UPLOAD works, that's the way it is.
Vikranth
‎2010 Mar 24 2:51 PM
OPEN DATASET cann NOT read files from any server. It can read files from the application server where SAP is runnig at. For any other machine you need a samba share, but dont know if OPEN DATASET can handle samba shares.
‎2010 Mar 24 3:01 PM
HI Vikranth,
I have a report that need to run as daily job and upload the file
from server does GUI_UPLOAD works in this case.
And what do you mean by Application server of the SAP system which server is it ?
Regards
James
‎2010 Mar 24 3:05 PM
HI Rainer ,
There is a way to upload file from foreign server ?
Regards
James
‎2010 Mar 24 3:13 PM
You shuld use the transacion FILE to define logical and phisical paths, then use the funciton 'FILE_GET_NAME_USING_PATH' in your program
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
client = sy-mandt
logical_path = l_path
file_name = p_filename
IMPORTING
file_name_with_path = file_trg
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
OPEN DATASET file_trg FOR APPENDINGregards, Sebastian
‎2010 Mar 24 4:22 PM
HI Sebastia ,
I want to test it,
what should i put in file_name ?
Regards
James
‎2010 Mar 24 6:15 PM
hi James,
the parameter file_name receives the name of the file (ja, ja, ja.......)
here comes the explanation:
in the transaction FILE you must define phisical and logical path for a file:
for example:
MY_FILE => pointing to the folder /host/temp/
and here comes the call to the function in your program:
CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
EXPORTING
client = sy-mandt
logical_path = l_path " the name of your logical path defined in trx FILE (MY_FILE)
file_name = p_filename " the name of the file you want to read (for example: file.txt )
IMPORTING
file_name_with_path = file_trg
EXCEPTIONS
path_not_found = 1
missing_parameter = 2
operating_system_not_found = 3
file_system_not_found = 4
OTHERS = 5.in the variable file_trg you should get the value /host/temp/file.txt (from the example) to do the open dataset.
sorry about my english
regards, Sebastiá
‎2010 Mar 25 7:16 AM
HI Sebastian ,
Thanks ,
I have created the logical file as you mention in your previous post (via transaction file )
now after do open data set i get subrc = 0 but the problem is that when i read the file
with read data set i get subrc = 4 despite the file is not empty ?
what can be the reason in this case ?
Regards
James
Edited by: James Herb on Mar 25, 2010 9:18 AM
‎2010 Mar 25 9:40 AM
Could you please paste the piece of code here, and also mention the file and directory details. There could also be possibility of authorization, or even opening a wrong data set.
thanks,
Kaleem
‎2010 Mar 25 2:01 PM
Hello James,
I agree with Kaleemullah, please paste a piece of code to give you a more exact answer.
regards, sebastiá
‎2010 Mar 24 2:16 PM
Hi James,
What's your operation system? Unix or Windows?
If for Unix try the directory absolute, sample:
/usr/sap/project/sample.txt
If Windows try:
C:\usr\sap\sample.txt
Regards,
Welinton Rocha
‎2010 Mar 24 2:16 PM
What you want exactly...
If want to read from application server then only you can use OPEN DATASET
if want to read from presentation then can use GUI_UPLOAD, GUI_DOWNLOAD like...