My ABAP program uses OPEN DATASET statement to create a file which works fine in foreground mode and nearly 50% of background runs. But some job instances have 'cancel' status with error 'No such file or directory' (lv_msg). But at the same time, when I run in the foreground, it creates a file successfully.
CONCATENATE '\\' sy-host '\USS\out\' lv_entity '_Inc_' sy-datum '_' sy-uzeit '.csv' INTO lv_filename . OPEN DATASET lv_filename FOR OUTPUT IN TEXT MODE ENCODING UTF-8 MESSAGE lv_msg IGNORING CONVERSION ERRORS. IF sy-subrc NE 0. MESSAGE lv_msg TYPE 'E'. ENDIF.
It is difficult to understand why it fails only for some background jobs. Appreciate your help.