Skip to content

Avoid SELECT * Queries ​

WarningPerformance & Database#EC SELECT_STARRemote Enabled

Overview ​

Select performance (Avoid SELECT * and SELECT ... ENDSELECT).

ATC Finding Messages:

  • Avoid SELECT *; specify required columns explicitly
  • Avoid SELECT ... ENDSELECT loop; use array fetch INTO TABLE

Rationale ​

SELECT * reads every column even when only a few fields are used, increasing network traffic and memory consumption. It also prevents efficient covering-index access and makes the code break when the table structure changes. List the required columns explicitly so the query stays stable and efficient.

Non-Compliant ​

abap
SELECT * FROM /dmo/customer WHERE country = 'DE' INTO TABLE @lt_customers.

Compliant ​

abap
SELECT customer_id, first_name, last_name
  FROM /dmo/customer
  WHERE country = 'DE'
  INTO TABLE @lt_customers.

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault Value
CHECK_SELECT_STARBooleantrue
CHECK_ENDSELECTBooleantrue

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC SELECT_STAR

" SAP CI_ prefix format:
... "#EC CI_SELECT_STAR

Technical Details ​

Released under the MIT License.