前言:有时候SAP系统报表程序的选择屏幕条件是没有F4帮助的,这时候就需要通过函数自定义实现,通过函数F4IF_INT_TABLE_VALUE_REQUEST可以实现这一需求。
案例:给选择条件物料特性值包装规格添加搜索帮助
步骤如下代码所示:
DATA:gv_zbzgg TYPE ausp-atinn.
*--------------------------------------------------------------------*
*&--------------------------「PROCESS」-----------------------------&*
*--------------------------------------------------------------------*
INITIALIZATION. "获取ZBGGG的内部特性值
PERFORM frm_atinn_trans USING 'ZBZGG' CHANGING gv_zbzgg .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_zbzgg-low.
PERFORM frm_get_atwrt USING gv_zbzgg. "调用自定义搜索帮助
*&---------------------------------------------------------------------*
*& Form frm_atinn_trans
*&---------------------------------------------------------------------*
*& 特性值转换
*&---------------------------------------------------------------------*
FORM frm_atinn_trans USING p_atinn_i CHANGING p_atinn_o.
CALL FUNCTION 'CONVERSION_EXIT_ATINN_INPUT'
EXPORTING
input = p_atinn_i
IMPORTING
output = p_atinn_o.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form frm_get_atwrt
*&---------------------------------------------------------------------*
*& 获取cawn特性值
*&---------------------------------------------------------------------*
FORM frm_get_atwrt USING p_atinn.
SELECT atwrt INTO TABLE @DATA(lt_cawn) FROM cawn WHERE atinn = @p_atinn. "获取数据
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' "实现搜索帮助"
EXPORTING
retfield = 'ATWRT' "值-关联指端
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'S_ZYYYHG' "关联的屏幕字段
value_org = 'S' "屏幕字段类型
TABLES
value_tab = lt_cawn "值表
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
ENDFORM.