‎2010 Apr 23 7:31 AM
Hi Experts,
I want to take the maximum amount(stprs) according to my stlnr value. That means in my internal table having lots of entries. its contain stlnr and stprs. i want to pick only the maximum stprs value for each and every stlnr.
my internal table like below, for example from the internal table i required 17238 and its 0.32 , 17210 and its 0.21, 162178 and its 6.21.
STLNR MATNR STPRS
17238 1021208 0.01
17238 1339526 0.32
15028 1330026 5
17210 7376973 0.21
17210 7379263 0.01
162178 1574231 3.21
162178 814661 6.21
Gowri sankar
‎2010 Apr 23 7:35 AM
Try this code:
SORT ITAB BY STLNR STPRS DESCENDING.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING STLNR.Resulting ITAB has the required records.
‎2010 Apr 23 7:35 AM
Try this code:
SORT ITAB BY STLNR STPRS DESCENDING.
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING STLNR.Resulting ITAB has the required records.
‎2010 Apr 23 7:40 AM
Hi,
Data:
flag type i.
sort t_tab by stlnr STPRS descending.
Loop at t_tab into fs_tab.
at new of stlnr.
flag = 1.
endat.
if flag = 0.
delete t_tab index sy-tabix.
endif.
flag = 0.
endloop.
If stlnr is first field in the table use as above at new or replace that with
on cgange ....endon statement.
Regards and Best wishes.
‎2010 Apr 23 7:46 AM
Hi,
SORT ITAB BY STLNR ASCENDING STPRS DESCENDING.
AND
Read itab for first STLNR in each STLNR.
Regards,
Moon
‎2010 Apr 23 7:48 AM
hi
if you want to fetch max amount records from a database table
then
select STLNR MATNR STPRS from (table name) into corresponding fields of table (internal table) order by STPRS descending.
‎2010 Apr 23 8:08 AM
Hi,
SORT ITAB BY STLNR STPRS DESCENDING.
READ TABLE ITAB INDEX 1.
WRITE:/ ITAB-STPRS.
Regards,
Raj.