07-17-2015 12:06 PM
Hi Guys,
Quick question, I have an internal table where fields are F1, F2, F3, F4, none of them are key fields. If I use this internal table in a FOR ALL ENTRIES statement and in the WHERE condition I use F1 and F2, does this automatically delete duplicates comparing F1 and F2 in ABAP? Or are there no duplicate entries deleted? Would it help the SQL statement if I delete adjacent entries comparing F1 and F2 programatically in ABAP?
Thanks,
Jack
07-17-2015 12:21 PM
Acording to help in ABAP Keyword Documentation :
Notes
The duplicated entries are deleted in for all entries...
Regards..
07-17-2015 12:41 PM
If you decided to go with FAE not with join then it's better for select statement to deleted duplicates before passing table to select. Also sort the table by the key used in where clause and use hints if possible (in case of oracle for example) to lower the number of generated selects.
07-17-2015 1:36 PM
This is standard behavior. To avoid this from happening, you need to select all the key fields from the table, when you use FAE in the select statement.
Thanks,
Juwin
07-20-2015 6:37 AM
Hi Jack,
Even I faced similar issue recently.
When we use FOR ALL ENTRIES, the result set of records will be unique.
Example if we have two records in table 1 2 3 4 and 1 2 3 4, our internal table will have only 1 2 3 4.
If any single field of the result varies the record will be retained in the internal table.
Hence it is always suggested to fetch the Key Fields in the result set while using FAE.
Thanks and Regards,
Vinay Mutt