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

Read table statement

Former Member
0 Likes
862

hi,

while reading the internal table, if the subrc value is 8 .

what does it mean.

any help will be appreciated.

4 REPLIES 4
Read only

Former Member
0 Likes
531

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.

<b><i>SY-SUBRC = 8:</i></b>

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.

Read only

andreas_mann3
Active Contributor
0 Likes
531

Hi rajkumar,

here's an example :

*in progtab are 2 entries

*now entry is'nt found:

  • sy-subrc = <b>8</b> , sy-tabix = number of entries + 1 = <b>3</b>.


DATA:  BEGIN OF PROGTAB OCCURS 10,
       NAME LIKE TRDIR-NAME,
       END OF PROGTAB.
MOVE TRDIR-NAME TO PROGTAB-NAME.
READ TABLE PROGTAB WITH KEY PROGTAB BINARY SEARCH.   
 IF SY-SUBRC <> 0.                                    
   INSERT PROGTAB INDEX SY-TABIX.                     
 ENDIF.

regards Andreas

*

Read only

0 Likes
531

This message was moderated.

Read only

former_member197132
Participant
0 Likes
531

This message was moderated.