2006 Apr 06 6:44 AM
Hi all,
I have created a table and when I enter the data,The last entered data should display first.
I tried it by sorting the primary key field but the data entered in this field may not be in some order.so this is not woking.
Please help me what I can do for this .It is very urgent and Plz try to help me soon.
Thanks a million.........in advance..
Regards,
Akanksha
2006 Apr 06 6:48 AM
Hi,
You can read the contents into an internal table and get the last one. But this may cause performance problems if your table is too large.
DATA itab LIKE TABLE OF ztable.
SELECT *
FROM ztable
INTO TABLE itab.
DATA lines TYPE i.
DESCRIBE TABLE itab LINES lines.
READ TABLE itab INDEX lines.
WRITE : itab.
Regards,
Wenceslaus.
2006 Apr 06 7:04 AM
Hi,
Enter the data into an internal table.
describe table itable lines i.
while i not equal to 0
insert data
i = i - 1.
endwhile.
Regards,
Smitha.
2006 Apr 06 7:17 AM
If you talk about a standard internal table, just fill the table using
INSERT <value> INTO int_tab INDEX 1.
Then your last entry is always on top of your internal table.
Regards,
Claus
2006 Apr 06 7:20 AM
2006 Apr 06 7:22 AM
U have to take two more field date and time(i.e. last change)
so that u can get last record depending upon that fields.
U can update that field using table maitiance.
regards
vinod