Skip to Content
author's profile photo Former Member
Former Member

Getting Message as "File not open", when I ran background Job

Hi,

I developed a Migration Program, Which reads the data from Application serever and procced with further process in back ground mode.

Same program is workind fine in Development System in Back ground mode (SY-BATCH = 'X', Scheduled a batch Job). So I transported to Quality system.

Now When I run the program in background mode (SY-BATCH = 'X', Scheduled a batch Job), getting Message as "File is not Open" at Quality system. So I debugged the Batch job through "JDBG", and found file opening and reading the content sucessfully.

But its not working without debugging mode and getting message as "File not open".

Is there any Authorizations required for background mode (without debugging).

So can you please help me on this how to solve this issue.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2011 at 08:44 AM

    rajsekhar,

    Please answer my following questions.

    1. is there any extension in the file name you are providing? if yes, remove it, might help

    2. are you using the same user id for foreground processing and background processing, (i dont think issue lies here)

    3. Main Question are your app servers and central instance belong to same OS type? what i mean is: do you have combination of UNIX and WINDOWs for your app servers/central instance??

    Please answer these

    Add a comment
    10|10000 characters needed characters exceeded

    • Valerie Lee Kesavadas Thekkillath

      Try this code:

      DATA: PATH_NAME(80) TYPE C,

      LV_FILENAME TYPE STRING.

      DATA: LW_XSTRING TYPE XSTRING,

      X_LEN TYPE I.

      DATA: FILE_AUTH_ERR TYPE REF TO CX_SY_FILE_AUTHORITY,

      FILE_OPEN_ERR TYPE REF TO CX_SY_FILE_OPEN,

      FILE_OPEN_MODE_ERR TYPE REF TO CX_SY_FILE_OPEN_MODE,

      FILE_CLOSE_ERR TYPE REF TO CX_SY_FILE_CLOSE,

      FILE_CONVERSION_ERR TYPE REF TO CX_SY_CONVERSION_CODEPAGE,

      FILE_TOO_MANY_ERR TYPE REF TO CX_SY_TOO_MANY_FILES,

      MESS TYPE STRING,

      W_TEXT TYPE STRING.

      DATA: L_RC TYPE INT4.

      concatenate pathname lv_filename into lv_filename.

      TRY.

      OPEN DATASET LV_FILENAME FOR INPUT IN BINARY MODE MESSAGE MESS.

      CATCH CX_SY_FILE_OPEN_MODE INTO FILE_OPEN_MODE_ERR.

      W_TEXT = FILE_OPEN_MODE_ERR->GET_TEXT( ).

      L_RC = 1.

      CATCH CX_SY_FILE_AUTHORITY INTO FILE_AUTH_ERR.

      W_TEXT = FILE_AUTH_ERR->GET_TEXT( ).

      L_RC = 2.

      CATCH CX_SY_CONVERSION_CODEPAGE INTO FILE_CONVERSION_ERR.

      L_RC = 3.

      W_TEXT = FILE_CONVERSION_ERR->GET_TEXT( ).

      CATCH CX_SY_TOO_MANY_FILES INTO FILE_TOO_MANY_ERR.

      L_RC = 4.

      W_TEXT = FILE_TOO_MANY_ERR->GET_TEXT( ).

      CATCH CX_SY_FILE_OPEN INTO FILE_OPEN_ERR. "File already open

      L_RC = 5.

      W_TEXT = FILE_OPEN_ERR->GET_TEXT( ).

      ENDTRY.

      IF L_RC = 0.

      L_RC = SY-SUBRC.

      ENDIF.

      IF L_RC <> 0 OR SY-SUBRC NE 0.

      • Issue Error message in open file.

      CONCATENATE MESS 'Open dataset failed' w_text INTO MESS SEPARATED BY SPACE.

      message Exx(yyy) with mess.

      ELSE. "file exists and can be opened

      ENDIF.

  • author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2011 at 08:21 AM

    Can you please copy the code for reading file, please?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 07, 2011 at 05:21 PM

    I doubt if the problem is in reading the file; it is in how p_fname is declared. If there are any lower case letters in the file name, it must be declared as:

    PARAMETERS: f_name TYPE string LOWER CASE    "   or CHAR...

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.