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 DATASET return error when call program background (JOB) in PRD Server

Former Member
0 Likes
755

Hi Expert,

My program read file from application server. And I use statement

OPEN DATASET path_file FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE errormsg.

path_file = '/inf/HR/100/INCOMING/ZSHRPA_1000000020090421.TXT'.

When I process program by foreground.It's no error message.

But If I process program by background.It's return error "No such file or directory".

My production server has two Server.(I user Tcode SM51).

How can I read file?

Best regards,

Sasitha k.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
679

Hi Sasitha,

You set Job Schedule with Tcode SM36 and SM37.

You should to select Exec.Target that content your file.

Regards,

4 REPLIES 4
Read only

SujeetMishra
Active Contributor
0 Likes
679

Hello Sasitha,

You first check the server whether this file really exists or not.

for this you can use tcode AL11.

if not available then contact the basis consultant to create such path.

if available then send me the code where you are reading the path n data.

Have a Nice Day,

Regards,

Sujeet

Read only

0 Likes
679

File exist in app server path.(use tcode AL11)

my code:

OPEN DATASET path_file FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE errormsg.
  IF sy-subrc = 0.
    DO.
      READ DATASET path_file INTO gw_file.
      IF sy-subrc = 0.
        APPEND gw_file TO it_file.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    IF it_file[] IS INITIAL.
      status = 'E'.
    ENDIF.
  ELSE.
    status = 'E'.
    CONCATENATE errormsg path_file text-e01 into errormsg.
  ENDIF.

  CLOSE DATASET path_file.

Read only

Former Member
0 Likes
680

Hi Sasitha,

You set Job Schedule with Tcode SM36 and SM37.

You should to select Exec.Target that content your file.

Regards,

Read only

Former Member
0 Likes
679

Hello,

Use this Fm

TXW_FILE_OPEN_FOR_READ

if sy-subrc eq 0.

DO.

CLEAR gi_text.

READ DATASET lv_filename INTO gi_text.

IF gi_text IS NOT INITIAL.

APPEND gi_text.

ENDIF.

ENDDO.

CLOSE DATASET lv_filename.

ENDIF.

Try this it will work.