Code Inspector: Unsecure use of FOR ALL ENTRIES

Unsecure use of FOR ALL ENTRIES is a warning in Code Inspector results. ABAP programmers use For All Entries in SELECT statements to join SAP database tables to internal tables.
In case the ABAP internal table is initial, all data from SAP transparent table id returned by the SELECT statement causing to read all data in the database table ending with performance problems.

When I executed CHECK OBJECTS command on SE09 transaction for a transport request task, under Code Inspector Checks I got following warning message "Unsecure use of FOR ALL ENTRIES"

Code Inspector Check result: Unsecure use of FOR ALL ENTRIES in ABAP SELECT statements

Drill down on the code inspector till you get the error and double click on the error item where the ABAP code line is indicated.
Double click will redirect the ABAP developer to the code line where the ABAP Code Inspector is giving an error or giving warning about.

Here is a sample ABAP Select statement where ABAP internal table is used right after "For All Entries In"

SELECT * FROM /KODY/SD_TABLE
INTO TABLE lt_DetailTableFOR ALL ENTRIES IN lt_HeaderTable
WHERE id = lt_HeaderTable-id.

As a solution to get rid of possible performance problems that might happen if the internal table is empty or initial, place the SELECT command in an IF clause which checks the ABAP internal table is not initial

IF lt_HeaderTable IS NOT INITIAL.
SELECT * FROM /KODY/SD_TABLE
INTO TABLE lt_DetailTableFOR ALL ENTRIES IN lt_HeaderTable
WHERE id = lt_HeaderTable-id.
ENDIF.

Or a CHECK statement can be used as well according to your coding. Please note that if CHECK command fails to return true, the following code after CHECK is not executed.

CHECK lt_HeaderTable IS NOT INITIAL.
SELECT * FROM /KODY/SD_TABLE
INTO TABLE lt_DetailTableFOR ALL ENTRIES IN lt_HeaderTable
WHERE id = lt_HeaderTable-id.