Programcılar için altın değerindeki örnek kodlar , bilgiler. Bunları başka yerlerde bulamazsınız...
10 Şubat 2011 Perşembe
Alv Örnek 2
REPORT zmus_alv01.
TABLES: zv_equipment.
*--------------------------------------------------------------------
* G L O B A L I N T E R N A L T A B L E S
*--------------------------------------------------------------------
DATA: gi_sflight TYPE STANDARD TABLE OF zv_equipment.
*--------------------------------------------------------------------
* G L O B A L D A T A
*--------------------------------------------------------------------
DATA: ok_code LIKE sy-ucomm,
g_wa_sflight LIKE zv_equipment.
* Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container.
*--------------------------------------------------------------------
* S T A R T - O F - S E L E C T I O N.
*--------------------------------------------------------------------
START-OF-SELECTION.
SET SCREEN '100'.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'DENEME'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Bilgi'
txt2 = 'text2'
txt1 = 'Text1'(510).
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAIN'.
* Create objects
IF go_custom_container IS INITIAL.
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
PERFORM load_data_into_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Form load_data_into_grid
*&---------------------------------------------------------------------*
FORM load_data_into_grid.
DATA:
* For parameter IS_VARIANT
l_layout TYPE disvariant,
* ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
* Read data from table SFLIGHT
SELECT *
FROM zv_equipment
INTO TABLE gi_sflight.
* Load data into the grid and display them
l_layout-report = sy-repid.
* Set grid title
gs_layout-grid_title = 'Prim Hakediþ Hesabý'.
gs_layout-sel_mode = 'A'.
* U Only user specific layouts can be saved
* X Only global layouts can be saved
* A Both user specific and global layouts can be saved
* Space Layouts can not be saved
* Load data into the grid and display them
CALL METHOD go_grid->set_table_for_first_display
EXPORTING
i_structure_name = 'ZV_EQUIPMENT'
is_variant = l_layout
is_layout = gs_layout
i_save = 'A'
CHANGING
it_outtab = gi_sflight.
ENDFORM. " load_data_into_grid
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder