ABAP顾问
分类:
2008-02-21 16:37:24
REPORT z_barry_alv_noscreen .
SELECTION-SCREEN BEGIN OF SCREEN 1001.
SELECTION-SCREEN END OF SCREEN 1001.
DATA: l_alv TYPE REF TO cl_gui_alv_grid ,
lt_sflight TYPE TABLE OF sflight .
SELECT * FROM sflight INTO TABLE lt_sflight.
CREATE OBJECT l_alv
EXPORTING
i_parent = cl_gui_container=>screen0.
CALL METHOD l_alv->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = lt_sflight.
CALL SELECTION-SCREEN 1001.
或者不定义SELECTION-SCREEN,利用标准的输出屏幕
REPORT z_barry_alv_noscreen .
DATA: l_alv TYPE REF TO cl_gui_alv_grid ,
lt_sflight TYPE TABLE OF sflight .
SELECT * FROM sflight INTO TABLE lt_sflight.
CREATE OBJECT l_alv
EXPORTING
i_parent = cl_gui_container=>screen0.
CALL METHOD l_alv->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = lt_sflight.
WRITE ' '.