05-06-2013 10:16 AM
Hi,
I have delveloped tree report using class CL_GUI_ALV_TREE.
I want to access a method CALCULATE_SUBTREE in that class.But it was protected method implemented in
super class CL_ALV_TREE_BASE class.
How to access this mehtod?
I created a local class inheriting the suprecalss and inside that i am accessing CALCULATE_SUBTREE .
But inside the mehtod the table values mt_outtab-> is initial.It gives the terinimation with access null reference.
Pleae let me know how do i access the values from the base class.
05-06-2013 11:24 AM
Hi,
Did you try type casting to access the method in the base class? Try the below code.
DATA : l_base TYPE REF TO cl_alv_tree_base,
l_tree TYPE REF TO cl_gui_alv_tree.
/*after the required objects are created*/
l_base ?= l_tree.
l_base->calculate_subtree().
I didn't try to execute the code myself. See if you can get any help from it.
Hope this helps,
~Athreya
05-06-2013 11:59 AM
Hi,
Thanks for the reply.
I have tried that too.
But it is showing syntax error access to protected CALCULATE_SUBTREE is not allowed.
Thanks ,
Balachandran R
05-06-2013 12:31 PM
You can only access protected methods/attributes of super-classes from sub-classes. Casting won't be able of any help
@Bala - Can you please explain what exactly you want to achieve (your business requirement, maybe) by calling this protected method?
BR,
Suhas
Message was edited by: Suhas Saha
05-07-2013 6:36 AM
Hi,
The output columns are aggregated with totals.My requirement is to get the calculated line of the sub tree and comparing totals with another sub tree in the program.
Regards,
Balachandran R
05-06-2013 12:36 PM
05-07-2013 7:54 AM