abaplint / abaplint

Standalone static analysis for ABAP
https://abaplint.org
MIT License
225 stars 70 forks source link

open sql - where position, expect syntax error #3232

Open oblomov-dev opened 7 months ago

oblomov-dev commented 7 months ago

Abaplint is not showing a syntax error, when using open sql instead of abap sql in this situation:

    SELECT field1
      FROM zmy_db_tab
      WHERE id = id
      INTO CORRESPONDING FIELDS OF TABLE lt_db_tab.

The "where" has to be at the end of the select statement.

Found this here: https://github.com/abap2UI5/abap2UI5-downport/blob/cdccb5a64b2f0eecb271cfe33f3ed0411b4e0d3b/src/01/01/z2ui5_cl_util.clas.abap#L87

Its also similar to this one, but not sure if fixing the downporter is worth it, or just showing syntax error as a first step. https://github.com/abaplint/abaplint/issues/2902

larshp commented 7 months ago

the syntax is correct strict sql, but a syntax error on eg. 702?

oblomov-dev commented 7 months ago

No its also on Abap Developer Edition 7.5x (and i guess on every system).

When using syntax with @ it is allowed positioning the "where" before the "into" but without @ syntax you get an error.

image image


Correcting the positon solves the problem:
image
Or of course adding @ but this does not work on lower releases:
image


The annoying follow up problem - as far as i see it I am also not able to create a workaround for the downport by myself: I am forced to use @ on "abap for cloud" and use "where" before "into" (otherwise i will get a syntax error). But i am also forced to avoid @ and use "into" before "where" on lower releases (otherwise i will get a syntax error, too).

Means as long as the downporter does not fix the position i always have to adjust the position in a manual step afterwards, thats why i opened this one, just in case if this is easy solvable: https://github.com/abaplint/abaplint/issues/2902