SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

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"

Unsecure use of FOR ALL ENTRIES ABAP Code Inspector Check
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_DetailTable
 FOR ALL ENTRIES IN lt_HeaderTable
 WHERE id = lt_HeaderTable-id.
Code

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_DetailTable
  FOR ALL ENTRIES IN lt_HeaderTable
  WHERE id = lt_HeaderTable-id.
ENDIF.
Code

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_DetailTable
 FOR ALL ENTRIES IN lt_HeaderTable
 WHERE id = lt_HeaderTable-id.
Code


SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.