12-08-2017 6:23 PM
Hello Team,
Im facing a strange issue.
I run a background job that requires me to write some line records on to a file on a given folder in the Application server in AL11.
I have the below code.
OPEN DATASET pv_targt FOR OUTPUT IN TEXT MODE ENCODING DEFAULT MESSAGE lv_message.
IF sy-subrc eq o.
Loop at xxx
TRANSFER pw_data TO pv_targt.
CLEAR:pw_data
.EndLoop.
close dataset pv_targt
else.
WRITE:/ 'Could not create file', lv_message.
endif.
The file is created perfectly fine when the program is run in foreground.
But when I run in background, the error is always invoked.
and lv_message is populated as = no such file or directory.
But this is very much a valid path, and it works perfectly in foreground.
Can someone help?
12-14-2017 9:23 AM
Hey,
The catchable exception CX_SY_FILE_OPEN (without the word MODE that appears in the header/title of the question) indicates that the file is already open.