Skip to content

Omit Unnecessary RETURN Statement ​

WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC NO_UNNEC_RETURNRemote Enabled

Overview ​

Omit unnecessary RETURN at end of routine.

ATC Finding Message: Omit optional RETURN at end of routine; routines return automatically

Rationale ​

A RETURN as the final statement of a method, form, or function changes nothing because the routine ends at ENDMETHOD, ENDFORM, or ENDFUNCTION anyway. It adds a line that implies a special exit and can obscure the real control flow. Remove trailing RETURN statements and keep early returns only where they are meaningful.

Non-Compliant ​

abap
METHOD get_total.
  rv_total = lv_subtotal + lv_tax.
  RETURN.
ENDMETHOD.

Compliant ​

abap
METHOD get_total.
  rv_total = lv_subtotal + lv_tax.
ENDMETHOD.

Automated QuickFix ​

This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):

  1. Position the cursor on the flagged statement.
  2. Press Ctrl + 1 (Quick Assist).
  3. 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 NO_UNNEC_RETURN

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

Technical Details ​

Released under the MIT License.