A date alone may not define a unique work order
Two dispatches can have the same due date. If a user or downstream step needs a predictable first row, add a tie-breaker such as the unique dispatch ID.
Sort, then access by index
SORT dispatches BY due_date ASCENDING dispatch_id ASCENDING.
READ TABLE dispatches INDEX 1 INTO DATA(first_dispatch).
Index access is available for standard and sorted tables, not hashed tables. The secondary sort component makes the intended order deterministic for equal due dates. It does not imply the original input order is preserved.
Sort only when the workflow needs this ordering. A sorted table keeps a key order as rows are added; sorting a standard table is an explicit operation. If the collection is large and repeatedly needs a specific key order, consider whether an appropriate sorted table/key is a better design.
Sources
Developer practice · ABAP
Practice: order overdue dispatches consistently
Sort dispatches by due date ascending, then by dispatch ID ascending, and read the first row.
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
TYPES: BEGIN OF ty_dispatch,
dispatch_id TYPE string,
due_date TYPE d,
END OF ty_dispatch.
TYPES ty_dispatches TYPE STANDARD TABLE OF ty_dispatch WITH EMPTY KEY.
DATA(dispatches) = VALUE ty_dispatches( ( dispatch_id = 'D-1602' due_date = '20261104' ) ( dispatch_id = 'D-1601' due_date = '20261104' ) ).
SORT dispatches BY due_date ASCENDING dispatch_id ASCENDING.
READ TABLE dispatches INDEX 1 INTO DATA(first_dispatch).
DATA(result) = first_dispatch-dispatch_id.
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.