双击事件 转载 http://blog.sina.com.cn/s/blog_739365a30100vk8p.html

FORM user_command USING ucomm LIKE sy-ucomm

selfield TYPE slis_selfield.

  READ TABLE it_data INDEX selfield-tabindex.

  CHECK sy-subrc = 0.

  CASE ucomm.

      IF selfield-sel_tab_field = '1-EXTRA'.      

"表示单击某一单元格  ,这里的1表示那个被输出的内表

      WHEN '&IC1'.                      "ALV中双击事件代码

        ucomm = '&ETA'.   

 "查看明细,即将该行的数据显示在一个DIALOG中(记得在G_IT_LAYOUT-DETAIL_INITIAL_LINES = 'X' 将无数据的列也显示)

        SET PARAMETER ID 'VF' FIELD it_data-faph.

        CALL TRANSACTION 'VF03' AND SKIP FIRST SCREEN.

      ENDIF.

  ENDCASE.

ENDFORM.                    "USER_COMMAND

 

*&---------------------------------------------------------------------*

*&      Form  display_data

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

FORM display_data.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      i_callback_program      = w_repid   "当前程序

      i_callback_user_command = 'USER_COMMAND'

      i_save                  = ''

      is_layout               = i_layout      "子函数layout_build填充的格式定义

      it_fieldcat             = i_fieldcat_alv[]  "子函数fields填充的各列

      i_grid_title            = tmp_title

    TABLES

      t_outtab                = it_data.          "假设数据都在head1内表中

ENDFORM.                    "display_data

 

posted @ 2018-01-15 12:26  追寻无限  阅读(137)  评论(0编辑  收藏  举报