SAP / SAP/code-pal-for-abap

Nesting Depth: Wrong SQL Case handling

Open
#622 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
ABAP
Stars
435
Forks
77
PR merge metrics
No merged PRs in 30d

Description

Hello,
In y_check_max_nesting_depth CASEs in SQL statements are not counted correctly. In the example, the method is shown with depth 7. As far as I understand the check logic, the "END" after the "SQL-CASE" is not respected.
Regards, Günter

method test_depth_7.
select from mara
fields matnr,
case mtart when 'QBMI' then 'X' end as f1,
case mtart when 'QBMU' then 'X' end as f2,
case mtart when 'QFHM' then 'X' end as f3,
case mtart when 'QPRO' then 'X' end as f4,
case mtart when 'QBMU' then 'X' end as f5,
case mtart when 'QBMV' then 'X' end as f6
where matnr = '4711'
into table @data(tmara).
if sy-subrc is initial.
sy-tvar0 = lines( tmara ).
endif.
endmethod.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported depth-7 example in method test_depth_7 and trace the y_check_max_nesting_depth logic around SQL CASE and END handling. Done means the CASE expressions are counted correctly and the example produces the expected nesting depth, with a regression test covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.