ABAP--如何在list屏幕上输出GRID列表

阅读更多

在List输出屏幕输出GRID列表,输出结果如图:

ABAP--如何在list屏幕上输出GRID列表_第1张图片

代码如下:

REPORT ZSAPM.

data repid like sy-repid.

DATA: docking_t tYPE REF TO CL_GUI_DOCKING_CONTAINER,
g_grid TYPE REF TO cl_gui_alv_grid,
gs_layout TYPE lvc_s_layo,
g_max type i value 100,
gt_outtab type table of sflight.
parameters p_maxnum type i default 2.

START-OF-SELECTION.
perform LIST_DOCKER.

AT USER-COMMAND.


*&---------------------------------------------------------------------*
*& Form LIST_DOCKER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM LIST_DOCKER.
NEW-PAGE NO-HEADING NO-TITLE.
data:
i type i.
*leave to list-processing.
if docking_t is initial.
CREATE OBJECT docking_t
EXPORTING
repid = 'SAPMSSY0'
dynnr = '120'
side = cl_gui_docking_container=>dock_at_top
extension = 200
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6.

CREATE OBJECT g_grid
EXPORTING i_parent = docking_t.
*§1.Set status of all cells to editable using the layout structure.
endif.
gs_layout-edit = 'X'.
gs_layout-NO_TOOLBAR = 'X'.
select * from sflight into table gt_outtab up to p_maxnum rows.

CALL METHOD g_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
is_layout = gs_layout
CHANGING
it_outtab = gt_outtab.
i = 100.
do 30 times.
write: / i, 40 'TEST_________X'.
i = i + 1.
enddo.
ENDFORM. "LIST_DOCKER

你可能感兴趣的:(UP)