2011 Jun 09 10:46 AM
Dear experts,
I'm studying about dynamic casting with field symbols.
ASSIGN sy-datum TO <any> CASTING TYPE (typename).Should the typename in my code above be a name of a type in the dictionary? I tried to use 'c' and 'i' as the value of typename (elementary type) but it raises run-time error.
Regards,
Haris
Dear experts,
I'm studying about dynamic casting with field symbols.
ASSIGN sy-datum TO <any> CASTING TYPE (typename).Should the typename in my code above be a name of a type in the dictionary? I tried to use 'c' and 'i' as the value of typename (elementary type) but it raises run-time error.
Regards,
Haris
2011 Jun 09 10:57 AM
2011 Jun 09 12:53 PM
Hi,
When the system accesses the field symbol, the content of the assigned data object is interpreted as if it had the type declared in the statement. After the TYPE addition, you can declare the name of a data object. The content of this data object indicates the data type at runtime.
TYPES: BEGIN OF t_date,
year(4) TYPE n,
month(2) TYPE n,
day(2) TYPE n,
END OF t_date.
FIELD-SYMBOLS: <fs> TYPE ANY,
<f> TYPE n.
ASSIGN sy-datum TO <fs> CASTING TYPE t_date.
WRITE / sy-datum.[Click here|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3930358411d1829f0000e829fbfe/content.htm] to know more
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |