Skip to content

Prefer UNION over UNION ALL ​

WarningPerformance & Database#EC PREF_UNIONRemote Enabled

Overview ​

Prefer UNION over UNION ALL in SQL queries.

ATC Finding Message: Prefer UNION over UNION ALL in SQL queries

Rationale ​

In ABAP SQL queries, prefer UNION to prevent duplicate record processing unless duplicates are explicitly intended and handled.

Non-Compliant ​

abap
SELECT a FROM ztab1 UNION ALL SELECT a FROM ztab2 INTO TABLE @lt_data.

Compliant ​

abap
SELECT a FROM ztab1 UNION SELECT a FROM ztab2 INTO TABLE @lt_data.

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.