Avoid Obsolete MESSAGE ... RAISING in Methods
WarningAnti-Patterns & Bad Practices#EC NO_MSG_RAISINGRemote Enabled
Overview
Avoid MESSAGE ... RAISING; use class-based exceptions.
ATC Finding Message:
Avoid obsolete MESSAGE ... RAISING; raise class-based exceptions
Rationale
MESSAGE ... RAISING mixes UI message output with exception propagation and depends on classic exception numbers. It separates poorly from business logic and is unsuitable for APIs that should return typed failures. Raise a class-based exception that references the message class text instead.
Non-Compliant
abap
MESSAGE e002(zorder) RAISING not_found.Compliant
abap
RAISE EXCEPTION NEW cx_order_not_found( textid = cx_order_not_found=>c_order_missing ).Suppression
To suppress findings for this rule, append the pseudo-comment to the statement:
abap
" Standard pseudo-comment:
... "#EC NO_MSG_RAISING
" SAP CI_ prefix format:
... "#EC CI_NO_MSG_RAISINGRelated Rules
- Use a message class (SE91) instead of inline message text —
#EC PREF_MSG_CLS - Avoid Obsolete String and POSIX Regex Statements —
#EC NO_OBS_STRINGS - Avoid Concatenating Adjacent String Literals —
#EC NO_USELESS_CONCAT
Technical Details
- Native ATC Class:
ZCL_SKYLINT_NO_MSG_RAISING - Implementation File: zcl_skylint_no_msg_raising.clas.abap