Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

​Bug?! ATC-Check to search for unjustified Select * -> find one, miss one.

joachimrees1
Active Contributor
985

When refactoring some legacy code, I came across this: I have a Select * Statement, and I copied it, so now I have to:

one is inside a LOOP AT t_ekkn INTO

the other inside LOOP AT t_ekkn ASSIGNING FIELD-SYMBOL

The Problem I face: The ATC-Check for 'unjustified' select * only identifies the first one as problematic. It seem to completely ignore the one with the field-symbol:

1 ACCEPTED SOLUTION

510

Hi Joachim Rees,

I agree that this is suprising at the first glance.

The reason is the following:

Both SELECT-statements fill the attribute gs_ekpo and then directly use one field of the result.

After the first SELECT-statement gs_ekpo is overwritten by the next SELECT-statement. Therefore it is clear that no more fields of this entry will be used.

This is the difference to the second SELECT-statement:

After ending the loop the end of the method is reached.

It is possible that gs_ekpo is read by some other method inside oder outside of the class. Therefore it is likely that the finding for this SELECT-statement would be a false-positive.
If you delete one of the selects you will not have any finding for the other one.

Best regards,

Friederike

4 REPLIES 4

Sandra_Rossi
Active Contributor
510

And if you have only the one with the field symbols, you don't have the error?

joachimrees1
Active Contributor
510

Hi sandra.rossi , exactly this is the case, yes:

No finding on select *, although there should be one!

511

Hi Joachim Rees,

I agree that this is suprising at the first glance.

The reason is the following:

Both SELECT-statements fill the attribute gs_ekpo and then directly use one field of the result.

After the first SELECT-statement gs_ekpo is overwritten by the next SELECT-statement. Therefore it is clear that no more fields of this entry will be used.

This is the difference to the second SELECT-statement:

After ending the loop the end of the method is reached.

It is possible that gs_ekpo is read by some other method inside oder outside of the class. Therefore it is likely that the finding for this SELECT-statement would be a false-positive.
If you delete one of the selects you will not have any finding for the other one.

Best regards,

Friederike

0 Kudos
510

Hey Friederike,

thanks for the detailed explanation! Makes sense!