1

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

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
ekekakos
  • 563
  • 3
  • 20
  • 39
  • `SELECT DISTINCT field1` or `GROUP BY field1` - Have a look at the standard SQL –  Jul 26 '17 at 12:05

1 Answers1

4

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.

Erik
  • 361
  • 5
  • 16