将alv class的parent设为 cl_gui_container=>screen0. 表示第0个层次的屏幕.
1. 在报表中显示:
TABLES zstudent.
DATA itab LIKE TABLE OF zstudent.
DATA grid TYPE REF TO cl_gui_alv_grid.
START-OF-SELECTION.
SELECT * FROM zstudent INTO TABLE itab.
CREATE OBJECT grid
EXPORTING
i_parent = cl_gui_container=>screen0 .
CALL METHOD grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZSTUDENT'
CHANGING
it_outtab = itab.
WRITE ''.
2. 在选择屏幕中显示:
REPORT z_temp_demo.
TABLES zstudent.
DATA itab LIKE TABLE OF zstudent.
DATA grid TYPE REF TO cl_gui_alv_grid.
SELECTION-SCREEN BEGIN OF SCREEN 9999.
SELECTION-SCREEN END OF SCREEN 9999.
START-OF-SELECTION.
SELECT * FROM zstudent INTO TABLE itab.
CREATE OBJECT grid
EXPORTING
i_parent = cl_gui_container=>screen0 .
CALL METHOD grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZSTUDENT'
CHANGING
it_outtab = itab.
CALL SELECTION-SCREEN 9999.
阅读(1080) | 评论(0) | 转发(0) |