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

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

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.

...

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Nov 21, 2007 at 11:54 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 11:56 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 12:06 PM

    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>

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 21, 2007 at 12:07 PM

    Hi,

    Read statement always read only one record at a time.

    Regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

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.