ARTIClE
Field Symbols - Casting
This example demonstrates how casting with implicit and explicit type
specification is carried out.
ABAP_SOURCE_CODE
ABAP_EXEC
ABAP_DESCRIPTION
In the first part of the main method, an implicit casting is
carried out. The field symbol
<(>
is completely typed with the local program type t_date .
Using the CASTING addition
of the ASSIGN statement, the field sy-datum can be
treated as a structure. Without the CASTING addition assigning
would not be possible, because sy-datum is not compatible with
the type of the field symbol.
In the second part of the main method, an implicit casting is
carried out. The field symbol <(><)>
is completely generic. Using the CASTING addition of the
ASSIGN statement, a cast is carried out for the field
sy-datum of the local program type t_date . The field symbol
can now be treated like a structure but does not
recognize components. For this reason, it must be assigned component by
component to a further field symbol .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved