‎2014 Oct 09 11:05 AM
hell all,
in have an internal table consisting of 4 records ..
the internal table has field called PTIME,
now my question is i need to get the record whose PTIME is highest and delete remaining records,
how do i achieve this,...
‎2014 Oct 09 11:09 AM
Hi Vinay
Try this
SORT table BY ptime DESCENDING.
READ TABLE table INTO wa_table INDEX1.
DELETE table WHERE ptime <> wa_table-ptime.
‎2014 Oct 09 11:09 AM
Hi Vinay
Try this
SORT table BY ptime DESCENDING.
READ TABLE table INTO wa_table INDEX1.
DELETE table WHERE ptime <> wa_table-ptime.
‎2014 Oct 09 11:11 AM
Hi,
sort your internal table with PTIME descending,
read table itab1 index 1. "itab1 : internal table
get data into structur / variable. store data into new table.
You can delete table.
‎2014 Oct 09 11:12 AM
declare two workareas wa1 and wa2 of the same type Internal table (PTIME)
loop at itab into wa1.
read table itab into wa2 with index sy-index + 1.
if wa2-PTIME > wa1-PTIME.
PTIME_HIGHEST = wa2-PTIME.
endif.
endloop.
This will give highest PTIME value.
DELETE from itab where PTIME <> PTIME_HIGHEST.
Do hope it helps.
Reward points if helpful
‎2014 Oct 09 11:18 AM
try this
SORT table BY ptime DESCENDING.
DELETE table from 2 .
‎2014 Oct 09 11:22 AM