Update: The question should be withdrawn, the grammar is correct. Apparently, SAP defines ABAP via a grammar, which is then modified by additional rules in plain text. I missed this second part.
I'm looking at the ABAP Keyword Documentation 7.40, SELECT -> SELECT additions. For addition UP TO n ROWS, it gives the example
DATA: wa_scustom TYPE scustom.
SELECT *
FROM scustom
WHERE custtype = 'B'
ORDER BY discount DESCENDING
INTO @wa_scustom
UP TO 3 ROWS.
ENDSELECT.
I verified that code in an SAP 7.40 system and got the error
Row 7: "INTO" is not valid here. '.' is expected
On the other hand, the following code is accepted, although it is not covered by the grammar of SELECT as given in the document: UP TO n ROWS should be after the FROM.
SELECT COUNT(*) UP TO 1 ROWS
FROM MARC
WHERE matnr eq 100.
As we are writing a tool that automatically generates ABAP code, it would be nice to know what's legal and what's not. Is there a "definitive" document? In general, is it worth the try to contact someone at SAP for corrections? (You see, I'm somewhat alien to the SAP world) If yes, who could that be?