Use field names to say what the program means
A structure is not an array of values to remember by position. If the dispatch status changes, address the status component by name. That makes the intent visible and reduces mistakes when other components are added.
Read and update one component
DATA(dispatch) = VALUE ty_dispatch( status = 'READY' package_count = 2 ).
dispatch-status = 'PACKED'.
DATA(result) = dispatch-status.
The hyphen is ABAP’s component selector. For a nested component, selectors can be chained, for example dispatch-destination-city. A component’s assignment still follows its declared type and conversion rules; a name that looks right does not make an incompatible value safe.
When a field changes, consider whether dependent values must change with it. For example, setting a status to PACKED may require a timestamp or a package check in the business rule. A structure organizes data, but it does not enforce those rules by itself.
The code is a language fragment. A classic report can display a result with WRITE; an ABAP Cloud class-run method can use its provided out reference. The practice checker checks structure only, not ABAP execution.
Sources
Developer practice · ABAP
Practice: read and change structure components
Create a dispatch, change its status to PACKED, and calculate the value to display from its component.
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,
status TYPE string,
package_count TYPE i,
END OF ty_dispatch.
DATA(dispatch) = VALUE ty_dispatch( status = 'READY' package_count = 2 ).
dispatch-status = 'PACKED'.
DATA(result) = dispatch-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.