Prevent Empty FOR ALL ENTRIES Inquiries
WarningPerformance & DatabaseQuickFix Ready#EC EMPTY_FAERemote Enabled
Overview
Unsecure FOR ALL ENTRIES (Missing empty itab check).
ATC Finding Message:
FOR ALL ENTRIES without preceding IS NOT INITIAL check causes full table scan
Rationale
When the driver table of a FOR ALL ENTRIES query is empty, ABAP SQL drops the WHERE condition and reads the entire database table. That can cause timeouts, huge memory consumption, and unintended data exposure. Guard the statement with an IS NOT INITIAL check before executing it.
Non-Compliant
abap
SELECT customer_id FROM /dmo/customer
FOR ALL ENTRIES IN @lt_orders
WHERE customer_id = @lt_orders-customer_id
INTO TABLE @lt_customer_ids.Compliant
abap
IF lt_orders IS NOT INITIAL.
SELECT customer_id FROM /dmo/customer
FOR ALL ENTRIES IN @lt_orders
WHERE customer_id = @lt_orders-customer_id
INTO TABLE @lt_customer_ids.
ENDIF.Automated QuickFix
This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):
- Position the cursor on the flagged statement.
- Press Ctrl + 1 (Quick Assist).
- Select the automated refactoring to apply the clean syntax immediately.
Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC EMPTY_FAE
" SAP CI_ prefix format:
... "#EC CI_EMPTY_FAETechnical Details
- Native ATC Class:
ZCL_SKYLINT_NO_EMPTY_FAE - Implementation File: zcl_skylint_no_empty_fae.clas.abap