10 Replies Latest reply: May 4, 2010 3:57 PM by Guest RSS

Getting unique values from internal table

Marcin Cholewczuk
Currently Being Moderated

Hi Gurus,

 

From time to time I hit this problem and so far I havn't found any nice solution. I've an internal table with several fields. I would like to get all unique values for one (or several) of these fields. However let say that this table has a lot of entries so making a copy is not an option. Also changing this table in any way is forbiden.

For example for table below I would like to get all unique values for field Number. In this case it would be 1,2,3,4.

Name  | Number |
name1 | 1|
name2 | 2|
name3 | 2|
name4 | 3|
name5 | 4|
name5 | 3|

Can anyone propose me better solution than going in the loop through all entries in table? Maybe there is some ABAP functionality that I don't know about?

 

BR

Marcin Cholewczuk

Actions