Skip to Content
avatar image
Former Member

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

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.

capture.jpg (66.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Nov 25, 2017 at 09:19 PM

    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 ...")

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • avatar image
    Former Member
    Nov 26, 2017 at 03:19 PM
    -1

    Thanks a lot. It works in this way:

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 26, 2017 at 03:51 PM
    -1

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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).

  • Jul 25 at 12:15 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded