2006 Feb 12 1:42 PM
hi!
i have an internal table and i want to get the last record as te first record.
how can i do it and not use the sort command since i cant sort the table i nay way that can give me the last record.
regards
yifat
2006 Feb 12 1:53 PM
Hi Yifat
It's very strange questions?
If you can't sort the table you can't do it, why can't you sort the table?
Max
2006 Feb 12 2:03 PM
hi!
i am using enhancment IQSM0004.
there is an internal table in the component that keeps the serial numbers. every time i add serial number it becomes the last record of the table.
the table is type RIEQUI, but i cant sort it by any field in order to get the last record.
yifat
2006 Feb 12 2:11 PM
Hi
Use an new internal table with the same structure and sort it.
DATA: MY_RIEQUI LIKE STANDARD TABLE OF RIEQUI WITH HEADER LINE.
MY_REQUI[] = S4_IEQUI[].
SORT MY_REQUI BY <FIELD> DESCENDING.
Max
2006 Feb 12 2:52 PM
Hi Yifat,
Try this logic.. this reverses the table without sorting..
data : itab1 like table of <TABLE>,
itab2 like table of <TABLE>,
lin type i.
......
describe table itab1 lines lin.
if lin ne 0.
read table itab1 index lin.
move itab1 to itab2.
lin = lin - 1.
endif.
regards
satesh
2006 Feb 12 3:39 PM
If you just want the last record, simply get the number of records in the internal table using
<i>"DESCRIBE TABLE itab LINES v_number_of_recs."</i>
and then read the last record using index
<i>READ TABLE itab INDEX v_number_of_lines.</i>