Application Development 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: 

Doubt in sy-subrc

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

5 REPLIES 5

former_member583013
Active Contributor
0 Kudos

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

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

Greetings,

Blag.

Former Member
0 Kudos

HI,

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

Thanks

mahesh

former_member583013
Active Contributor
0 Kudos

It actually should be...


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

Greetings,

Blag.

uwe_schieferstein
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.