‎2008 Jun 18 10:18 AM
Currently ?= operator can only used to cast objects from one form to another. If I have value of type Boolean or String and I need to cast it to Object type what is the work around?
Do I need to create class for each type (boolean, string etc) or is there a work around to this?
Regards,
Arpit.
‎2008 Jun 18 10:52 AM
Hi,
I think there is an easy way.
I created this code snippet. Hope this helps.
====
data : xx(20) type c,
dd type ref to data,
dd1 type ref to String.
Field-Symbols : <fs> type any.
xx = 'ABC'.
CREATE DATA dd type String.
ASSIGN dd->* to <fs>.
<fs> = xx.
dd1 ?= dd.
====
Regards,
Saurabh
‎2008 Jun 18 10:52 AM
Hi,
I think there is an easy way.
I created this code snippet. Hope this helps.
====
data : xx(20) type c,
dd type ref to data,
dd1 type ref to String.
Field-Symbols : <fs> type any.
xx = 'ABC'.
CREATE DATA dd type String.
ASSIGN dd->* to <fs>.
<fs> = xx.
dd1 ?= dd.
====
Regards,
Saurabh
‎2008 Jun 18 11:43 AM
Thank you so much. It solved my problem big time.
And thanks for your time.
Regards,
Arpit.
‎2008 Jun 19 4:50 AM
Hi,
Report xyz.
DATA txt(8) TYPE c VALUE '19980606'.
DATA mytype(1) VALUE 'X'.
FIELD-SYMBOLS <fs> TYPE ANY.
ASSIGN txt TO <fs>.
WRITE / <fs>.
SKIP.
ASSIGN txt TO <fs> CASTING TYPE d.
WRITE / <fs>.
ASSIGN txt TO <fs> CASTING TYPE (mytype).
WRITE / <fs>.