‎2007 May 10 9:38 AM
HI ALL
i am facing some problem with open data set
here is my program
open dataset '/tmp/MHI' for output in text mode encoding default .
if sy-subrc ne 0.
SKIP 2.
write:/ 'Download failed', sy-subrc.
else.
loop at itab1.
transfer itab1 to '/tmp/MHI'.
if sy-subrc ne 0.
write:/ sy-subrc.
endif.
endloop.
close dataset '/tmp/MHI'.
endif.
"here itab1 contains data like 'ACBD' ie char(4) .
'/tmp/MHI' is i found from tcode AL11. ie directory app server.
but after executing program the value of sy-subrc is comming to 8.
and when i remove
this part
if sy-subrc ne 0.
SKIP 2.
write:/ 'Download failed', sy-subrc.
else.
error analyis is as below.
Short text
File "/tmp/MHI" is not open.
Error analysis
An exception occurred that is explained in detail
The exception, which is assigned to class 'CX_SY_
caught and
therefore caused a runtime error.
The reason for the exception is:
When accessing the file "/tmp/MHI", the system re
not open. Therefore, the file cannot be accessed.
‎2007 May 10 9:56 AM
Hi
Are you sure MHI is a file? Perhap it's a directory?
IF you can see the file in the AL11, run the trx AL11 and do a doubleclick on that file and check if the system can open the file.
If it can't, probably you can have some problem on the authorizations.
Max
‎2007 May 10 9:53 AM
hi Amar,
check out my sample program ,it will surely work.
Hope its required to give the file name in your directory path.
DATA:BEGIN OF WA,
NAME(20) TYPE C,
END OF WA.
DATA: IT_TAB LIKE TABLE OF WA WITH HEADER LINE.
DATA FNAME TYPE STRING VALUE 'C:\SIVA\FILE.TXT'.
BREAK-POINT.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FNAME
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = '#'
TABLES
DATA_TAB = IT_TAB
.
IF SY-SUBRC <> 0.
ENDIF.
DATA F2 TYPE STRING VALUE 'd:\usr\sap\trans\HI.txt'.
BREAK-POINT.
OPEN DATASET F2 IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
LOOP AT IT_TAB INTO WA.
TRANSFER WA TO F2.
ENDLOOP.
CLOSE DATASET F2.
Thanks
Siva
‎2007 May 10 9:56 AM
Hi
Are you sure MHI is a file? Perhap it's a directory?
IF you can see the file in the AL11, run the trx AL11 and do a doubleclick on that file and check if the system can open the file.
If it can't, probably you can have some problem on the authorizations.
Max
‎2007 May 10 11:24 AM
thanks max bianchi
my problem has solved, the problem is that the have dose not have write access thats why it is showing error
thanks
‎2007 May 10 10:02 AM
HI,
YOu are just givile the path not the file name..
just give /tmp/MHI/<filename.extension> isnstead of /tmp/MHI..
reward if useful;
regards,
nazeer