Skip to Content
avatar image
-1
Former Member

CX_SY_FILE_OPEN_MODE - DATASET_NOT_OPEN in background job

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 14, 2017 at 09: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.

    Add comment
    10|10000 characters needed characters exceeded