F4IF_FIELD_VALUE_REQUEST主要功能是将表里的字段对应的search help引入到屏幕上来,从而打开对话框,当然也可以任意指定某个search help。
F4IF_INT_TABLE_VALUE_REQUEST支持字定义内表,但是不能通过指定search help的方式打开对话框。
数据不常更新,且数据量不大的时候,为表创建缓存。
TRDIR查找用户创建的全部程序。
REUSE_ALV_FIELDCATALOG_MERGE——从数据库抓取相应内容,并生成字段目录。
创建F1搜索帮助:
1、创建数据元素ZFF_EF1
2、在SE61填入数据元素-创建F1搜索帮助,填写内容
3、代码实现 Z_SALSH_HELPF1
PARAMETERS P_HELPF1 TYPE CHAR20.
DATA T_LINK LIKE TABLE OF TLINE WITH HEADER LINE.
AT SELECTION-SCREEN ON HELP-REQUEST FOR P_HELPF1.
CALL FUNCTION 'HELP_OBJECT_SHOW'
EXPORTING
DOKCLASS = 'DE'
DOKLANGU = '1'
DOKNAME = 'ZFF_EF1'
* DOKTITLE = ' '
* CALLED_BY_PROGRAM = ' '
* CALLED_BY_DYNP = ' '
* CALLED_FOR_TAB = ' '
* CALLED_FOR_FIELD = ' '
* CALLED_FOR_TAB_FLD_BTCH_INPUT = ' '
* MSG_VAR_1 = ' '
* MSG_VAR_2 = ' '
* MSG_VAR_3 = ' '
* MSG_VAR_4 = ' '
* CALLED_BY_CUAPROG = ' '
* CALLED_BY_CUASTAT =
* SHORT_TEXT = ' '
* CLASSIC_SAPSCRIPT = ' '
TABLES
LINKS = T_LINK
* EXCEPTIONS
* OBJECT_NOT_FOUND = 1
* SAPSCRIPT_ERROR = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
创建F4搜索帮助的两种方式:
一、
1、使用SE11创建搜索帮助ZF_HELP- 选择方法填数据库表-添加搜索帮助参数(不需要管 已修改和缺省值)-保存-激活
2、创建数据库表ZFF_DTH
A 、填写相应的字段
B 、选择字段一个字段-点搜索帮助-为它添加搜索帮助ZF_HELP.
C 、点输入帮助/检查-检查
PARAMETERS P_MATNR TYPE ZF_HELP-MATNR.
PARAMETERS P_MATNR TYPE CHAR18 MATCHCODE OBJECT ZHELP_DEMO. "搜索帮助
SELECT-OPTIONS S_HELP FOR ZFF_DTH-MATNR."区间的搜索帮助
二、(手写代码)
PARAMETERS P_MATNR TYPE CHAR18."选择屏幕单值
TYPES:BEGIN OF TYP_01,
MATNR TYPE MARA-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF TYP_01.
DATA GT_01 TYPE STANDARD TABLE OF TYP_01.
DATA GS_01 TYPE TYP_01.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR."搜索帮助
SELECT MARA~MATNR"取数
makt~maktx
FROM MARA
INNER JOIN MAKT ON MARA~MATNR = MAKT~MATNR AND MAKT~SPRAS = SY-LANGU
INTO TABLE GT_01.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'maktx'
* PVALKEY = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR"系统屏幕号
DYNPROFIELD = 'P_MATNR'
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
tables
value_tab = GT_01
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
区间的搜索帮助
DATA :BEGIN OF TYP_01,
ABC TYPE CHAR18,
END OF TYP_01.
SELECT-OPTIONS S_HELP01 FOR TYP_01-ABC.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_HELP01-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_HELP01-HIGH.
调用函数时 : DYNPROFIELD = 'S_HELP01-LOW'
*源代码
TYPES:BEGIN OF TYP_01,
MATNR TYPE MARA-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF TYP_01.
DATA GT_01 TYPE STANDARD TABLE OF TYP_01 WITH HEADER LINE.
DATA GS_01 TYPE TYP_01.
SELECT-OPTIONS S_HELP FOR GT_01-MAKTX.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_HELP-LOW.
SELECT MARA~MATNR
makt~maktx
FROM MARA
INNER JOIN MAKT ON MARA~MATNR = MAKT~MATNR AND MAKT~SPRAS = SY-LANGU
INTO TABLE GT_01.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'maktx'
* PVALKEY = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'S_HELP-LOW'
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
tables
value_tab = GT_01[]
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_HELP-HIGH.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
retfield = 'maktx'
* PVALKEY = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'S_HELP-HIGH'
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* CALLBACK_METHOD =
* MARK_TAB =
* IMPORTING
* USER_RESET =
tables
value_tab = GT_01[]
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* EXCEPTIONS
* PARAMETER_ERROR = 1
* NO_VALUES_FOUND = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.