Copy the data shape your report needs
A screen or report often needs a smaller record than the operational object. If source and target components have matching names, CORRESPONDING builds the target from those matching fields. It is safer to describe the mapping than to depend on component order.
Map the common fields
DATA(summary) = CORRESPONDING ty_summary( dispatch ).
Only identically named target components are populated by default. Target-only fields stay initial. Check types and conversion rules; a matching name does not guarantee that the value converts as intended.
MOVE-CORRESPONDING dispatch TO summary is a statement alternative for updating an already-declared target. The constructor expression returns a new value and initializes components not supplied by the mapping, unless you use BASE. These are similar tools, not identical in their effects on existing target data.
Use the smallest target structure that serves the consumer. Do not copy sensitive or irrelevant fields just because they happen to exist on the source type.
Sources
Developer practice · ABAP
Practice: map a shipment into a summary
Create a summary structure from dispatch using matching component names, then read the copied status.
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,
status TYPE string,
END OF ty_dispatch.
TYPES: BEGIN OF ty_summary,
dispatch_id TYPE string,
status TYPE string,
END OF ty_summary.
DATA(dispatch) = VALUE ty_dispatch( dispatch_id = 'D-612' status = 'IN_TRANSIT' ).
DATA(summary) = CORRESPONDING ty_summary( dispatch ).
DATA(result) = summary-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.