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

ABAP Error Select Comma without preceding colon (after SELECT ?)

former_member601586
Discoverer
10,708

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

1 ACCEPTED SOLUTION
Read only

maheshpalavalli
Active Contributor
6,721

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

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

6 REPLIES 6
Read only

maheshpalavalli
Active Contributor
6,722

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

Read only

6,721

(so Allan has an error in the first select because he uses an ABAP version before 7.40 SP 5)

Read only

6,721

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)

Read only

6,721

@ sandra.rossi I just realised after checking your comment that I answered him incorrectly, instead of telling the issue I told him the difference 😄 thanks for the correction. But atleast the help mentioned that it is supported from the version 7.4 sp5 😄 : D

Read only

0 Likes
6,721
loyd.enochs3 Thanks for sharing the information.. it makes a lot of sense now.
Read only

former_member601586
Discoverer
0 Likes
6,721

Hi Maesh,

Thank you very much for your answer. It's really help me.

Best Regard,

Allan