Skip to Content
-1

CX_SY_FILE_OPEN_MODE - DATASET_NOT_OPEN in background job

Dec 08, 2017 at 06:23 PM

133

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Iftah Peretz
Dec 14, 2017 at 09:23 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded