Question from an ABAP dilettant. I have the following SELECT loop:
SELECT pernr
INTO lv_pernr
FROM pa0000
WHERE NOT ( begda GT lv_qryper_endda OR endda LT lv_qryper_begda )
AND massn <> '10'.
It works fine. Adding a column begda:
SELECT pernr, begda
INTO ( lv_pernr, lv_begda )
FROM pa0000
WHERE NOT ( begda GT lv_qryper_endda OR endda LT lv_qryper_begda )
AND massn <> '10'.
gets me the following error:
Komma ohne vorausgegangenen Doppelpunkt (nach SELECT ?) [comma without preceding colon (after SELECT)].
What did I do wrong?
I got the information how to solve the problem from online resources [https://help.sap.com]. I expected the columns from the SELECT statement to be placed into the listed variables.
You are mixing features of the old and the new (since release 7.40) SELECT syntax.
The old syntax didn't have commas between the fields in the SELECT list, while the new one requires
@in front of each variable.The old syntax is still allowed, but as soon as you are using one feature of the new syntax, the parser switches to the new syntax and expects you to do everything else in the SELECT compliant with it as well.
Your SELECT in the old syntax:
Your SELECT in the new syntax:
By the way, when I tried to reproduce your problem in our system, I got a different error message. Is it possible that you are using a system that is pretty far behind in its version status? Because the error message you posted would only make sense if the system didn't understand the new SQL syntax at all. Which isn't actually that new anymore. (7.40 was released in 2013).