Skip to Content

cl_gui_alv_grid:exporting protected table data MT_OUTTAB to local int.table

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Feb 24, 2009 at 03: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.