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

how to get the last record of an internall table ....

Hi All..

i want to get the last record of an internal table itab, and i want the the value of the last record.

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 Nov 30, 2007 at 04:36 AM

    Hi,

    Use describe statment.

    data: lv_line type i.

    Describe table itab lines lv_line.

    read table itab into wa_itab index lv_line.

    regards,

    Santosh Thorat

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 04:36 AM

    Hi Abaper,

    describe table itab n.

    read table itab index n.

    if sy-subrc eq 0.

    itab2-field = itab-field.

    Endif.

    Regards,

    Kvaeri.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 04:38 AM

    Hi ,

    To know the last record insert in a table

    DESCRIBE TABLE ITAB LINES SY-TFILL.

    READ TABLE ITAB INDEX SY-TFILL.

    Thanks

    Mohinder Singh Chauhan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 04:42 AM

    Hi,

    First sort the internal table descending and the first record.

    sort itab descending by <field>.

    loop at itab .

    read table itab index i.

    endloop.

    Regards,

    Vani.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 30, 2007 at 04:40 AM

    Hi,

    sort itab by <your key field > descending.
    read table itab index 1.
    

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 30, 2007 at 04:41 AM

    Hi,

    Do like this

    data: lv_count type i.

    Describe table itab lines lv_count.

    read table itab into wa_itab index lv_count.

    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.