‎2007 Aug 28 10:12 PM
Hello,
I have a process that calls a method from a class, at runtime, the object creates a reference and in the reference I need to access an object, basically this is what I have at run time:
Object: WA_OBJECT
Reference:
If I double click on my object I get the following sub objects:
CL_PT_REQ_HEADER
IF_PT_REQ_HEADER~CURRENT_VERSION
IF_PT_REQ_HEADER~MAX_VERSION_NO
IF_PT_REQ_HEADER~MY_REQUEST
ITEM_TAB
if I double click on any of those items, it is fine in debugging, I can see the values, but in my program, I need to access the ITEM_TAB internal table, now I cannot use WA_OBJECT-ITEM_TAB. If I double click on the ITEM_TAB, now the main object becomes -ITEM_TAB[1], so cannot reference to that object in my program, so the question is how do I access the table?
Thanks for any answers.
‎2007 Aug 29 8:17 AM
‎2007 Aug 28 10:55 PM
Hello Enrique
ITEM_TAB is a <i>public </i>instance attribute of class CL_PT_REQ_HEADER. Thus, you can directly access them using
DATA:
ls_item TYPE PTREQ_ITEMS_STRUC,
lo_item TYPE IF_PT_REQ_ITEM.
LOOP AT wa_object->item_tab INTO ls_item.
lo_item = ls_item-item.
ENDLOOP.Regards
Uwe
‎2007 Aug 28 11:01 PM
Uwe,
thanks for your prompt answer. Now that you mention it, I forgot to specify the fact that only the first Items are public, but the table is protected and I cannot do a simple loop at it the way you mentioned. That is the first thing I tried but wa_object->item_tab is not recognized when I ckeck syntax. I should have also mentioned that WA_OBJECT gets referenced ar runtime.
‎2007 Aug 29 5:23 AM
Hopefully there is a method of WA_OBJECT which can give you the information you need.
Trying to directly read the contents of a private table is defeating the whole philosophy of object oriented programming.
Michael
‎2007 Aug 29 8:17 AM