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: 

Regarding Internal Table

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Try this:


DATA lv_i TYPE i.

lv_i = lines( INTERNAL_TABLE ).

READ TABLE INTERNAL_TABLE INTO wa_line INDEX lv_i.

Regards,

6 REPLIES 6

Former Member
0 Kudos

Hello,

Try this:


DATA lv_i TYPE i.

lv_i = lines( INTERNAL_TABLE ).

READ TABLE INTERNAL_TABLE INTO wa_line INDEX lv_i.

Regards,

Former Member
0 Kudos

hi,

do this way ..


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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Clemenss
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

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

regards