Application Development and Automation 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: 
Read only

SAP Query - SQ02 custom fields - error with group by statement

Former Member
0 Likes
9,925

Hello,

I have problem during checking below code. Error msg like on below screen. I have checked 'fixed point arithmetic' checkbox so I don't have any idea how to solve this issue. Thank you in advance for help.

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
4,113

Make sure that the variable SCANNED is of type I (integer). I guess that this message occurs when you use a variable of type P with number of decimals greater than zero (syntax error message "This Open SQL statement uses additions that can only be used when the fixed point arithmetic flag is activated (such as CASE expressions or host variables in ...")

7 REPLIES 7
Read only

Sandra_Rossi
Active Contributor
0 Likes
4,114

Make sure that the variable SCANNED is of type I (integer). I guess that this message occurs when you use a variable of type P with number of decimals greater than zero (syntax error message "This Open SQL statement uses additions that can only be used when the fixed point arithmetic flag is activated (such as CASE expressions or host variables in ...")

Read only

0 Likes
4,113

unfortunately I have changed on Integer and it still doesn't work.

Read only

4,113

Then maybe the form is only valid for the strict SQL syntax, so you should add a @ in front of variables ("host variables") i.e. use INTO @ SCANNED . Or do SELECT COUNT(*) INTO scanned FROM ... to use the non-strict syntax.

Read only

Former Member
0 Likes
4,113

Thanks a lot. It works in this way:

So the solution is to change data type for Integer(I) and write code as follow.

Read only

Former Member
0 Likes
4,113

Aff, I have antoher problem during group by... I was trying in many ways, with INTO @variable, @var... and with INTO at the end of select statement but it doesn't work. I would be appreciate if you have some tips. Thank you in advance.

Read only

4,113

I understand that the syntax is complex, and you should definitely read the ABAP documentation: SELECT. Look at the many examples, that will help you understand how "Open SQL" (the SQL in ABAP) works.

Using a comma for separating fields is allowed only in "strict syntax". The strict syntax means that the variables must be written as host variables (with leading @ ).

If the SELECT returns several lines then you must store the result into an internal table (INTO TABLE).

Read only

Former Member
0 Likes
4,113

Hi,

Please replace COUNT(*) by COUNT ( * ). If you are selecting multiple columns, then move it to variables within brackets ( v1, v2 ) or use internal table for storing it.