2019 Jan 02 2:31 PM
Hello,
I try to learn ABAP because I have got a small program to build.
I bought a book inside when they write a Select instruction:
Select Col1, Col2, Col3 FROM MyTable Into @MyVariable.
I don't why I have got this message : Select Comma without preceding colon (after SELECT ?)
But if I write without Comma and '@', it is working like
Select Col1 Col2 Col3 FROM MyTable Into MyVariable.
I don't know Why? And It is a problem because after I have less possibilty?
Thanks for your response.
Kind Regard,
Allan
2019 Jan 02 3:11 PM
Hi Allan,
There is something called strict mode in abap, which will be applied to all open SQL statements if certain conditions matches.
So in your case, the first select query columns are seperated by the comma, for which the strict mode is automatically added and you need to use @ ..
But in your 2nd select, there are no commas and therefore the strict mode is not applied.. so you don't need to use @
For more information, see the help below.
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenopensql_strict_mode_740_sp05.htm
BR,
Mahesh
Hi Allan,
There is something called strict mode in abap, which will be applied to all open SQL statements if certain conditions matches.
So in your case, the first select query columns are seperated by the comma, for which the strict mode is automatically added and you need to use @ ..
But in your 2nd select, there are no commas and therefore the strict mode is not applied.. so you don't need to use @
For more information, see the help below.
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenopensql_strict_mode_740_sp05.htm
BR,
Mahesh
2019 Jan 02 3:11 PM
Hi Allan,
There is something called strict mode in abap, which will be applied to all open SQL statements if certain conditions matches.
So in your case, the first select query columns are seperated by the comma, for which the strict mode is automatically added and you need to use @ ..
But in your 2nd select, there are no commas and therefore the strict mode is not applied.. so you don't need to use @
For more information, see the help below.
https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenopensql_strict_mode_740_sp05.htm
BR,
Mahesh
2019 Jan 02 3:22 PM
(so Allan has an error in the first select because he uses an ABAP version before 7.40 SP 5)
2019 Jan 02 3:44 PM
As an historical ABAP aside, the language allows "chaining" of ABAP statements using a colon after the keyword and commas separating the target fields or phrases. Examples include:
WRITE: sflight-carrid, sflight-connid, sflight-fldate.
or
ADD 1 TO: var1, var2, var3.
The "comma without preceding colon" is the standard syntax error that would most commonly be encountered when the commas had been put in place, but the colon had been omitted; i.e., a typo 🙂
Commas have been allowed in SELECT statements in older versions, but only within parentheses, such as:
SELECT (carrid, connid, fldate) FROM sflight INTO.........
I would suspect that the syntax checker (being backward-compatible) is finding the commas and fails when looking for the colon that is related to the "chain" statement that the commas imply after first looking for the parentheses and not finding them.
But that is just a guess.......
Regards,
Loyd Enochs (who taught ABAP from version 3.0d to 4.6c)
2019 Jan 02 3:52 PM
2019 Jan 02 3:55 PM
2019 Jan 03 8:47 AM
Hi Maesh,
Thank you very much for your answer. It's really help me.
Best Regard,
Allan
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |