我在ALV中遇到呼叫交易问题。 现在我想在我的弹出窗口中双击行时调用事务。它可能与否?
感谢您的回答 我使用user_command& IC1' - 双击以调用带有数据的弹出窗口:
library(cowplot)
theme_set(theme_gray())
plot_grid(plotlist = sepPlots)
FORM弹出窗口:
IF selfield-fieldname = 'MATNR'.
PERFORM popup.
在我的顶部实现和定义:lcl_handle_events
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.
这是在ALV中包括:
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
答案 0 :(得分: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...STARTING
方法通过on_double_click
调用弹出窗口而不是调用tcode,但你可以 这些操作,你不能在弹出窗口中启动新事务窗口。
这里唯一的解决方法是在Z-transaction中调用模态窗口,或者在弹出窗口中只需要表输出时使用POPUP_WITH_TABLE_DISPLAY FM。
P.S。此外,IF column EQ 'MATNR'
是多余的,因为您在调用事件时已经检查了selfield-fieldname
。