Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Question: Genetic Type reference to ABAP Class Object

former_member186413
Participant
0 Likes
626

Can a reference pointer for any type which be able to point an ABAP Class Object?  Since the genetic type can be for any ABAP

For example:

DATA: F1 TYPE REF TO ANY,

           V1(30)  TYPE C  VALUE 'ANOBJECT',

.

.

.

CREATE OBJECT F1 TYPE (V1).

.

.

.

Moderator Message - Basic ABAP question. Please read the ABAP Keyword Documentation on generic ABAP types.

Message was edited by: Suhas Saha

3 REPLIES 3
Read only

former_member195270
Active Participant
0 Likes
483

You can not reference to type ANY after key word REF TO.

Read only

former_member226225
Contributor
0 Likes
483

Hi Hai Wang,

                       You Can't  Declare Generic type after 'TYPEREFTO'  and you can use this example.

class abc definition.

endclass.

class pqr definition.

endclass.

data : obj_abc type ref to abc,

          obj_pqr type ref to pqr.

create object obj_pqr type obj_abc.

Thanks,

Raghunadh.K

Read only

0 Likes
483

Well,  thanks a lot, I was thinking about void pointer for ABAP.