I've got to solve a little problem and hope, to finde some help here.
My goal is a global ALV-class, that can be used by programms to easily create ALV's.
I want to use a generate_output method within this class, that takes any internal table as a parameter and generates an ALV out of it. So when you got an internal table, you just have to create an instance of the global alv class and run the output method with your table as parameter to get a basic alv (later I'm planning to use sub-classes of this basic, global alv class, for more specified and program-related alv's.).
But for now, that's all I need to do.
So it should look and work like this:
DATA: lo_alv TYPE REF TO zcl_alv_report. "our global class instance
DATA: it_tab TYPE TABLE OF zzm_ehsanl. "a random internal table
SELECT * FROM zzm_ehsanl INTO TABLE it_tab. "fill it with some data
CREATE OBJECT lo_alv. "let's create an instance of the global alv class
lo_alv->generate_output( it_tab ). "This line is supposed to be all we need for the alv
Now, let's take a look at the generate_output method within the global class.
methods GENERATE_OUTPUT importing alv_table type any table.
So we can use any internal table as a parameter.
Let's get to the implementation part:
DATA: lx_msg TYPE REF TO cx_salv_msg.
FIELD-SYMBOLS: <fs_itab> TYPE ANY TABLE.
ASSIGN alv_table TO <fs_itab>. "assign the parameter to the field-symbol
cl_salv_table=>factory("<=== that's the point where the dump occurs
IMPORTING r_salv_table = o_alv
CHANGING t_table = <fs_itab> ).
CATCH cx_salv_msg INTO lx_msg.
The further code shouldn't be relevant for my problem..
Edited and split up into 2 posts..