2020 Dec 22 8:54 AM
Hi,
i want to delete the smallest values (NR) for the associated text (TEXT) from my internal table.
Let's say my internal table looks like that:
and that's what I want to have.
Does somebody has any idea?
Thanks!
2020 Dec 22 4:16 PM
Haven't tried, but I'd think it should work.
SORT itab BY TEXT ASCENDING NR DESCENDING.
DELETE ADJACENT DUPLICATES FROM itab COMPARING text.
2020 Dec 22 9:17 AM
2020 Dec 22 9:20 AM
2020 Dec 22 9:31 AM
the nr's data and text's data none of them are corresponding.
what's your delete rule?
your above say and your photo is none of them are corresponding.
2020 Dec 22 10:56 AM
It looks to me that you want to keep the highest number, not delete the lowest.
This will work, but it may not be the most efficient.
DATA itab TYPE STANDARD TABLE OF ty_of_itab_line WITH DEFAULT KEY.
...
SORT itab BY TEXT ASCENDING NR DESCENDING.
LOOP AT itab ASSIGNING FIELD-SYMBOL(<wa>).
DATA output TYPE HASHED TABLE OF ty_of_itab_line WITH UNIQUE KEY TEXT.
INSERT <wa> INTO TABLE output.
ENDLOOP.
2020 Dec 22 4:16 PM
Haven't tried, but I'd think it should work.
SORT itab BY TEXT ASCENDING NR DESCENDING.
DELETE ADJACENT DUPLICATES FROM itab COMPARING text.
2020 Dec 22 7:01 PM