Skip to content

Prefer CASE to ELSE IF check is not correct #156

@macemmi

Description

@macemmi

You can do a CASE only if in all ELSE branches the same variable is used. We get findings for code like this:

IF ls_posting-betrw > 0.
  ls_posting-shkzg = 'S'.
ELSEIF ls_posting-betrh > 0.
  ls_posting-shkzg = 'S'.
ELSEIF ls_posting-betr2 > 0.
  ls_posting-shkzg = 'S'.
ELSEIF ls_posting-betr3 > 0.
  ls_posting-shkzg = 'S'.
ELSE.
  ls_posting-shkzg = 'H'.
ENDIF.

how can this be replaced by a CASE?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working correctly

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions