Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Open Data set not creating a file when executing in background

Former Member
0 Likes
811

HI Experts,

I have a program which creates a text file. This program is attached to an output type.

When i run a transaction VT70 in background, i dont see any error but the files are not created either.

But if i run it in foreground and in debugging i change sy-batch and force it to run it in background the files are created.

Code im using:

DATA: l_file TYPE rlgrap-filename.

l_file = l_manifest.

OPEN DATASET l_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT MESSAGE l_message.

IF sy-subrc = 0.

LOOP AT gt_manifest INTO gs_manifest.

TRANSFER gs_manifest TO l_file.

ENDLOOP.

CLOSE DATASET l_file.

Endif.

5 REPLIES 5
Read only

Former Member
0 Likes
698

OPEN DATASET gv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT

WITH SMART LINEFEED.

Read only

0 Likes
698

No this is not working.

After executing in background from VT70 when in go and check in shipment (VT02N) ,

it says directory does not exists.

Read only

0 Likes
698

Does anyone know about this error.

Thanks Radhika

Read only

0 Likes
698

Is ur system UNICODE? Is this is the issue?

i guess, u can debug a back ground job, some thing like SMQ1, i forgot the tx code!!

thanq

Read only

0 Likes
698

In Sm50 you can debug your background running job...

did you maintain exceptions or use try this way:

OPEN DATASET filename FOR INPUT IN --BINARY-- MODE.
        IF sy-subrc NE 0.
          WRITE / 'File open failure'.
          RETURN.
        ENDIF.
        READ DATASET filename INTO str_utf16.
        CLOSE DATASET filename.

      CATCH cx_root INTO lr_ex.
        message = lr_ex->if_message~get_longtext( ).
        WRITE:/ message.
        CLOSE DATASET filename.