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: 

READING INTERNAL TABLE RECORDS

Former Member
0 Kudos

HI

I WANT TO READ JUST THE LAST RECORD OF AN INTERNAL TABLE.

HOW CAN I DO IT? I WANT TO STORE THAT LAST RECORD IN A VARIABLE.

HOW TO DO THAT...

1 ACCEPTED SOLUTION

former_member188827
Active Contributor
0 Kudos

data count type i.

loop at itab.

count = sy-tabix.

endloop.

*count holds last row index of internal table...

read table itab index count.

plz reward points if dis helps

4 REPLIES 4

amit_khare
Active Contributor
0 Kudos

Describe table itab length v_len.

read table itab into wa_itab index v_len.

Regards,

Amit

Reward all helpful replies.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

describe table itab lines ln.

read table itab index ln.

former_member188827
Active Contributor
0 Kudos

data count type i.

loop at itab.

count = sy-tabix.

endloop.

*count holds last row index of internal table...

read table itab index count.

plz reward points if dis helps

Former Member
0 Kudos

Hi

1. Last means what ? It may mean,

the last entered, as per some date/time field in the table.

2. So its better to select all records first

in some internal table (for the same person number)

3. Then SORT ITAB field5 descending.

4. Read ITAB INDEX 1.

Or

once u get data from table into a int table.

describe table itab lines FILL.

fill will return u the no of records in the int table.

read table itab ..... index FILL.

if sy-subrc = 0.

write 😕 itab.

endif.

<b>Reward if usefull</b>