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
918

what sy-subrc do?whats the use of it

what sy-subrc do?whats the use of it

6 REPLIES 6
Read only

Former Member
0 Likes
864

Hi,

It checks for the return value after a statement is executed.

If the prior statement executed successfully it will have a value 0, otherwise it would have a non-zero value.

Regards

Subramanian

Read only

Former Member
0 Likes
864

hi,

its a system variable which is used to check whether a particular stmt was successful or not.

if sy-subrc = 0.-->it means the stmt was successful.

if sy-subrc has a non-zero value it means the stmt was unsuccessful.

regards,

priya.

Read only

Former Member
0 Likes
864

Hi,

SAP provided us with predefined Data objects. One such object is SUBRC in the table SYST.

The purpose of this field to indicate success/failure of any action in SAP. After each statement in SAP is executed, the SY-SUBRC is set depending on the result of the statement. the SY-SUBRC can contain the following values.

0 - This value is set when the statement is executed successfully.

2 - This value is set when the statement is executed unsuccessfully.

4 - This value is set when the statement is executed unsuccessfully.

8 - This value is set when the statement is executed unsuccessfully.

Check the following link

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb304e358411d1829f0000e829fbfe/content.htm

Regards,

Vara

Message was edited by:

varaprasad bhagavatula

Read only

abdul_hakim
Active Contributor
0 Likes
864

hi

itz a sys variable used to check whether particular operation is successful or not.

Jus chk the correponding statment key word documentation for the same.

Cheers,

Hakim

Read only

Former Member
0 Likes
864

Hi,

hi,

SY-SUBRC is a system variable which is used to check a particular statement is successful or unsuccessful.

if SY-SUBRC = 0.-- means the statement is successful.

if SY-SUBRC = 2 or 4 or 8 or not equal to zero means the statement is unsuccessful.

please reward if useful.

Read only

Former Member
0 Likes
864

Sy-subrc is a system variable that indicates the status of execution of a statement. A value of 0 indicates that the statement is successful and a non-zero value indicates an unsuccessful execution.

sy-subrc is also used to check the output of FMs where exceptions are being handled. The FM always returns the exception number defined inside the FM in the sy-subrc field.

Reward points if found useful..!

Cheers

Abhishek