0

我在 ALV 中的呼叫事务有问题。现在我想在我的弹出窗口中双击行时调用事务。它可能与否?

感谢您的回答,我使用 user_command '&IC1' -双击调用带有数据的弹出窗口:

        IF selfield-fieldname = 'MATNR'.
        PERFORM popup.

表格弹出:

FORM popup.
DATA: wa_data LIKE zdata.

CLEAR: wa_data.
REFRESH it_data.

LOOP AT t_data.
CLEAR: wa_data.
MOVE-CORRESPONDING t_data TO wa_data.
APPEND wa_data TO it_data.
ENDLOOP.

CALL SCREEN 200
  STARTING AT 20 20
  ENDING   AT 200 90.

ENDFORM. 

它在我的顶部的实现和定义:lcl_handle_events

CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS: on_double_click FOR EVENT double_click OF cl_salv_events_table
IMPORTING row column.
ENDCLASS.                    "lcl_handle_events DEFINITION

CLASS lcl_handle_events IMPLEMENTATION.
METHOD on_double_click.
PERFORM get_po_ord_info USING row column.
ENDMETHOD.                    "on_double_click
ENDCLASS.                    "lcl_handle_events IMPLEMENTATION

这在 ALV 中包括:

FORM get_po_ord_info USING row TYPE salv_de_row
  column TYPE salv_de_column.

IF column EQ 'MATNR'.
  SET PARAMETER ID 'MAT' FIELD t_dost-MATNR.
  SET PARAMETER ID 'WRK' FIELD t_dost-WERKS.
  CALL TRANSACTION 'ZCO06' AND SKIP FIRST SCREEN.
 ENDIF.
ENDIF.

ENDFORM.      
4

1 回答 1

0

我没有清楚地知道你叫你的作品的顺序,但你的代码对我来说是这样的:

CLASS lcl_handle_events DEFINITION.
PUBLIC SECTION.
METHODS: on_double_click FOR EVENT double_click OF cl_salv_events_table IMPORTING row column.
ENDCLASS.                    "lcl_handle_events DEFINITION

CLASS lcl_handle_events IMPLEMENTATION.
METHOD on_double_click.
IF column EQ 'MATNR'.
SET PARAMETER ID 'MAT' FIELD t_dost-MATNR.
SET PARAMETER ID 'WRK' FIELD t_dost-WERKS.
CALL TRANSACTION 'MB51' AND SKIP FIRST SCREEN.
ENDIF.
ENDMETHOD.                    "on_double_click
ENDCLASS.                    "lcl_handle_events IMPLEMENTATION

START-OF-SELECTION.

DATA: wa_data LIKE zdata.
CLEAR: wa_data, it_data.

LOOP AT t_data.
CLEAR: wa_data.
MOVE-CORRESPONDING t_data TO wa_data.
APPEND wa_data TO it_data.
ENDLOOP.

 DATA: o_alv TYPE REF TO cl_salv_table.
 DATA: lx_msg TYPE REF TO cx_salv_msg.
  TRY.
    cl_salv_table=>factory(
      IMPORTING
        r_salv_table = o_alv
      CHANGING
        t_table      = it_data ).
  CATCH cx_salv_msg INTO lx_msg.
 ENDTRY.

 DATA: handle TYPE REF TO lcl_handle_events.
 CREATE OBJECT handle.
 DATA: lr_events TYPE REF TO cl_salv_events_table.
 CALL METHOD o_alv->GET_EVENT
  RECEIVING
    VALUE  = lr_events.
 SET HANDLER handle->on_double_click FOR lr_events.

 o_alv->display( ).

您也可以通过CALL SCREEN...STARTINGinon_double_click方法调用弹出窗口而不是调用 tcode,但是您可以执行这些操作中的任何一个,您无法在弹出窗口中启动新事务。
这里唯一的解决方法是在 Z 事务中调用模态窗口,或者如果您只需要在弹出窗口中输出表格,则使用POPUP_WITH_TABLE_DISPLAY FM。

PS 另外你IF column EQ 'MATNR'是多余的,因为你selfield-fieldname在调用事件时已经检查过了。

于 2017-03-25T13:40:26.230 回答