FM實現F4幫助系列三:彈出框多篩選條件的搜索幫助(根據搜索幫助篩選字段)

函數:F4IF_GET_SHLP_DESCRhtml

        F4IF_START_VALUE_REQUESTide

效果圖函數


圖片

本例子代碼:spa

找到須要的幫助:htm

圖片

*& Report  ZLM_TEST_045blog

REPORT  zlm_test_045.圖片

TABLES makt.it

DATA:io

      BEGIN OF str_f4,class

        matnr TYPE matnr,

        maktx  TYPE maktx,

        END OF str_f4.

DATA:l_it_f4 LIKE TABLE OF str_f4.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.

SELECT-OPTIONS:

           s_matnr  FOR makt-matnr NO INTERVALS.

SELECTION-SCREEN END OF BLOCK b1.

"幫助

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_matnr-low.

  SELECT * FROM makt INTO CORRESPONDING FIELDS OF TABLE l_it_f4.

  PERFORM frm_f4."  USING 'S_MATNR-LOW' .

*&-------------------------------------------------------------------

*& 搜索幫助

*&-------------------------------------------------------------------

FORM frm_f4.

  DATA g_shlp_descr_t             TYPE shlp_descr_t.

  DATA gwa_shlp_descr_t_interface TYPE ddshiface.

  DATA: gt_return_tab   TYPE TABLE OF ddshretval WITH HEADER LINE.

"調用標準幫助

  CALL FUNCTION 'F4IF_GET_SHLP_DESCR'

    EXPORTING

      shlpname = 'MAT1W'

      shlptype = 'SH'

    IMPORTING

      shlp     = g_shlp_descr_t.

  LOOP AT g_shlp_descr_t-interface INTO gwa_shlp_descr_t_interface.

    IF gwa_shlp_descr_t_interface = 'MATNR'.

      gwa_shlp_descr_t_interface-valfield = 'X'.

      MODIFY g_shlp_descr_t-interface FROM gwa_shlp_descr_t_interface.

    ENDIF.

  ENDLOOP.

  CALL FUNCTION 'F4IF_START_VALUE_REQUEST'

    EXPORTING

      shlp          = g_shlp_descr_t

      maxrecords    = 500

      multisel      = 'X'

    TABLES

      return_values = gt_return_tab.

  "獲取選中值 能夠多選 擁有select options

  LOOP AT gt_return_tab.

    s_matnr-sign = 'I'.

    s_matnr-option = 'EQ'.

    s_matnr-low = gt_return_tab-fieldval.

    APPEND s_matnr.

  ENDLOOP.

ENDFORM.                    " FRM_F4

另一個F4加強的例子,也是添加篩選字段:

http://blog.sina.com.cn/s/blog_c0978c9b0101h1qf.html

相關文章
相關標籤/搜索