Disadvantages of Forall entries


2 Tips to avoid most common bugs related to "FOR ALL ENTRIES" :

This selection contains 2 drawbacks:


1. As mentioned in
SAP HELP documentation, "FOR ALL ENTRIES" behaves like a "SELECT DISTINCT" statement. That means all duplicates are removed. As a consequence, some relevant entries will not appear in the selection hit list!

2. If the table used in the WHERE clause is empty (this is the table LT_OBJNR in the statement above), all rows of the source table will be selected. You guess that it causes important and unnecessary performance degradation, especially for huge tables like COSP, although no result should be returned for this statement!!!

Next are 2 simple tips to avoid these problems:

1. Declare all primary keys of your database table in your select statement. It ensures that you have no duplicates in you hit list

2. Check that the table used in the "For all entries" statement is not empty. This avoids executing the select statement if no result is expected.

 

 

Comments

Popular posts from this blog

SAP ABAP-Internal Table Operations and Example Program

HR ABAP Interview Questions and Answers

BDC (Batch Data Communication) - SAP ABAP