title: ABAP 7.40 SELECT .. ENDSELECT UP TO n ROWS syntax?
body: <p>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. </p>
  
  <hr>
  
  <p>I'm looking at the ABAP Keyword Documentation 7.40, SELECT -> SELECT additions.  For addition UP TO n ROWS, it gives the example</p>
  
  <pre><code>DATA: wa_scustom TYPE scustom.
  
  SELECT *
         FROM scustom
         WHERE custtype = 'B'
         ORDER BY discount DESCENDING
         INTO @wa_scustom
         UP TO 3 ROWS.
  ENDSELECT. 
  </code></pre>
  
  <p>I verified that code in an SAP 7.40 system and got the error </p>
  
  <blockquote>
    <p>Row 7: "INTO" is not valid here. '.' is expected </p>
  </blockquote>
  
  <p>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.</p>
  
  <pre><code>SELECT COUNT(*) UP TO 1 ROWS
      FROM MARC
      WHERE matnr eq 100.
  </code></pre>
  
  <p>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? </p>