ABAPers love ‘FOR ALL ENTRIES’ because it is an easy frill-free way to fetch records from one table based on data in another but surprisingly lots of them use the keyword without enough caution. Sometimes it works because driver internal table based on which search happens has a small set of unique data. However, sometimes things are on the other side.

SELECT <fields> FROM <table> INTO <receiving_table>

FOR ALL ENTRIES IN <driver_table>

WHERE <clauses>.

Following are the main conditions which need to be taken into account while querying –

  • <driver_table> should not be empty. It will result in population of all records from <table> in to <receiving_table>
  • <driver_table> should not have duplicate entries. It will lead to repeated entries in <receiving_table>
  • The entries in <receiving_table> are intended to have unique records. It is advisable to have the entire primary key in the select clause and primary key set in where clause.

For all entries pose a performance issue to the system. It should be avoided as much as possible. The best approach is to avoid it and use JOIN instead. Joins can make more precise usage of SAP DBA capabilities. Usually, the impact is not noticeable while operating on the smaller set of data but when it comes to larger volumes, the impact is significant.