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

sy-subrc

Former Member
0 Likes
1,122

hello

if operation is successfull, value of sy-subrc is 0 else 4

but why 4 only? not 2/3/5???//

plz help

aafaq

8 REPLIES 8
Read only

Former Member
0 Likes
1,091

Different values for sy-subrc are for different purpose.

Rest of the values are reserved for exception handlings.

Reward points if it helps.

Read only

0 Likes
1,091

subrc has been assigned diff value to make sure based on the kind of exception that occurs they can b catched in this field and based on the message for error handling can be invoked..remember while calling function module u r provided with 3,4 parameters and based on those values exceptions can be raised..

reward points if it helps

gunjan

Read only

0 Likes
1,091

HI,

<b>SY-SUBRC</b>

As with other ABAP/4 statements, the return code value in the system field SY-SUBRC indicates after each Open SQL operation whether or not the operation was successful. If an operation is successful, SY-SUBRC = 0. If an operation is unsuccessful – SY-SUBRC <> 0

Regards,

Santosh

Read only

Former Member
0 Likes
1,091

hi,

check this link

in some cases it will return 1, 2 and 3 also.

CREATE OBJECT in OLE2 sets SY-SUBRC to 0 if an external object was created, otherwise 1,2, 3 with different causes.

OLE2 automation, bundled commands set SY-SUBRC to 0 if all were successfully executed, otherwise 1, 2, 3, 4 depending on cause

http://help.sap.com/saphelp_47x200/helpdata/en/7b/fb96c8882811d295a90000e8353423/frameset.htm

sudheer.A

Message was edited by: sudheer Addepalli

Message was edited by: sudheer Addepalli

Read only

abdul_hakim
Active Contributor
0 Likes
1,091

HI

as an ABAP Developer you don't need to worry all these things.SAP will take care of all these return code values.Whatever SAP says regarding this jus we need to nod our heads..Dont spend time on this investigation...

Cheers,

Abdul

Read only

Former Member
0 Likes
1,091

Hi !

Very often SY-SUBRC = 4 means ERROR and SY-SUBRC = 8 means "Warning".

The results of any command and function is explained in the online-help of the command.

Regards

Rainer

Some points would be nice if that helped a bit.

Read only

Former Member
0 Likes
1,091

A non-zero value for sy-subrc doesn't necessarily mean that an operation 'failed'. It just gives you some information about the results of an operation. For example - did a read statement find anything or not.

As a programmer, you have control over sy-subrc and can set it yourself.

Rob

Read only

Former Member
0 Likes
1,091

thankx