1、SE11创建集合索引
2、在集合索引中定义导入导出参数,至少有一个导出,不然搜索帮助无效
选择屏幕数据传入集合搜索帮助需要在集合中IMP导入,再关联
3、创建多个索引帮助 放入集合帮助中
4、将集合搜索帮助定义的组件和包含的搜索帮助组件进行关联
选中定义里的数据,选中包含的搜索帮助中需要关联的数据点击分配即可。
5、基于索引的搜索帮助1—直接关联
选择方法:从哪个表里取数
IMP:屏幕选择字段
EXP:导出字段
列表:显示顺序
选择:选择屏幕的顺序
6、基于索引的搜索帮助2—函数出口
搜索帮助出口
参考函数:F4IF_SHLP_EXIT_EXAMPLE
在里写取数逻辑
FORM step_select TABLES pt_record_tab STRUCTURE seahlpres
pt_shlp_tab TYPE shlp_desct
CHANGING cs_shlp TYPE shlp_descr
cs_callcontrol TYPE ddshf4ctrl
cv_subrc TYPE sy-subrc.
TYPES:BEGIN OF lty_zppt00001,
wadat TYPE wadat,
zzseqno TYPE zel_zzseqno,
END OF lty_zppt00001.
DATA: lt_result TYPE STANDARD TABLE OF lty_zppt00001,
ls_result TYPE lty_zppt00001.
DATA: lt_wadat TYPE RANGE OF wadat,
ls_wadat LIKE LINE OF lt_wadat.
DATA: lt_zzseqno TYPE RANGE OF zel_zzseqno,
ls_zzseqno LIKE LINE OF lt_zzseqno.
DATA: ls_selopt TYPE ddshselopt.
"循环shlp里的selopt,将选择屏幕上的条件放入内表
LOOP AT cs_shlp-selopt INTO ls_selopt.
CASE ls_selopt-shlpfield.
WHEN 'WADAT'.
ls_wadat-sign = ls_selopt-sign.
ls_wadat-option = ls_selopt-option.
ls_wadat-low = ls_selopt-low.
ls_wadat-high = ls_selopt-high.
APPEND ls_wadat TO lt_wadat.
WHEN 'ZZSEQNO'.
ls_zzseqno-sign = ls_selopt-sign.
ls_zzseqno-option = ls_selopt-option.
ls_zzseqno-low = ls_selopt-low.
ls_zzseqno-high = ls_selopt-high.
APPEND ls_zzseqno TO lt_zzseqno.
ENDCASE.
ENDLOOP.
"取数逻辑
SELECT
likp~wadat,
zsdt_seqno~zzseqno
INTO TABLE @lt_result
FROM zsdt_seqno
INNER JOIN likp ON zsdt_seqno~vbeln = likp~vbeln
WHERE likp~wadat IN @lt_wadat AND
zsdt_seqno~zzseqno IN @lt_zzseqno.
"内表转换
CALL FUNCTION 'F4UT_RESULTS_MAP'
* EXPORTING
* SOURCE_STRUCTURE =
* APPLY_RESTRICTIONS = ' '
TABLES
shlp_tab = pt_shlp_tab
record_tab = pt_record_tab
source_tab = lt_result
CHANGING
shlp = cs_shlp
callcontrol = cs_callcontrol
EXCEPTIONS
illegal_structure = 1
OTHERS = 2.
cv_subrc = sy-subrc.
"注意 这里cv_subrc代表着是否要显示内容
"callcontrol-step = 'DISP'.
ENDFORM.
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/18009.html