ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 弹出窗口的ALV

弹出窗口的ALV

原创 Linux操作系统 作者:hzq2010 时间:2011-05-07 14:53:16 0 删除 编辑

有哥们问弹出窗口的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

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23495244/viewspace-694707/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-03-11

  • 博文量
    196
  • 访问量
    168111