sy-subrc checked after ASSIGN

 home quick fix  single file   example  edit

subrc_after_assign

Description

Reports a sy-subrc check directly after an ASSIGN, use IS [NOT] ASSIGNED instead

Extended Information

On a 7.40 SP7 system sy-subrc was still 4 after a successful ASSIGN, left over from an earlier
READ TABLE, see https://github.com/abap2UI5/abap2UI5/issues/1937. Current releases set sy-subrc here.
IS [NOT] ASSIGNED asks the field symbol directly and does not depend on the release.

A failed ASSIGN keeps the previous binding of the field symbol. So inside a loop, or when the
field symbol is bound earlier in the same method, IS ASSIGNED is true after a failed ASSIGN.
There, add UNASSIGN before the ASSIGN. The quick fix is only offered when the field symbol
is declared in the method, bound only by this ASSIGN, and the ASSIGN is not in a loop.

ASSIGN COMPONENT ... OF STRUCTURE is not reported.

Default Configuration

Hover to see descriptions, Ctrl+Space for suggestions

Examples