abap alv双击事件

匿名 (未验证) 提交于 2019-12-02 23:42:01

TABLES:MARA.
TYPE-POOLS: SLIS.
SELECT-OPTIONS:MATNR FOR MARA-MATNR OBLIGATORY.

DATA:LT_MARA TYPE TABLE OF MARA WITH HEADER LINE,
FIELDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
LAYOUT TYPE SLIS_LAYOUT_ALV,
W_REPID LIKE SY-REPID.

START-OF-SELECTION.
SELECT * FROM MARA INTO TABLE LT_MARA
WHERE MATNR IN MATNR.

W_REPID = SY-REPID.

  • 定义热键显示字段,使双击事件有效
    FIELDCAT-REF_TABNAME = ‘LT_MARA’.
    FIELDCAT-FIELDNAME = ‘MATNR’.
    FIELDCAT-HOTSPOT = ‘X’.
    APPEND FIELDCAT.

CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’
EXPORTING
I_CALLBACK_PROGRAM = W_REPID "定义回执程序
IS_LAYOUT = LAYOUT
I_STRUCTURE_NAME = ‘MARA’
I_CALLBACK_USER_COMMAND = ‘ALV_USER_COMMAND’ "定义执行事件
IT_FIELDCAT = FIELDCAT[]
TABLES
T_OUTTAB = LT_MARA.

---------------------------------------------------------------------

  •   事件触发子程序                         * 

---------------------------------------------------------------------
FORM ALV_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN ‘&IC1’.

  • 获取当前ALV所在行数据
    READ TABLE LT_MARA INDEX RS_SELFIELD-TABINDEX.
    SET PARAMETER ID: ‘MAT’ FIELD LT_MARA-MATNR.
    CALL TRANSACTION ‘MM03’ AND SKIP FIRST SCREEN.
    ENDCASE.
    ENDFORM.

作者:兔宝
来源:CSDN
原文:https://blog.csdn.net/szlaptop/article/details/8252093
版权声明:本文为博主原创文章,转载请附上博文链接!

文章来源: https://blog.csdn.net/jiechongl/article/details/91953930
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!