网上不是有很多资料吗 随便一搜一大把
比如说下面这个步骤方法, 亲测可用
第一步:tablecontrol属性选择‘响应双击'
第二步:PBO的STATUS里面F2要写成PICK,这样双击的UCOMM就是PICK了
第三步:在PAI的usercommond的module加上如下代码就可以得到双击的行和列
data: l_row type i.
data: l_field type char30.
CASE OK_CODE.
WHEN 'PICK'.
get cursor line l_row.
get cursor field l_field.
endcase.
测试的时候,只不过获取双击的列的时候 不是按照这个写的 是参考标准代码里的代码去写的 以防有bug,附标准程序中获取table control 行相关代码
DATA l_lines_name LIKE feld-name.
DATA l_selline LIKE sy-stepl.
DATA l_lastline TYPE i.
DATA l_line TYPE i.
DATA l_table_name LIKE feld-name.
FIELD-SYMBOLSTYPE cxtab_control.
FIELD-SYMBOLSTYPE STANDARD TABLE.
FIELD-SYMBOLSTYPE i.
*&SPWIZARD: END OF LOCAL DATA------------------------------------------*
ASSIGN (p_tc_name) TO.
*&SPWIZARD: get the table, which belongs to the tc *
CONCATENATE p_table_name '[]' INTO l_table_name. "table body
ASSIGN (l_table_name) TO. "not headerline
*&SPWIZARD: get looplines of TableControl *
CONCATENATE 'G_' p_tc_name '_LINES' INTO l_lines_name.
ASSIGN (l_lines_name) TO.
lines =.
*&SPWIZARD: get current line *
GET CURSOR LINE l_selline.
IF sy-subrc <> 0. " append line to table
l_selline =-lines + 1.
*&SPWIZARD: set top line *
IF l_selline >.
-top_line = l_selline - + 1 .
ELSE.
-top_line = 1.
ENDIF.
ELSE. " insert line into table
l_selline =-top_line + l_selline - 1. "当前行
l_lastline =-top_line + - 1.
ENDIF.