Don’t let the previous row become the next row
When a work area is reused, an unassigned component can keep its old value. For example, if one source row has a status but the next does not, a manually reused structure can accidentally display the previous status.
Reset before reuse
delivery = VALUE ty_delivery( delivery_id = 'D-905' status = 'DELAYED' ).
CLEAR delivery.
DATA(result) = delivery-status.
CLEAR restores a data object to its type-specific initial value. A fresh VALUE ty_delivery( ... ) expression also constructs an initialized value. Choose one clear pattern and use it consistently; don’t clear a structure reflexively when a statement already replaces every component.
In loops, prefer constructs that make the target lifecycle obvious, and verify whether a statement fills all components or only some. This lesson’s structural checker cannot reveal stale values at runtime; inspect the actual data flow in an ABAP system.
Sources
Developer practice · ABAP
Practice: clear a reused delivery record
Create a reusable delivery structure, populate it, clear it before the next record, and assign its status to result.
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_delivery,
delivery_id TYPE string,
status TYPE string,
END OF ty_delivery.
DATA delivery TYPE ty_delivery.
delivery = VALUE ty_delivery( delivery_id = 'D-905' status = 'DELAYED' ).
CLEAR delivery.
DATA(result) = delivery-status.
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.