为没有search help的表在ABAP中添加F4 help
2008 10 8 11:16 AM 4011次查看
其实用on value-request和F4IF_INT_TABLE_VALUE_REQUEST这个function就行了。
代码是节选的,修改了一些=。=
parameters: p_name like z_person-name obligatory.
at selection-screen on value-request for p_name.
perform value_help_for_name.
form value_help_for_name.
data: lt_helpret like ddshretval occurs 0 with header line.
statics: begin of lt_name occurs 0 ,
"这里最好用standard table of ...来定义内表,但因为是老项目了,都是这写法,所以没改了。
name like z_person-name,
end of lt_name.
statics: lt_fields like dfies occurs 0 with header line.
if lt_name[] is initial.
* Determine Valid Destination Locations
select name into table lt_name
from z_person.
endif.
if lt_fields[] is initial.
* Setup the field table
lt_fields-tabname = 'Z_PERSON'.
lt_fields-fieldname = 'NAME'.
lt_fields-position = 1.
lt_fields-leng = 9.
lt_fields-intlen = 9.
lt_fields-outputlen = 9.
lt_fields-inttype = 'C'.
lt_fields-keyflag = 'X'.
lt_fields-scrtext_s = 'Name'.
lt_fields-scrtext_m = 'Name'.
lt_fields-scrtext_l = 'Name'.
lt_fields-lfieldname = 'NAME'.
append lt_fields.
endif.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'NAME'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'NAME'
window_title = 'Destination Location'
value_org = 'S'
tables
value_tab = lt_name
field_tab = lt_fields
return_tab = lt_helpret
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 2.
message s999(zs) with 'No help values'.
elseif sy-subrc = 1.
message s999(zs) with
'Parameter error in [VALUE_REQUEST_FOR_NAME]'.
endif.
endform. "value_help_for_name
其实有的参数可以乱填的,但不能省略,我也没去研究了…
向下滚动可载入更多评论,或者点这里禁止自动加载。