Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report YSFE_DOCK *
*& *
*&---------------------------------------------------------------------*
*& ERSTELLEN + FÜLLEN EINES GRIDS *
*& *
*&---------------------------------------------------------------------*
REPORT YSFE_DOCK .
DATA container TYPE REF TO cl_gui_custom_container.
DATA grid1 TYPE REF TO cl_gui_alv_grid.
DATA init.
DATA: ok_code TYPE sy-ucomm,
gt_fieldcat TYPE lvc_t_fcat WITH HEADER LINE,
gs_layout TYPE lvc_s_layo.
types: begin of grid_table,
lines(50) type c,
end of grid_table.
data: g_it_grid_table TYPE TABLE OF grid_table,
g_wa_grid_table TYPE grid_table.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module STATUS_0100 output.
SET PF-STATUS '100'.
SET TITLEBAR '100'.
IF init is initial.
* create the custom container
CREATE OBJECT container
EXPORTING container_name = 'GRID_CONTAINER'.
* create the picture control
CREATE OBJECT grid1
EXPORTING i_parent = container.
PERFORM mask_columns2 TABLES gt_fieldcat.
perform fill_grid.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = gs_layout
* I_STRUCTURE_NAME = 'i_File_table'
CHANGING
it_fieldcatalog = gt_fieldcat[]
it_outtab = g_it_grid_table.
ENDIF.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
case ok_code.
when 'EXIT'.
leave program.
clear ok_code.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form fill_grid
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form fill_grid .
g_wa_grid_table-lines = 'HALLO'.
APPEND g_wa_grid_table TO g_it_grid_table.
endform. " fill_grid
FORM mask_columns2 TABLES p_gt2_fieldcat TYPE lvc_t_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZSJ_DAT'
CHANGING
ct_fieldcat = p_gt2_fieldcat[].
LOOP AT p_gt2_fieldcat.
IF p_gt2_fieldcat-fieldname = 'LINES'.
p_gt2_fieldcat-coltext = 'Zeilen'.
MODIFY p_gt2_fieldcat.
ENDIF.
ENDLOOP.
ENDFORM. " MASK_COLUMNS