2007 Apr 18 3:08 PM
I am creating an error log using open dataset but I am unable to open it. The usable status is not marked X. The file length is more than 0 though. What could the problem be?
2007 Apr 18 3:14 PM
I am creating an error log using open dataset but I am unable to open it. The usable status is not marked X. The file length is more than 0 though. What could the problem be?
2007 Apr 18 3:11 PM
hi,
I guess you are not having authorizations provided ...
Regards,
Santosh
2007 Apr 18 3:13 PM
I have created other text files in the folder so i dont think permissions should be an issue
2007 Apr 18 3:14 PM
2007 Apr 18 3:16 PM
Your coding should be simular to this.
report zrich_0001.
Parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.txt'.
data: itab type table of string.
data: wa type string.
start-of-selection.
wa = 'This is an error'. append wa to itab.
wa = 'This is another error'. append wa to itab.
wa = 'This could be an error'. append wa to itab.
* Update file
open dataset d1 for output in text mode encoding DEFAULT.
loop at itab into wa.
transfer wa to d1.
endloop.
close dataset d1.
Regards,
Rich Heilman
2007 Apr 18 3:18 PM
Here is a snippet.
DATA: errorlog TYPE string
VALUE '/interfaces/DA1/ErrorLog.txt',
v_header = '******* CREDIT CHECK ERROR LOG *******'.
v_timestamp = 'Created On'.
* Write to ErrorLog
OPEN DATASET errorlog FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
TRANSFER v_header TO errorlog.
TRANSFER v_t_timestamp TO errorlog.
TRANSFER '' TO errorlog.
CLOSE DATASET errorlog.Message was edited by:
Megan Flores
2007 Apr 18 3:29 PM
Hi,
try the following:
data: os(200).
OPEN DATASET errorlog FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
message os.
write os.
stop.
And then see, what the Operating System tells you.
Martin
Message was edited by:
Martin Pfeiffer
2007 Apr 18 3:20 PM
Hi,
Please check the SY-SUBRC.
* Write to ErrorLog
OPEN DATASET errorlog FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC = 0.
TRANSFER v_header TO errorlog.
TRANSFER v_t_timestamp TO errorlog.
TRANSFER ' ' TO errorlog.
ELSE.
WRITE: / 'FILE COULD NOT BE OPENED.'.
ENDIF.
CLOSE DATASET errorlog.
Regards,
Ferry Lianto
2007 Apr 18 3:31 PM
2007 Apr 18 3:22 PM
FOR INPUT
opens the file for reading. I need to write to the file
2007 Apr 18 3:28 PM
I tried changing that but it still is creating the file as unusable.
2007 Apr 18 3:33 PM
the file properties are
usable
viewed
changed
the usable is not marked X
I am going to create another filename instead. Lets see if that works.
2007 Apr 18 3:35 PM
That did it .. I changed the name of the error log file and now its opening up. Not sure what the issue was. Thanks for your help guys.
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |