ABAP SELECT statement within SAP - Example ABAP code to demonstrate the SELECT command. The ABAP SELECT statement is the most fundamental function of writing ABAP programs within SAP, allowing the retrieval of data from SAP database tables. Below are a few examples of the various ways of selecting data ready for processing. Select-Options functionality in SAP ABAP. When ever we declare Select-Options, an internal table will be created with the following fields. SIGN: This field contains I or E, where I stands for an inclusive (Include that value) and E stands for exclusive (Exclude that values), default value is I. OPTIONS: This field can accept values BT.
How can I retrieve the distinct values from an internal table?
Now, I am using the SORT and DELETE ADJACENT DUPLICATES to get what I need, but I would like to improve these kind of selections.
JaggerTo get distinct EBELN
what you need to do is simply
That's all it takes.
JaggerJaggerAn option would be to create a loop and select when the values change. For this to work as you mention, the table must be sorted by the field you are looking for.
Another option is to use the same but with a AT. In order for AT to work, the values from the field select in AT declaration to the left of the table must be the same.