‎2010 Aug 23 6:55 PM
issue: have an abap program which uses "open dataset ... for input ..." to read the file.
- with manual ly running it, receive the following message "dataset_not_open".
- with scheduling it, receive same message
attempting to run an abap program as part of a process chain (ie scheduling a background job) in BI.
the abap performs the following fxns:
1) read a file on the server
2) removes delimiter, renames it
3) rewrites the file onto the server
initially used ws_upload for reading and ws_download for writing the file.
- both fxns worked fine if it is run manually --> but failed as a background (part of process chain)
- note 7925 states can't use ws_upload, download for background jobs
-so switched to "open dataset"
Any suggestions as to why the "open dataset" does not work is greatly appreciated it.
B.A.
‎2010 Aug 23 10:17 PM
If you used WS_UPLOAD and WS_DOWNLOAD and they worked in foreground, then the files are on the presentation server. Correct?
If so, OPEN and CLOSE DATASET will not work. They can only be used on the application server.
Rob
‎2010 Aug 23 7:41 PM
Hi. Please write your code for opening file.
I recomend you to use transaction AL11. You can check whether you can see you file on the server.
The most popular error in my work is not having permission for this file or folder.
If in AL11 you can see and open your file then problem in your code. Otherwise, you should ask your basis team to change permissions on that file for OS user, which is assigned to SAP.
‎2010 Aug 23 7:53 PM
Hi BA,
From your question I am not clear whether you got the system message or the custom message you created for OPEN DATASET. But my way of trapping error is to always have the addition MESSAGE msg in my OPEN DATASET. That should give you more detailed error message. Then you can figure out what the issue is. Most of the time the issues are due to permission.
You can use the following sample code
DATA err_mess TYPE string.
OPEN DATASET 'Somefile` FOR INPUT IN BINARY MODE MESSAGE err_mess.
IF sy-subrc <> 0.
MESSAGE err_mess TYPE 'I'.
ENDIF.
Good luck.
Thanks,
KasthuriRangan Srinivasan
‎2010 Aug 23 8:11 PM
Thanks, Konstantin.
However, all permissions have been checked and I do have full permission. So, does "BWREMOTE" which takes over when running the process chain (ie background job) in BI
‎2010 Aug 23 8:27 PM
WS_UPLOAD/DOWNLOAD were replaced with GUI_UPLOAD/DOWNLOAD. However, these are for foreground desktop targets. If your file is on the apps server, and you do open dataset, check your return code....8 = could not open file. You either don't have permissions or you're not pointing to the actual file or alias for the file. Program should not proceed until a check of that return code gives a zero!
‎2010 Aug 23 8:48 PM
Thank you for all responses. here is more info about the err message:
sy-subrc = 8
'invalid argument'
I looked up the invalid argument in note 99155 --> due to "The destination file is no longer available during repeated file access. " So, the following steps were taken:
- file was regenerated and
- file was placed on the server to be read
have the following code:
OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE encoding default
MESSAGE D_MSG_TEXT.
also have tried the following:
OPEN DATASET d1 for input in text mode encoding default.
open dataset d1 for output in text mode encoding NON-UNICODE..
open dataset d1 for output in text mode encoding utf-8.
none had worked. system --> status shows no unicode.
THanks again for any suggestions.
‎2010 Aug 23 9:20 PM
I can only advice to log in on application server as user, which is used by SAP, and try open/write to file.
It's the quickest method I see.
‎2010 Aug 23 9:58 PM
Hi BA,
What was the error you got in the variable D_MSG_TEXT. That should tell you the correct problem.
Thanks.
‎2010 Aug 23 10:15 PM
Another common mistake dealing with Aplication server files is the case sensitivity.. make sure the path that you are passing for open dataset exactly matched the case that you see in AL11.. check the .DAT or .dat or .TXT or .txt
‎2010 Aug 23 10:17 PM
If you used WS_UPLOAD and WS_DOWNLOAD and they worked in foreground, then the files are on the presentation server. Correct?
If so, OPEN and CLOSE DATASET will not work. They can only be used on the application server.
Rob
‎2010 Aug 23 10:29 PM
Thank you all for your answers.
Rob,
I am trying to run the files on the background. Our Basis is indicating that the presentation and application serve are both on the same server.
Thanks again.
B.A.
‎2010 Aug 24 12:37 AM
HI,
How are you passing the file name to the program? "C:" or "
servername\"?
Arash
‎2010 Aug 24 12:41 AM
Thanks for your response. Yes, it is hard coded as
Data: FILENAME(128) value '
XXX\XX\file.csv'.
Not using "parameter".
‎2010 Aug 24 2:46 AM
Behnaz,
Just to clarify - the presentation server is the PC you, as a user, is logged on to and the application server is where SAP is running. These are two very different things.
Rob is right, if the upload / dowload worked previously using 'WS_*' then the file is residing on your local machine and not the server.
Can you double check this?
Cheers,
Neil.
‎2010 Aug 24 5:49 AM
hi,
Did you check in the Application server that what ever the dataset you have created was that created in application sever.. you can track this information using Tcode AL11... just check it...
Regards,
Kiran
‎2010 Aug 24 3:27 PM
Thank you Neil and Kiran. You both are right. It used to be in AL11. No longer. The server was partitioned and the file is created in the new partition. eventhough the file is in the same server but is in a different partition
Thank you all for your time, expertise.
B.A.