Skip to content

Report Ignored PREFERRED PARAMETER When Non-Optional Parameters Exist ​

WarningClean ABAP & Modern Syntax#EC NO_IGN_PREF_PARAMRemote Enabled✏️ Edit Rule on GitHub

Overview ​

Report ignored PREFERRED PARAMETER addition.

ATC Finding Message: PREFERRED PARAMETER is ignored when mandatory parameters exist

Rationale ​

In ABAP methods, PREFERRED PARAMETER specifies the default importing parameter for positional calls. However, according to SAP ABAP rules, PREFERRED PARAMETER is ignored if there are any mandatory (non-optional) importing parameters in the signature. Such declarations mislead developers into assuming positional calls will work when in fact they are invalid or ignored.

Non-Compliant ​

abap
METHODS get_data
  IMPORTING
    iv_req TYPE i
    iv_opt TYPE i OPTIONAL
  PREFERRED PARAMETER iv_req.

Compliant ​

abap
METHODS get_data
  IMPORTING
    iv_req TYPE i
    iv_opt TYPE i OPTIONAL.

Suppression ​

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

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

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

Technical Details ​

Community & Feedback ​

Released under the MIT License.