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

Sy-subrc value is 4 in some cases and 8 in some cases with open dataset

Hi Folks,

It's really weird to see while writing the data to application server with same userid sometimes i am getting value '0' and some times value '8'. I don't understand why i am getting this.

If this is an authorization issue then it shouldn't work for all , so i don't think its an authorization issue.

open dataset <dataset name> for output in text mode encoding default. This is what i have written in the program.

Actually we are running job daily to upload the data to application server.Sometime it writes and some times it is not writing.

Let me know your thoughts.Any help is highly appreciated.

Regards,

Raj

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 21, 2011 at 08:31 AM

    Hi,

    I think you need to talk with a system administrator of the application server about this problem. The administrator can analyse logs and solve the problem.

    Add a comment
    10|10000 characters needed characters exceeded

    • I always do something like this and it works just perfect:

        TRY.
      
          OPEN DATASET I_FILENAME FOR OUTPUT IN BINARY MODE MESSAGE ls_mess.
      
          CATCH CX_SY_FILE_OPEN. " The file is already open
            PERFORM close_dataset USING I_FILENAME.
            MESSAGE ID 'ZAM_TXT_FILES' TYPE 'E' NUMBER '001' RAISING FILE_WRITE_ERROR.
          CATCH CX_SY_CODEPAGE_CONVERTER_INIT. " The required conversion is not supported
            PERFORM close_dataset USING I_FILENAME.
            MESSAGE ID 'FES' TYPE 'E' NUMBER '024' RAISING CONVERSION_ERROR.
          CATCH CX_SY_CONVERSION_CODEPAGE. " Internal conversion error
            PERFORM close_dataset USING I_FILENAME.
            MESSAGE ID 'FES' TYPE 'E' NUMBER '026' RAISING CONVERSION_ERROR.
          CATCH CX_SY_FILE_AUTHORITY. " No authorization to access a file
            PERFORM close_dataset USING I_FILENAME.
            MESSAGE ID 'FES' TYPE 'E' NUMBER '012' RAISING ACCESS_DENIED.
          CATCH CX_SY_PIPES_NOT_SUPPORTED. " OPEN DATASET with addition FILTER is not supported on the current operating system
            PERFORM close_dataset USING I_FILENAME.
            MESSAGE ID 'ZAM_TXT_FILES' TYPE 'E' NUMBER '002' RAISING UNKNOWN_ERROR.
          CATCH CX_SY_TOO_MANY_FILES. " The maximum number of open files has been exceeded
            PERFORM close_dataset USING I_FILENAME.
            MESSAGE ID 'ZAM_TXT_FILES' TYPE 'E' NUMBER '003' RAISING UNKNOWN_ERROR.
          CATCH CX_ROOT.            " Unknown error
            PERFORM close_dataset USING I_FILENAME.
            MESSAGE ID 'FES' TYPE 'E' NUMBER '006' RAISING UNKNOWN_ERROR.
        ENDTRY.
        IF SY-SUBRC <> 0.
          PERFORM close_dataset USING I_FILENAME.
          MESSAGE ID 'ZAM_TXT_FILES' TYPE 'E' NUMBER '000' WITH ls_mess RAISING FILE_WRITE_ERROR.
        ENDIF.
      

      You also can check SM21 transaction.

      And you don't need debug on production. You can do some logging.

      Edited by: Alexander Ovcharenko on Jul 21, 2011 3:02 PM

      messages were corrected

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.