Skip to Content
-1
Dec 12, 2018 at 06:17 AM

Find duplicate words in string.

1303 Views Last edit Dec 11, 2018 at 01:00 PM 2 rev

Hello.

For example, I have a string

my string = 'morning day evening day hello age day morning'

I need to write words that occurs more than 1 time. So for this example answer is:

morning, day

How can I solve this in abap?

Firstly I split string into table.

DATA itab TYPE TABLE OF string.
SPLIT my_string AT SPACE INTO itab.

So I have table itab with my words.

Now I need to select rows that dont repeat.

In SQL its easy to use

select * from itab groupby field_name having count(*) > 1

But how can I do that in ABAP?