program z. *---------------------------------------------------------------------* * Constants * *---------------------------------------------------------------------* *---------------------------------------------------------------------* * Types * *---------------------------------------------------------------------* *---------------------------------------------------------------------* * Data * *---------------------------------------------------------------------* * It is important: this internal table MUST be declared as global * data (not in the fill_grid method), otherwise * some cl_gui_alv_grid buttons will not work. * ...I don't know why... data it_t001 type table of t001. *---------------------------------------------------------------------* * Classes * *---------------------------------------------------------------------* *---------------------------------------------------------------------* * Definitions * *---------------------------------------------------------------------* *---------------------------------------------------------------------* class screen_init definition create private. public section. class-methods init_screen. methods constructor. private section. data grid type ref to cl_gui_alv_grid. methods fill_grid. endclass. *---------------------------------------------------------------------* *---------------------------------------------------------------------* * Implementations * *---------------------------------------------------------------------* *---------------------------------------------------------------------* class screen_init implementation. method init_screen. data screen type ref to screen_init. create object screen. endmethod. method constructor. create object grid exporting i_parent = cl_gui_container=>screen0. call method me->fill_grid. endmethod. method fill_grid. select * from t001 into table it_t001. call method grid->set_table_for_first_display exporting i_structure_name = 'T001' changing it_outtab = it_t001. endmethod. endclass. *---------------------------------------------------------------------* *---------------------------------------------------------------------* * Program execution * *---------------------------------------------------------------------* load-of-program. call screen 100. *---------------------------------------------------------------------* * Dialog Modules PBO * *---------------------------------------------------------------------* module status_0100 output. set pf-status 'SCREEN_100'. set titlebar 'TIT_100'. call method screen_init=>init_screen. endmodule. *---------------------------------------------------------------------* * Dialog Modules PAI * *---------------------------------------------------------------------* module cancel input. leave program. endmodule. *----------------------------------------------------------------------*