Ansicht
Dokumentation

ABAPWITH_MAINQUERY - WITH MAINQUERY

ABAPWITH_MAINQUERY - WITH MAINQUERY

ABAP Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

WITH, mainquery_clauses

... $[SINGLE $[FOR UPDATE$]$]
    ${ FROM source
      FIELDS select_clause $}
  $| ${ select_clause
      FROM source $}
    $[WHERE sql_cond$]
    $[GROUP BY group$] $[HAVING group_cond$]
    $[ORDER BY sort_key$]
    $[db_hints$] ...


Effect

Possible clauses and additions of the main query of a WITH statement. All clauses are possible as in a standalone SELECT statement except for FOR ALL ENTRIES, and they have the same effect. In particular, a SELECT loop is opened under the same circumstances as in the standalone SELECT statement. In this case, this loop must be closed with ENDWITH.

The result set of a common table expression does not have a client column, which means that the FROM clause of the main query cannot contain the addition USING for switching or the obsolete addition CLIENT SPECIFIED for disabling implicit client handling.

If an internal table @itab with elementary row type is accessed in the FROM clause of a common table expression, the SELECT list cannot be * or contain data_source~*.

Example

The example shows a WITH statement whose main query creates a tabular result set. Since the example writes to an internal table itab, no SELECT loop is opened.






BAL_S_LOG - Application Log: Log header data   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 3166 Date: 20240511 Time: 052631     sap01-206 ( 42 ms )