通过双击ALV中的字段名判断调用的事物代码和传入的参数
FORM frm_output .
*ALV输出
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
is_layout = gs_layout
it_fieldcat = gt_fieldcat[]
i_save = 'X'
is_variant = v_stru_disvar
it_events = git_events[]
it_sort = it_sort[]
is_print = gs_print
* i_callback_pf_status_set = 'FRM_STATUS'"显示自定义toolbar
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = i_tab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "FRM_OUTPUT
------------------------------------------------------------------------
FORM user_command USING r_ucomm TYPE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'. "此处通过设断点调试寻找r_ucomm值,填写到此处
case rs_selfield-fieldname.
when 'VBELN'.
SET PARAMETER ID 'VL' FIELD rs_selfield-value. "PARAMETER ID 为需要传入的参数ID F1下找
CALL TRANSACTION 'VL02N' AND SKIP FIRST SCREEN .
when others.
read table I_TAB INDEX rs_selfield-TABINDEX. “通过点击的行号 rs_selfield-TABINDEX 读取
SET PARAMETER ID 'AUN' FIELD I_TAB-VGBEL. “读取VGBEL值传输到VA03中
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN .
endcase.
ENDCASE.
ENDFORM.