cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

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

0 Kudos
6,733

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

Accepted Solutions (1)

Accepted Solutions (1)

philipp_degler
Advisor
Advisor

Hi Naga,

The message SELECT 694 gives a hint that the statement cannot be executed in the ABAP server, i. e. the statement is executed in the database. This hint is given as the execution time might be higher than expected.

Answers (2)

Answers (2)

axel_jebens
Product and Topic Expert
Product and Topic Expert

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
Product and Topic Expert
Product and Topic Expert

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.

BiberM
Active Participant
0 Kudos

Hi.

Isn't that the desired behavior? You run a Select on an internal table. This is pushes to the database and executed with database Operations.

The question is: why is that an ATC error? Doesn't want your Company those means to be used?

0 Kudos

I'm using SAP standard ATC checks, without any variants!!

Does those mean, SAP doesn't want this operation to be performed in such a way.