用ABAP语言编程实现:当用户双击某一行数据时,显示具体的明细信息,使用ALV格式显示数据。

要用DOUBLE CLICK功能
2024-11-28 06:53:12
推荐回答(3个)
回答1:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = WS_LAYOUT
IT_FIELDCAT_LVC = WS_FIELDCAT
I_CALLBACK_USER_COMMAND = 'SUB_MYCOMMAND'
I_DEFAULT = 'X'
I_SAVE = 'A'
TABLES
T_OUTTAB = GT_TAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.

FORM SUB_MYCOMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
RS_SELFIELD-REFRESH = 'X'.
CASE R_UCOMM.
WHEN '&IC1'. "鼠标双击
READ TABLE GT_TAB INDEX RS_SELFIELD-TABINDEX. “行信息
"你的代码,要用ALV现实的话,再调用函数REUSE_ALV_GRID_DISPLAY_LVC就可以了
ENDCASE.
ENDFORM.

回答2:

1. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_BACKGROUND_ID = 'ALV_BACKGROUND' "-----------首先这个加上
i_callback_program = myrepid
i_callback_user_command = 'MYCOMMAND'
* I_STRUCTURE_NAME = ''
i_grid_title = 'ALV示例'
i_save = 'X'
it_fieldcat = allfields
TABLES
t_outtab = itab
2.FORM mycommand USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
IF r_ucomm = '&IC1'. "-----------这个是双击事件
PERFORM get_item_information
perform outputitem. ----------里面调用明细的'REUSE_ALV_GRID_DISPLAY'
ENDIF.
ENDFORM.

要看不懂给我个邮箱 给你整个代码

回答3:

牛人都回答了