相关资料
站内热点

ALV 拖放事件-转载

更新日期:2016-07-17  作者:网络收集

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

* CLASS lcl_event_receiver DEFINITION

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

*

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

CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

*--ALV 拖事件

handle_drag FOR EVENT ondrag OF cl_gui_alv_grid

IMPORTING e_row e_column es_row_no e_dragdropobj ,

*--ALV 放事件

handle_drop FOR EVENT ondrop OF cl_gui_alv_grid

IMPORTING e_row e_column es_row_no e_dragdropobj .

ENDCLASS. "LCL_EVENT_RECEIVER DEFINITION

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

* CLASS LCL_EVENT_RECEIVER IMPLEMENTATION

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

*

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

CLASS lcl_event_receiver IMPLEMENTATION.

METHOD handle_drag.

PERFORM handle_drag USING e_row e_column es_row_no e_dragdropobj.

ENDMETHOD. "handle_double_click

METHOD handle_drop.

PERFORM handle_drop USING e_row e_column es_row_no e_dragdropobj.

ENDMETHOD. "handle_double_click

ENDCLASS. "LCL_EVENT_RECEIVER IMPLEME

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

*& Form handle_drag

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

* text

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

* -->P_E_ROW text

* -->P_E_COLUMN text

* -->P_ES_ROW_NO text

* -->P_E_DRAGDROPOBJ text

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

FORM handle_drag USING e_row TYPE lvc_s_row

e_column TYPE lvc_s_col

es_row_no TYPE lvc_s_roid

e_dragdropobj TYPE REF TO cl_dragdropobject.

DATA: dataobj TYPE REF TO lcl_dragdropobj.

IF e_row-index <> 0 .

READ TABLE it_alv INDEX e_row-index .

IF sy-subrc = 0 .

* 数据处理

CREATE OBJECT dataobj.

MOVE e_row-index TO dataobj->index.

e_dragdropobj->object = dataobj.

ENDIF.

ENDIF.

ENDFORM. " handle_drag

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

*& Form handle_drop

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

* text

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

* -->P_E_ROW text

* -->P_E_COLUMN text

* -->P_ES_ROW_NO text

* -->P_E_DRAGDROPOBJ text

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

FORM handle_drop USING e_row TYPE lvc_s_row

e_column TYPE lvc_s_col

es_row_no TYPE lvc_s_roid

e_dragdropobj TYPE REF TO cl_dragdropobject.

DATA: dataobj TYPE REF TO lcl_dragdropobj.

CATCH SYSTEM-EXCEPTIONS move_cast_error = 1.

dataobj ?= e_dragdropobj->object.

IF e_row-index <> 0 .

READ TABLE it_alv INDEX e_row-index .

IF sy-subrc = 0 .

* 数据处理

ENDIF.

ENDIF.

ENDCATCH.

IF sy-subrc <> 0.

* If anything went wrong this is the clean way of aborting the

* drag and drop operation:

CALL METHOD e_dragdropobj->abort.

ENDIF.

ENDFORM. " handle_drop

转自:http://blog.csdn.net/lbxp521/article/details/6729174

  




免费下载链接:      查看附件打开密码
没有可下载的附件,请直接另存本页!

相关资料
TAG:
友荐云推荐