abap-cleaner
abap-cleaner copied to clipboard
Unused variables in iteration expressions
it would be great if the tool would issue warnings in iteration expressions if variable is assigned but never used. For example:
DATA: lt_where_clause TYPE string_table,
lv_where_clause TYPE string.
lt_where_clause = VALUE string_table( ( | ACDOCA~RBUKRS EQ @MV_BUKRS| )
( |AND ACDOCA~GJAHR EQ @MV_GJAHR| ) ).
lv_where_clause = REDUCE #( INIT str TYPE string FOR lv_where IN lt_where_clause NEXT str = str && ` ` ).
Expecting:
" TODO: variable "lv_where" is assigned but never used;
lv_where_clause = REDUCE #( INIT str TYPE string FOR lv_where IN lt_where_clause NEXT str = str && ` ` ).
Hi Segurega,
good point, thanks for the example! I will have to check how this could be implemented, given the limited scope of these variables in iteration expressions.
Kind regards, Jörg-Michael