Code: Alles auswählen.
DATA:
grid TYPE REF TO cl_gui_alv_grid,
gt_fieldcatalog TYPE lvc_t_fcat,
g_custom_container TYPE REF TO cl_gui_custom_container,
** ls_zmastermindtable type zmastermindtable,
gt_zmastermindtable TYPE TABLE OF zmastermindtable.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'CCCONTAINER'.
CREATE OBJECT grid
EXPORTING
i_parent = g_custom_container.
SELECT * FROM zmastermindtable INTO TABLE gt_zmastermindtable.
CALL METHOD grid->set_table_for_first_display
EXPORTING I_STRUCTURE_NAME = 'ZSMASTERMINDTABLE'
CHANGING
IT_OUTTAB = gt_zmastermindtable
it_fieldcatalog = gt_fieldcatalog.
CALL METHOD grid->refresh_table_display.
Code: Alles auswählen.
DATA:
grid TYPE REF TO cl_gui_alv_grid,
gt_fieldcatalog TYPE lvc_t_fcat,
g_custom_container TYPE REF TO cl_gui_custom_container,
** ls_zmastermindtable type zmastermindtable,
gt_zmastermindtable TYPE TABLE OF zmastermindtable.
IF g_custom_container IS INITIAL.
CREATE OBJECT g_custom_container
EXPORTING
container_name = 'CCCONTAINER'.
CREATE OBJECT grid
EXPORTING
i_parent = g_custom_container.
SELECT * FROM zmastermindtable INTO TABLE gt_zmastermindtable.
CALL METHOD grid->set_table_for_first_display
EXPORTING I_STRUCTURE_NAME = 'ZSMASTERMINDTABLE'
CHANGING
IT_OUTTAB = gt_zmastermindtable
it_fieldcatalog = gt_fieldcatalog.
ELSE.
SELECT * FROM zmastermindtable INTO TABLE gt_zmastermindtable.
CALL METHOD grid->refresh_table_display.
ENDIF.
Folgende Benutzer bedankten sich beim Autor PeterPaletti für den Beitrag:
a-dead-trousers
Code: Alles auswählen.
CLASS my_class DEFINITION.
PUBLIC SECTION.
METHODS:
constructor,
show_alv.
PRIVATE SECTION.
DATA materials TYPE TABLE OF mara.
DATA grid TYPE REF TO cl_gui_alv_grid.
DATA docking TYPE REF TO cl_gui_docking_container.
ENDCLASS.
CLASS my_class IMPLEMENTATION.
METHOD show_alv.
IF docking IS INITIAL.
CREATE OBJECT docking
EXPORTING
* PARENT =
* REPID =
* DYNNR =
side = cl_gui_docking_container=>dock_at_top
extension = 400
* STYLE =
* LIFETIME = lifetime_default
* CAPTION =
* METRIC = 0
* RATIO =
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT grid
EXPORTING
i_parent = docking.
CALL METHOD grid->set_table_for_first_display
EXPORTING
* I_BUFFER_ACTIVE =
* I_BYPASSING_BUFFER =
* I_CONSISTENCY_CHECK =
i_structure_name = 'MARA'
* is_variant =
* i_save =
* i_default = 'X'
* is_layout =
* IS_PRINT =
* IT_SPECIAL_GROUPS =
* it_toolbar_excluding =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
CHANGING
it_outtab = materials
* it_fieldcatalog =
* it_sort =
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
CALL METHOD grid->refresh_table_display.
ENDIF.
ENDMETHOD.
METHOD constructor.
SELECT * FROM mara INTO TABLE materials UP TO 10 ROWS.
ENDMETHOD.
ENDCLASS.
DATA: my_app TYPE REF TO my_class.
START-OF-SELECTION.
CREATE OBJECT my_app.
CALL SCREEN '0100'.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS '0100'.
CALL METHOD my_app->show_alv.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR 'EXIT' OR 'CANC'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
Folgende Benutzer bedankten sich beim Autor PeterPaletti für den Beitrag:
Maggonski