-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
" TODO: variable is assigned but never used (ABAP cleaner) after checking whether a database entry exists #38
Comments
Hi JanisBur, I think the best way to suppress this would be to add a Kind regards, |
This wasn't clear to me. I really like how it even automatically removes its own comment. How about adding examples to the rule to demonstrate the use of |
@JanisBur For the existence check I usually do this instead: SELECT COUNT(*)
FROM pa0000
WHERE begda <= @sy-datum
AND endda >= @sy-datum.
IF sy-dbcnt >= 1.
" further processing
ENDIF. Or even this: SELECT SINGLE @abap_true
FROM pa0000
WHERE begda <= @sy-datum
AND endda >= @sy-datum
INTO @DATA(exists).
IF exists = abap_true.
" further processing
ENDIF. Do note using COUNT bypasses the table buffer implicitly compared to the other solutions. |
Hi @ConjuringCoffee,
Actually there is already a tiny, inconspicuous line in the "Delete unused variables" examples … … but happy to add some more comment there to explain it! Anyway you could often continue the "no defect" label with "… but apparently not intuitive and documented well enough" :-) So reopening this to make sure I don't forget it. Kind regards, |
Hi JanisBur and @ConjuringCoffee, in version 1.3.0, the example of the "Delete unused variables" rule is now enhanced to make the effect of the Kind regards, |
Sometimes I just want check, whether a database entry exists using the sy-subrc variable. I am forced to select the data into some table/structure, because a "SELECT" without "INTO" is not possible.
`" TODO: variable is assigned but never used (ABAP cleaner)
SELECT SINGLE * FROM pa0000 INTO @DaTa(ls_dummy) WHERE begda <= @sy-datum
AND endda >= @sy-datum.
IF sy-subrc = 0.
" further processing
ENDIF.`
Would it be possible to switch the message "TODO: variable is assigned but never used (ABAP cleaner)" off in such cases?
The text was updated successfully, but these errors were encountered: