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 values

Former Member
0 Likes
540

friends we see sy-subrc returning some values ,please provide me alist of values

and what do they suggest?

4 REPLIES 4
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
509

The values and there meanings depend on the statement. One important thing is that when SY-SUBRC = 0, then the previous statement is successful, when it is not 0, then the previous statement was not successful.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
509

0 is a success in all cases...

other values depends on what "statement / function" you executed...it depends on that...

Thanks.

Read only

Former Member
0 Likes
509

hi,

the value will get set depending upon the statements. If u press F1 and see the documentation u can understand.

Do F1 for READ, SELECT, etc.

If sy-subrc =0 then the statement suceeded adn if it is 4 it is with error.

S sy-ubrc value changes .

Eg. While u modify

SY-SUBRC = 0:

The entry was changed.

SY-SUBRC = 4:

Index position too large. No entry was changed, since the table contains less than idx entries

Not only 0 and 4 is there also 2,4,8...

See the READ help doc

SY-SUBRC = 0:

An entry was read.

SY-TABIX is set to the index of the entry.

SY-SUBRC = 2:

An entry was read.

SY-TABIX is set to the index of the entry. This return code can only occur when you use the COMPARING addition. For further detauls, refer to the COMPARING section of the additions

SY-SUBRC = 4:

No entry was read.

The value of SY-TABIX depends on the table type and whether the BINARY SEARCH addition was specified.

If the table is a SORTED TABLE or STANDARD TABLE with the BINARY SEARCH addition, SY-TABIX refers to the next-highest index.

Otherwise, SY-TABIX is undefined.

SY-SUBRC = 8:

No entry was read.

This return code only occurs with a SORTED TABLE or a STANDARD TABLE with the BINARY SEARCH addition. SY-TABIX is set to the number of all entries plus 1.

Message was edited by:

Judith Jessie Selvi

Read only

hermanoclaro
Participant
0 Likes
509

Hi there!

The values of sy-subrc depends on the instruction that's run before the sy-subrc check. When the statement runs correctly the sy-subrc will be equal zero, otherwise it encontered and error.

You can see the exceptions of a function using the model to call the function or accessing it by se37 and get the meaning of the sy-subrc numbers that the function returns.

Hope this help you out.