Hi Anusha,
If I am getting your question correctly, you want to create a Table Type in data dictionary which could store a reference or object pointing to any class.
Is that correct? If so, you should first create a Structure (Line Type) with fields having Typing Method 'Type ref to' and Component Type as your class name, like depicted in example below.
You can then use this Line Type for the creation of your Table Type using SE11.
Hope this solves your problem.
Thanks & Regards,
Sapeksh
If they all implement the same interface, you can use a table of references to that interface. If they're all subclasses of the same super class, then you can use a table of references to that superclass.
Otherwise, you can use a table of references to OBJECT. However, this indicates that you've not designed your class model properly. What is the purpose of your table - what will you use if for and why do you have different objects in it?
It seems that either you need to learn Object-Oriented Programming, or read the ABAP documentation to learn the syntax in ABAP. Below a few examples of the syntax to help you (this code is dummy / non-sense, just here to show the syntax of constructs).
DATA table_of_any_objects TYPE TABLE OF REF TO OBJECT. DATA lo_ixml TYPE REF TO if_ixml. DATA object TYPE REF TO OBJECT. DATA lo_streamfactory TYPE REF TO IF_IXML_STREAM_FACTORY. lo_ixml = cl_ixml=>create( ). APPEND lo_ixml INTO table_of_any_objects. READ TABLE table_of_any_objects INDEX 1 INTO object. CALL METHOD object->('CREATE_STREAM_FACTORY') RECEIVING rval = lo_streamfactory. "--- OR use downcasting ---" lo_ixml ?= object. lo_streamfactory = lo_ixml->create_stream_factory( ). APPEND lo_streamfactory INTO table_of_any_objects.
Add comment