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: 

SY-SUBRC

Former Member
0 Kudos
110

Dear All

Any one explain

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 a table sorted in ascending order of the type 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.

Regards

Suresh

4 REPLIES 4

Former Member
0 Kudos
53

Hi Suresh,

we all know tht sy-subrc values are used for checking in the sense to return something instead of going to dump .ok.

-


If this is the case tht means the condition is true and sy-tabix will be set .

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

If this is the case the entry it will be checked and tht value while comparing with some other vale is not exactly comparabe thn such situation occurs we should thnk tht the value comparision is not done properly but the some wrong value is present.

______________________--

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.

this mens it is clear tht no entries are found and we are either wrong with our logic or no data records exists.

regards,

sana.

Former Member
0 Kudos
53

These variables are called system fields....

As per your explanation, these variables used for "Processing in Internal Tables"...

For example,

If you are reading a record from the internal table with any condition...

READ TABLE ITAB INTO WA WHERE CARRID = 'AC'.

If record found by matching this criteria, then sy-subrc set to 0. and the sy-tabix will set to the index (no.of row) of the record in the internal table...

Like that please match with others...

0 Kudos
53

hi Ramu

Thanks sy-subrc set to 4 means

Regards

Suresh

0 Kudos
53

There is no record found with the given condition.

And sy-tabix will be set to the type of the table...

If you're doing binary search, the searching method is diffenent than the linear search...so it sy-tabix is dependent to the binary search method...

If you table is sorted table, then the next highest index will be stored in the sy-tabix