Prefer Inline CAST
prefer_inline_cast
Description
Inline a CAST helper read only once in the next statement
Extended Information
Requires 7.40 SP02 or above, or ABAP Cloud, and no syntax errors.
Reports DATA(t) = CAST type( source ) when the helper has exactly one read and no other access,
except its declaration write, in the entire syntax scope (including earlier reads in loop bodies and exception handlers).
The immediately following statement must be a plain assignment, an attribute read, a receiver method call,
or a named IMPORTING argument of a functional method call (caller syntax p = t).
Only class/interface CAST targets, simple assignment targets and static access are supported.
For argument uses, the CAST operand must be a plain field chain without calls, the receiver and all
other arguments must be plain variables or literals, and the method signature must be known.
Explicit EXPORTING, IMPORTING and CHANGING sections are not supported.
Objects containing macros or dynamic access are skipped. Field symbols, reference-taking,
pragmas and chained statements are not supported.
Predicates such as IS INITIAL / IS BOUND and removal of statically redundant CASTs are left for a future version.