SAP提供了预定义函数F4IF_SHLP_EXIT_EXAMPLE,创建搜索帮助。
1.
2.复制SAP的预定义函数F4IF_SHLP_EXIT_EXAMPLE创建函数ZFVBELN_FIND_EXIT
参数和预定义函数一致,这里我们调用‘SELECT’这个时间点来进行数据的查询输出,自定义的帮助出口函数中的具体代码如下:
1 FUNCTION zfvbeln_find_exit. 2 *"---------------------------------------------------------------------- 3 *"*"Local interface: 4 *" TABLES 5 *" SHLP_TAB TYPE SHLP_DESCT 6 *" RECORD_TAB STRUCTURE SEAHLPRES 7 *" CHANGING 8 *" VALUE(SHLP) TYPE SHLP_DESCR 9 *" VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL10 *"----------------------------------------------------------------------11 DATA:BEGIN OF lt_tab OCCURS 0,12 vbeln TYPE vbeln_vl,13 lfdat TYPE lfdat_v,14 wbstk TYPE wbstk,15 END OF lt_tab.16 17 DATA:r_vbeln TYPE RANGE OF vbeln_vl WITH HEADER LINE,18 r_lfdat TYPE RANGE OF lfdat_v WITH HEADER LINE,19 r_wbstk TYPE RANGE OF wbstk WITH HEADER LINE,20 ddshselops TYPE ddshselopt.21 IF callcontrol-step = 'SELECT'.22 LOOP AT shlp-selopt INTO ddshselops.23 CASE ddshselops-shlpfield.24 WHEN 'VBELN'.25 MOVE-CORRESPONDING ddshselops TO r_vbeln.26 APPEND r_vbeln.27 WHEN 'LFDAT'.28 MOVE-CORRESPONDING ddshselops TO r_lfdat.29 APPEND r_lfdat.30 WHEN 'WBSTK'.31 MOVE-CORRESPONDING ddshselops TO r_wbstk.32 APPEND r_wbstk.33 ENDCASE.34 ENDLOOP.35 36 *根据输入参数查询数据37 SELECT likp~vbeln likp~lfdat INTO CORRESPONDING FIELDS OF TABLE lt_tab FROM likp38 INNER JOIN vbuk39 ON likp~vbeln = vbuk~vbeln40 WHERE likp~vbeln IN r_vbeln41 AND likp~lfdat IN r_lfdat42 AND vbuk~wbstk IN r_wbstk.43 44 *将查询结果回执到屏幕上来45 CALL FUNCTION 'F4UT_RESULTS_MAP'46 * EXPORTING47 * SOURCE_STRUCTURE =48 * APPLY_RESTRICTIONS = ' '49 TABLES50 shlp_tab = SHLP_TAB51 record_tab = RECORD_TAB52 source_tab = LT_TAB53 changing54 shlp = SHLP55 callcontrol = CALLCONTROL56 EXCEPTIONS57 ILLEGAL_STRUCTURE = 158 OTHERS = 259 .60 IF sy-subrc <> 0.61 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO62 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.63 ENDIF.64 *下一个时间点直接转到DISP,否则无法再屏幕上显示帮助列表65 callcontrol-step = 'DISP'. ""66 67 ENDIF.68 69 70 71 72 ENDFUNCTION.
激活函数和搜索帮助,允许测试搜索帮助结果如下: