IT业行者,行者无疆
分类:
2011-06-20 17:24:07
*&---------------------------------------------------------------------*
*& Report YGYTEST067
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT YGYTEST067.
DATA:OK_CODE TYPE SY-UCOMM,
SAVE_OK LIKE OK_CODE.
DATA WA_SPFLI TYPE TABLE OF SPFLI.
SELECT * INTO TABLE WA_SPFLI FROM SPFLI.
DATA:WA_CONTAINER TYPE SCRFNAME VALUE 'ALVDATA',
ALV_GRID TYPE REF TO CL_GUI_ALV_GRID,
WA_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.
DATA EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
CALL SCREEN 100.
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS:
HANDLE_DOUBLE_CLICK
FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN.
ENDCLASS.
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_DOUBLE_CLICK.
DATA:LI_SPFLI LIKE LINE OF WA_SPFLI.
READ TABLE WA_SPFLI INDEX E_ROW-INDEX INTO LI_SPFLI.
DATA:S1(100).
CONCATENATE '行:' E_ROW-INDEX '列名:' E_COLUMN-FIELDNAME INTO S1.
CONCATENATE S1 'CONNID:' LI_SPFLI-CONNID INTO S1.
CONCATENATE S1 'CARRID:' LI_SPFLI-CARRID INTO S1.
MESSAGE S208(00) WITH S1.
ENDMETHOD.
ENDCLASS.
MODULE USER_COMMAND_0100 INPUT.
SAVE_OK = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.
MODULE STATUS_0100 OUTPUT.
*SET PF-STATUS 'STATUS!'.
IF WA_CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT WA_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = WA_CONTAINER.
CREATE OBJECT ALV_GRID
EXPORTING I_PARENT = WA_CUSTOM_CONTAINER.
CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'SPFLI'
CHANGING IT_OUTTAB = WA_SPFLI.
CREATE OBJECT EVENT_RECEIVER.
SET HANDLER EVENT_RECEIVER->HANDLE_DOUBLE_CLICK FOR ALV_GRID.
ENDIF.
ENDMODULE.