Match the target shape to the number of rows
A query can return zero, one, or many rows. Choose a target that communicates which case your program expects.
Many rows: INTO TABLE
SELECT FROM zi_dispatch_order
FIELDS dispatchorder, status
WHERE status = 'OPEN'
INTO TABLE @DATA(orders).
The internal table receives all matching rows. It can be empty, which is a normal result and should be handled intentionally.
One row: INTO
For a source/key combination that is guaranteed unique, an ordinary target can receive one row:
SELECT SINGLE FROM zi_dispatch_order
FIELDS dispatchorder, status
WHERE dispatchorder = @order_id
INTO @DATA(order).
Use SINGLE when the predicate identifies at most one row, usually through a key. For a query where any first matching row would be acceptable, make row selection deterministic with an ordering strategy supported by the release rather than assuming an arbitrary row is meaningful. Handle the no-match case.
Other target forms
An explicit work area target and a previously declared internal table can be clearer in older or heavily typed code. Inline declaration is concise when the target type is evident. Choose the form your team can maintain and your release supports.
Practice
The task may return many rows: complete INTO TABLE @DATA(orders) and set result to the row count. The checker does not run the query or validate the actual data.
Sources
Version note: SELECT SINGLE, inline targets, and modern field-list syntax have release/language-version requirements.
Developer practice · ABAP
Practice: choose a single-row or table result
The report needs many matching orders. Use INTO TABLE with an inline target, then calculate its row count.
This choice changes the output pattern checked here: WRITE belongs in a classic executable report, while out->write( ) uses the supplied output reference in an ABAP Cloud class-run method. It does not switch the language version of the other code; check release and API availability in your target system.
Complete the task and include the output statement shown for your selected environment. Variable names can differ if you use them consistently. This browser checker checks structure only; it does not compile or run ABAP.
0 required structures detected · 0 checks
Write your solution, then check its structure.
One possible solution
SELECT FROM zi_dispatch_order
FIELDS dispatchorder, status
WHERE status = 'OPEN'
INTO TABLE @DATA(orders).
DATA(result) = lines( orders ).
WRITE result.out->write( result ).These are context-specific output examples. In your own program, use the result variable from your solution and the output mechanism available in that program.