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 to find out last line item of internal table

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

GrahamRobbo
Active Contributor
0 Kudos

#WTF guys!

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

8 REPLIES 8

Rushikesh_Yeole
Contributor
0 Kudos

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.

Bhushan_hs
Participant
0 Kudos

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

SreekanthKrishn
Contributor
0 Kudos

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

GrahamRobbo
Active Contributor
0 Kudos

#WTF guys!

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

0 Kudos

I don't use REFERENCE INTO often, but the lines( internal_table ) have long forced DESCRIBE into retirement.

0 Kudos

Thanks all off you

0 Kudos

Still unanswered?!?!?

0 Kudos

answered