Filter rows before grouping and groups after aggregation
The dispatch lead wants each carrier with at least five open orders. First remove non-open rows, then group the remaining data by carrier, then filter the groups by their count.
WHERE filters source rows
WHERE status = 'OPEN'
This runs before the aggregate is calculated. It answers: which source rows should participate?
GROUP BY and HAVING operate on groups
GROUP BY carriercode
HAVING COUNT( * ) >= 5
GROUP BY produces one result group per carrier. HAVING retains groups whose aggregate count meets the threshold. In general, non-aggregated selected fields must align with the grouping rules.
Practice
Complete the row filter, grouping, aggregate filter, and table target. result receives the number of carrier groups. The structural checker does not query any database.
Sources
Version note: Aggregate and grouping restrictions can vary by source and ABAP release; validate syntax and selected-field rules.
Developer practice · ABAP
Practice: find carriers with many open orders
Group open orders by carrier and keep only groups with at least five rows using HAVING.
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 carriercode, COUNT( * ) AS order_count
WHERE status = 'OPEN'
GROUP BY carriercode
HAVING COUNT( * ) >= 5
INTO TABLE @DATA(carrier_counts).
DATA(result) = lines( carrier_counts ).
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.