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: 

How many records will be returned by the following READ statement?

Former Member
0 Kudos

Hi All.

I have an internal table ITAB_REF0011 with 169 records.

I wanted to filter it based on the criteria -->

LN_DAT8 = '11111111' LN_TIM6 = '222222' BINARY SEARCH.

This filter will return only 1 record out of the 169 records.

If I do the codes below, will SY-TFILL = 1? If not, how do I find out the number of records after the internal table ITAB_REF0011 has been filtered? Thanks.

****************************************************************************

READ TABLE ITAB_REF0011 WITH KEY

LN_DAT8 = '11111111' LN_TIM6 = '222222'

BINARY SEARCH.

IF SY-SUBRC = 0.

LOOP AT ITAB_REF0011.

IF SY-TFILL = 1. ==> SY-TFILL <> 1, why?

...

ENDLOOP.

ENDIF.

...

4 REPLIES 4

varma_narayana
Active Contributor
0 Kudos

Hi..

1. READ TABLE statement will only one Record from Itab to Workarea.

2. SY-TFILL Stores the Total number of records in internal table.

3. You can use SY-Tabix To find the Current record in LOOP.

LOOP AT ITAB.

IF SY-TABIX = 1.

ENDLOOP.

reward if Helpful.

Former Member
0 Kudos

READ TABLE ITAB_REF0011 WITH KEY

LN_DAT8 = '11111111' LN_TIM6 = '222222'

BINARY SEARCH.

data : v_line type i.

describe table ITAB_REF0011[] lines v_line.

v_line contains no. of records in ITAB_REF0011.

Former Member
0 Kudos

Hi,

I think this was your point if i am correct.

you want filter out how many records were there with you condition in the internal table

You need to do

loop at itab1 and your conditions

v1 = v1+ 1.

increment the variable.

endloop.

this will solve your problem

you can not do it by read statement

Regards,

siva chalasani.

<b>Reward points if usefull</b>

former_member386202
Active Contributor
0 Kudos

Hi,

Read statement always read only one record at a time.

Regards,

Prashant