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

Regarding Internal Table

Hi

I have one internal table. I dontno how many records are there in that internal table.

But, I want to read the last record directly.

How can I get that last record.

Regards

Sandeep Reddy

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 01:37 PM

    Hello,

    Try this:

    DATA lv_i TYPE i.
    
    lv_i = lines( INTERNAL_TABLE ).
    
    READ TABLE INTERNAL_TABLE INTO wa_line INDEX lv_i.
    

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 01:38 PM

    hi,

    do this way ..

    describe table itab lines v_lines.
    read table itab index v_lines.
    if sy-subrc = 0.
    endif.
      

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 01:38 PM

    Hi,

    Use this:

    data: v_line like sy-tabix.

    Describe table t_table lines v_line.

    Read table t_table index v_line.

    Regards,

    Fernando

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 01:40 PM

    Hi Sandeep,

    DATA:
      w_lines LIKE su-tabix.          " Calculating the Number of Lines in Internal TAble
    
    DESCRIBE t_itab LINES w_lines.
    READ TABLE itab INTO wa_itab INDEX w_lines.

    Regards,

    Sunil

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 29, 2008 at 01:41 PM

    Hi sandeep,

    it's far more easy:

    
    READ TABLE itab INDEX sy-tfill.
    
    

    Note sys field sy-tfill gets filled automatically in every operation with internalö tables.

    Regards,

    Clemens

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 29, 2008 at 01:42 PM

    get total number of records using describe statment ....

    then using sy-tabix read the last record...

    regards

    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.