1
votes

I have a table with 3 fields and 10 records. I want to make a SELECT on the 1st field with a WHERE and get the unique values. So if the select return 4 values of the field1 lets say AA, AA, AB, AC, I want to get AA, AB & AC. How I can do it?

Thanks in advance

1
SELECT DISTINCT field1 or GROUP BY field1 - Have a look at the standard SQL - user5653854

1 Answers

4
votes

Remember you should use OpenSQL when working with abap in SAP. A pretty concise guide can be found here: Complete OpenSql statements guide written by Tamás Holics. The statement you are looking for I think is:

SELECT DISTINCT field1 FROM table INTO TABLE itab

This would load all the distinct values from your database table into an internal table for further instructions.