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
1,044

Hi experts, I have a READ TABLE ... WITH key ... FOR ALL Entries.

What is the meaning of sy-subrc 4 and sy-subrc 8, in this case. What is the difference beetwen them?

Hi experts, I have a READ TABLE ... WITH key ... FOR ALL Entries.

What is the meaning of sy-subrc 4 and sy-subrc 8, in this case. What is the difference beetwen them?

6 REPLIES 6
Read only

Former Member
0 Likes
911

hi,

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.

siva

Read only

Former Member
0 Likes
911

hi,

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.

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.

siva

Read only

former_member194669
Active Contributor
0 Likes
911

Hi,

SY_SUBRC = 4 SY-TABIX points to the next largest entry.

SY-SUBRC = 8 The key sought is greater than that of the last table entry.

May be check this link

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/read_t01.htm

Read only

Former Member
0 Likes
911

Reads an entry from an DS:ABEN.ITAB>internal table, using either its key or its index. The return code SY-SUBRC specifies whether an entry could be read. If you specify a non-unique key (the table must have a NON-UNIQUE key for this to be valid) , the system returns the entry with the lowest index from the set of entries that meet the condition.

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.

I hope this helps.

<REMOVED BY MODERATOR>

Regards

Sujay

Edited by: Alvaro Tejada Galindo on Feb 18, 2008 12:54 PM

Read only

Former Member
0 Likes
911
READ TABLE ... WITH key ... FOR ALL Entries

Never heard of it - what version are you on?

In any event, simply pressing F1 on READ (like most of the other responders did for you) will get you the answer more quickly.

Rob

Read only

0 Likes
911

Sorry, You have right. It is with binary search