Skip to Content
author's profile photo Former Member
Former Member

SY-SUBRC

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 06:38 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 06:47 AM

    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...

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.