cancel
Showing results for 
Search instead for 
Did you mean: 

ATC Check error - The SELECT command is executed on the database (SELECT 694)

0 Kudos

Hello All,

I wrote a select statement over internal table, and when performed the ATC check, I got the error as 'The SELECT command is executed on the database.'(SELECT 694). Any inputs on why this error is coming up?

No pragma to suppress the error.

Following is the code that was written:

select a, count ( a )

as lv_count

from @lt_internaltable as lt

group by a

into table @data(lt_Tab2).

Thanks and Regards,

Naga

shantraj
Explorer
0 Kudos

you can loop on internal table and then increment the lv_value on each iteration and fill other details as per further requirement in lt_tab2 internal table.

or put a select condition on DB table instead of internal table.

View Entire Topic
axel_jebens
Explorer

The message is a syntax warning which is independent from ATC. ATC displays syntax warnings. When you deal with internal data which is on the application server, it is probably better not to push it in the database first and then process it there. This is what's happening here. There are aggregation techniques in ABAP that can be used, e.g. LOOP AT ... GROUP BY..., SORT, ...
You have to decide whether you want to save development time and leave it like it is (then use the pragma ##ITAB_DB_SELECT or an ATC exemption) or rethink the code which may take some time. But maybe it is not critical at all for performance because it is executed only once.

0 Kudos

Yes, we have the option to achieve the same using loop at, and sum, but I was looking to make the code look simpler:)

Wondering why the select on @itab was introduced, when the system throws a syntax check warning..

axel_jebens
Explorer

The SELECT on an internal table is very useful für JOIN statements, and it replaces the FOR ALL ENTRIES CLAUSE. It is in general faster and much more flexible. If a list is needed for data on the database, you have to push down the information. But if you don't, it is better to not use it, but of cause it depends on the individual case.

Code stability and simplicity are other criteria. From my personal perspective, there is never a general good or bad. You can suppress the warning, but in general it tells you that this can be optimized.