F4IF_INT_TABLE_VALUE_REQUEST
效果图:
![e002fdd855a4cb90e4e51b188f0c8f3d.png](https://i-blog.csdnimg.cn/blog_migrate/c879792f6a164935cbf7265298f6ee29.jpeg)
本例子代码:
*&-------------------------------------------------------------------
REPORT zlm_test_044.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_matnr TYPE matnr.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
PERFORM frm_f4.
*&---------------------------------------------------------------------*
*& Form frm_f4
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM frm_f4.
"这里定义的字段都会显示出来
TYPES: BEGIN OF values,
werks TYPE werks_d,
matnr TYPE matnr,
maktx TYPE maktx,
END OF values.
DATA: values_tab TYPE TABLE OF values.
SELECT marc~werks makt~matnr makt~maktx
FROM makt
INNER JOIN marc ON marc~matnr = makt~matnr
INTO CORRESPONDING FIELDS OF TABLE values_tab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'MAKTX'
value_org = 'S'
callback_program = sy-repid
callback_form = 'FRM_LIST' "Form for callback before F4 start (-> long docu)
TABLES
value_tab = values_tab.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "frm_f4
*&-------------------------------------------------------------------
*& 设置显示模式
*&-------------------------------------------------------------------
FORM frm_list TABLES record_tab STRUCTURE seahlpres
CHANGING shlp TYPE shlp_descr
callcontrol LIKE ddshf4ctrl.
DATA: ls_intdescr LIKE shlp_intds.
shlp-intdescr-dialogtype = 'C'. "设置显示模式
callcontrol-no_maxdisp = ''.
callcontrol-maxrecords = '50'. "最大显示数量
ENDFORM. "FRM_LIST
另外一个F4增强的例子,也是添加筛选字段:
http://blog.sina.com.cn/s/blog_c0978c9b0101h1qf.html