Skip to Content
avatar image
Former Member

Doubt in sy-subrc

Hi all,

I am checking the function module like this.

call function '.......'

endfunction.

if sy-subrc = 0 or sy-subrc = 3.

what is the meaing of above checking.

regards,

Ajayreddy

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 20, 2007 at 08:22 PM

    Ajay,

    sy-subrc = 0 means the above statement is successful.

    sy-subrc = 3 depends on what the condition has been set in that FM. It may be set to some exception.

    Regards

    Aneesh.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:22 PM

    Hello Ajay

    If the coding is exactly as you described then it is faulty. The coding should look like:

      CALL FUNCTION '...'
         ...
       EXCEPTIONS
         first_exception = 1
         second_exception = 2
         others = 3.
    
      CASE syst-subrc.
        WHEN '0'.  " ok
    
        WHEN '1'.
    "     do error handling
    
        WHEN others.
    "    do error handling (error 2 & 3 fall into the same "error handling group")
      ENDCASE.

    The sy-subrc is set when an exception is raised within the function module. The numbering of the exceptions is arbitrary.

    SY-SUBRC = '0' usually means the function call was ok, else there was some kind of error.

    Regards

    Uwe

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:19 PM

    <b>SY-SUBRC = 0</b> Everything works Ok.

    <b>SY-SUBRC = 3</b> You got an error.

    Greetings,

    Blag.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:19 PM

    HI,

    in the exceptions under function module see what does 3 means. how ever 0 is success...

    Thanks

    mahesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 20, 2007 at 08:20 PM

    It actually should be...

    IF SY-SUBRC EQ 0.
    ELSE.
    *All other SY-SUBRC numbers...
    ENDIF.
    

    Greetings,

    Blag.

    Add comment
    10|10000 characters needed characters exceeded