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

To fetch data from object reference

MNaveen
Product and Topic Expert
Product and Topic Expert
0 Likes
2,023

Hi,

I have an internal table which contains object refrence and points to some class. I am trying to fetch the data stored in the static attributes of that class. How can i do this??

Any input will be very very helpful.. Thanks in advance..

Warm Regards,

Naveen M

5 REPLIES 5
Read only

Former Member
0 Likes
1,397

Hi Naveen,

Try out this code:


LOOP AT it_table INTO wa_table.
  name = wa_table-object=>name.
ENDLOOP.

Read only

MNaveen
Product and Topic Expert
Product and Topic Expert
0 Likes
1,397

hello sidh,

in place of object shld i write my class name and in place of name i shld write the static attribute name rite.

warm regards,

Naveen M

Read only

Former Member
0 Likes
1,397

Use this type of coding, itab contains a field oref1 as an object reference. OREF1 object has a static attribute called data.


loop at itab into wa.

wa_data = wa-oref1=>data.

write:/ wa_data.

endloop.

Read only

MNaveen
Product and Topic Expert
Product and Topic Expert
0 Likes
1,397

hi,

Thanks for the suggestion. but they dint work. The internal table is of some table type. And this table type has a reference type which is name of an interface. This interface has some methods in it.

But when i go into debugging mode and check for the data stored in the table i find it holding memory of some class and that has some static attributes. I am unable to understand how this is actually working./

Any idea...

Warm Regards,

naveen m

Read only

Former Member
0 Likes
1,397

Hi Naveen,

If they are Static Attributes, you can access then directly using class name as:

class_name=>attr1.

Regards,

Nitin.