Skip to Content
0
May 30, 2008 at 04:43 PM

Question: how do I ref subclass if all I have is a ref to its super

25 Views

Here is my code:

********************************************

data:

rf_descr_ref type ref to cl_abap_typedescr,

wa_db type /BIC/B0000569000,

columns type table of ABAP_COMPDESCR_TAB.

select * from /BIC/B0000569000 into wa_db

up to 1 rows.

endselect.

call method cl_abap_typedescr=>describe_by_data

EXPORTING

p_data = wa_db

RECEIVING

p_descr_ref = rf_descr_ref.

  • columns = rf_descr_ref->COMPONENTS.

*********************************

The part of the code I comment out gives me a syntax error saying COMPONENTS is not an attribute of rf_descr_ref. COMPONENTS is actually an attribute of the subclass cl_abap_structdescr which is a subclass of cl_abap_typedescr, which is what my variable (rf_descr_ref) is pointing to.

The weird part, is that when I am in the debugger, I can access that attribute with rf_descr_ref->COMPONENTS...?

How can I get to the COMPONENTS attribute and not have a syntax error?

Thanks for any help!

Dustin