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

How to find out last line item of internal table

Hi experts

I have one requirement that i want

these are the my internal table field and in column "reco quantity" field value 100, 83.193 and 14.704 is coming from the formulas but for the last line item of the internal table where the value is "2.101" it should be come from (100-83.193-14.704).

Please help me how to check last line item in internal table to find the value for last line item.

Thanks and Regard

Bipin

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Feb 20, 2013 at 11:46 PM

    #WTF guys!

    READ TABLE lt_sflight
    REFERENCE INTO lr_sflight
    INDEX lines( lt_sflight ).

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 20, 2013 at 06:02 AM

    Hi Bipin,

    To get the last line of an internal table you can use describe table, and use the result of describe table as index in your read table.

    Regards,

    Bhushan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 20, 2013 at 03:44 PM

    Bipin,

    As Nagabhushan mentioned, you can use describe table to get the number of items are then use it as index.

    But since DESCRIBE TABLE takes more execution time, you can think of any alternative.

    See how you are populating the internal table. If you are populating the internal table from a select query directly, then you can use SY-DBCNT as index. Else if you are populating the table manually, you can keep track of the SY-TABIX used after the last entry was populated.

    Thanks,

    Sreekanth

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 20, 2013 at 05:40 AM

    I am not clear with your question. But you can try.

    describe internal table lines [Variable_name]

    It will give number of records in table.

    Then read that internal table with with Index [Variable name.]

    It will give last row of internal table.

    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.