2008 Apr 24 11:44 AM
Hi All,
I want to fetch some records from a database table which are the latest entries. How can I fetch these records?
Regards,
Jeetu
2008 Apr 24 12:40 PM
Hi,
Method 1:
1) check whether you have DATE field in your database table.
2) fetch all records into your internal table.
3) sort internal table by date descending.
4) you will get the latest records on top in your internal table.
Method 2:
If you want only latest 10 records from your internal table
data: begin of itab occurs 10,
Declare your fields here make sure that you have DATE field in your internal table.
end of itab.
Select <fields> from <database table> into itab.
append itab sorted by date.
endselect.
note: Date should be one of teh fields of itab.
Hi All,
I want to fetch some records from a database table which are the latest entries. How can I fetch these records?
Regards,
Jeetu
2008 Apr 24 11:47 AM
hi first fetch all data into internl table than loop on itab and get latest records
you can use
loop at itab from 50.
.......
......
endloop.
it will fetch latest record from 50th record.
reward if useful
2008 Apr 24 11:52 AM
hi,
do this way ...
* To fetch the latest record
select max( field ) from <Table> into itab where <conditions>.
2008 Apr 24 12:40 PM
Hi,
Method 1:
1) check whether you have DATE field in your database table.
2) fetch all records into your internal table.
3) sort internal table by date descending.
4) you will get the latest records on top in your internal table.
Method 2:
If you want only latest 10 records from your internal table
data: begin of itab occurs 10,
Declare your fields here make sure that you have DATE field in your internal table.
end of itab.
Select <fields> from <database table> into itab.
append itab sorted by date.
endselect.
note: Date should be one of teh fields of itab.