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
807

Hi all

I want complete description on sy-subrc

Hi all

I want complete description on sy-subrc

5 REPLIES 5
Read only

Former Member
0 Likes
767

hi,

Depending on what the senario is, the value could be anything. For ABAP statements, it is usually, 0,4,8 which means success or failure. Or from BDC CALL tranaction, 1001, will mean failure. Or if we are talking about sy-subrc value after calling a function module, it will depend on the exceptions list from the function module, and what values are assigned to the exceptions. Here is could be anything.

Sy-subrc = 0 -


Success

Sy-subrc = 4 -


Failure(known reason)

Sy-subrc = 8 -


Internal error(Unknown reason).

Read only

Former Member
0 Likes
767

Hi,

SY-SUBRC is the system return parameter that SAP provides for all actions like Select, Read, the outcome of a Function module etc.

In general, if the SY-SUBRC = 0, then that action has been performed successfully.

If SY-SUBRC > 0 then, the system has raised an exception

***do reward if usefull

vijay

Read only

former_member196280
Active Contributor
0 Likes
767

GOTO SE11, and type SY / SYST and display,goto SUBRC field you can see the description there.

It is mainly useful, to know whether return code is successful or failure or error.

0-SUCCESS 4- FAILURE 8- ERROR

Rgds,

SaiRam

Read only

Former Member
0 Likes
767

Hi Subin,

Sy-subrc statement is for checking the errors in the coding.

it applies after quries and read statements.

if sy-subrc = 0

the result contains at least one record.

if sy-subrc = 4

The result table is empty

if sy-subrc = 8

applies only to select single for update you did not specify all the primary key fields in the where condition .The result table is empty.

Use this link,

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm

If useful reward points.

Thanks

Sanket.

Read only

varma_narayana
Active Contributor
0 Likes
767

Hi..

SY-SUBRC is a system field that stores the status of previously executed statement.

If a statement is SUCCESSFUL it stores the value 0.

otherwise it will store any other value like 4 , 8 based on the error condition.

reward if useful.

regards.