02-24-2009 9:27 AM
Hi guys,
this is my problem.
I've an instance of cl_gui_alv_grid in the reference variable gos_alv. This instance
is populated by "sap GOS service".
Now, i'd like to save locally the internal data table of the gos_alv (populated
automatically by the service call).
The data tables is called "mt_outtab" and is a standard protected component of the cl_gui_alv_grid class
(you can see it in the se24 transaction).
I think to create a subclass of the cl_gui_lav_grid and make a public method to
save data like this :
field-symbols: <outtab> type standard table.
*---------------------------------------------------------------------*
* CLASS lcl_gui_alv_grid DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class lcl_gui_alv_grid definition inheriting from cl_gui_alv_grid.
public section.
methods : get_tab_line.
endclass. "lcl_gui_alv_grid DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_gui_alv_grid IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class lcl_gui_alv_grid implementation.
method get_tab_line.
* mt_outtab is the data table held as a protected attribute
* in class cl_gui_alv_grid.
assign me->mt_outtab->* to <outtab>. "Original data
endmethod. "get_tab_line
endclass. "lcl_gui_alv_grid IMPLEMENTATION
data : l_alv type ref to lcl_gui_alv_grid.
But when i do a downcast like this :
l_alv ?= gos_alv.
I have an exception of casting error. SO, how i can extract protected data into
local internal table?
I've already try to debug the service that build the alv list to understand how the data table
is populated but it's too complex.
Thank you
Andrea
02-24-2009 3:59 PM
Hi,
not yet any suggestion?
Generally speaking, i cannot understand why i cannot use down-cast with an instance declared as a subclass of a super-class.
Many examples, shows that i can create a sub-class inheriting from a super-class, add methods and attributes, make something like this : subclass ?= superclass and the call method of the subclass.
But when i try to do the same with a class derived from cl_gui_alv_grid, i have always a casting type exception in the down-cast instruction.
Could you explain me why?
Thank you very much
Andrea
02-25-2009 9:15 AM
Solved on another forum section (OO Programming).
I close this thread.
Andrea
10-31-2022 5:00 PM
ENDIF.