05-15-2009 10:14 AM
Hi,
something I don't understand. I create a instance grid to display my alv as follows:
DATA: grid TYPE REF TO cl_gui_alv_grid.
CREATE OBJECT grid
EXPORTING
i_parent = cl_gui_custom_container=>default_screen.
CALL METHOD grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZXML'
is_layout = gs_layout
CHANGING
it_outtab = gs_structure-list
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
what I not understand is, why can I use default screen from cl_gui_custom_container? It's not the class which I define for grid.
And the classes cl_gui_custom_container and cl_gui_alv_grid don't inherit from each other.
05-15-2009 10:23 AM
Hi,
the code,
CREATE OBJECT grid
EXPORTING
i_parent = cl_gui_custom_container=>default_screen.
uses the default screen created by SAP.... so cl_gui_custom_container=>default_screen gets the default screen with the container and that container is assigned/linked with the alv grid which you are displaying.
Now if you don't want that, then you will have to create your own screen and you also will have to create another object for the class cl_gui_custom_container and while creating object for that class you will have to give the container name which you have mentioned in the screen you have created.
To display alv grid using OOPs concept you need a container on the screen mandatorily.
hence either using the default standard sap screen or defining your own screen will do.
Hope I am able to clear your doubt
05-15-2009 10:23 AM
Hi,
the code,
CREATE OBJECT grid
EXPORTING
i_parent = cl_gui_custom_container=>default_screen.
uses the default screen created by SAP.... so cl_gui_custom_container=>default_screen gets the default screen with the container and that container is assigned/linked with the alv grid which you are displaying.
Now if you don't want that, then you will have to create your own screen and you also will have to create another object for the class cl_gui_custom_container and while creating object for that class you will have to give the container name which you have mentioned in the screen you have created.
To display alv grid using OOPs concept you need a container on the screen mandatorily.
hence either using the default standard sap screen or defining your own screen will do.
Hope I am able to clear your doubt
05-15-2009 10:25 AM
I know the logical of default_screen, what I not understand is why I can use this attribut? Can I use is always as this is a public static attribut? Or should the classes which I use inherit from each other as the mentioned one from me?
05-15-2009 10:32 AM
The classes don't inherit from each other, they are performing certain task thats all.
You can use this always because they are public static and also you need to keep in mind before using that it meets your requirement. certain times it may happen that you need to create a screen with the ALV container and some parameters on the screen, at this point of time, default screen will not work, you will have to create your own screen