ABAP顾问
分类:
2008-07-23 13:10:15
有哥们问弹出窗口的ALV如何做。
其实,ALV还是那个ALV,只不过容器变化了一下而已,如下例:
REPORT z_barry_dialog_alv.
DATA:con_diabox TYPE REF TO cl_gui_dialogbox_container.
DATA: l_alv TYPE REF TO cl_gui_alv_grid ,
lt_sflight TYPE TABLE OF sflight .
DATA: ok_code LIKE sy-ucomm.
*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
on_close FOR EVENT close OF cl_gui_dialogbox_container IMPORTING sender.
ENDCLASS. "lcl_event_handler DEFINITION
*----------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_close.
CALL METHOD sender->free.
FREE: con_diabox, l_alv.
ENDMETHOD. "on_close
ENDCLASS. "lcl_event_handler IMPLEMENTATION
START-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'M100'.
SELECT * FROM sflight INTO TABLE lt_sflight.
IF con_diabox IS INITIAL.
CREATE OBJECT con_diabox
EXPORTING
width = 600
height = 200
top = 70
left = 140
caption = 'Title'
EXCEPTIONS
OTHERS = 1.
SET HANDLER lcl_event_handler=>on_close FOR con_diabox .
CREATE OBJECT l_alv
EXPORTING
i_parent = con_diabox.
ENDIF.
CALL METHOD l_alv->set_table_for_first_display
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
it_outtab = lt_sflight.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
chinaunix网友2008-08-13 10:21:06
能否在ALV的USER_COMMAND里用WHEN '1-***' 双击事件弹出与点击项相关的ALV小窗口?我这里需要在点击某一个物料凭证时弹出另一个ALV显示该物料凭证对应的检验批次的所有物料凭证相关信息,惭愧,SCREEN我还没用过,能否指点一下?