SAP ABAP 选择屏幕搜索帮助无参数值
SELECT-OPTIONS: S_NAME FOR ITAB-NAME.
点击”√“,左下角会显示未发现值
产生此问题的原因:ITAB表里的字段NAME存在一个搜索帮助,这个NAME的数据源于ITAB_A表
选中NAME这一个字段,点击搜索,双击搜索帮助名称
处理办法:
(1)创建当前表搜索帮助
回到ITAB表:
程序引用搜索帮助:
SELECT-OPTIONS: S_NAME TYPE ITAB-NAME MATCHCODE OBJECT ZFISH0001.
(2)代码写一个搜索帮助
*&---------------------------------------------------------------------*
* INITIALIZATION
*&---------------------------------------------------------------------*
INITIALIZATION.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-LOW.
PERFORM FRM_GET_NAME.
DATA: lt_ddshretval TYPE STANDARD TABLE OF ddshretval,
lv_title(20),
lw_ddshretval LIKE LINE OF lt_ddshretval,
lt_dynpfields TYPE TABLE OF dynpread,
lw_dynpfields TYPE dynpread.
DATA:BEGIN OF LT_NAME OCCURS 0,
name TYPE itab_aname,
END OF LT_NAME.
*&---------------------------------------------------------------------*
*& Form FRM_GET_NAME
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM frm_get_name.
DATA lwa_name LIKE LINE OF s_name.
SELECT name FROM itab_a
ORDER BY name
INTO CORRESPONDING FIELDS OF TABLE @lt_name.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'NAME'
dynpprog = sy-cprog
dynpnr = sy-dynnr
window_title = lv_title
value_org = 'S'
callback_program = sy-repid
TABLES
value_tab = lt_name
return_tab = lt_ddshretval
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
CLEAR lt_dynpfields.
LOOP AT lt_ddshretval INTO lw_ddshretval.
lw_dynpfields-fieldname = lw_ddshretval-retfield.
lw_dynpfields-fieldvalue = lw_ddshretval-fieldval.
APPEND lw_dynpfields TO lt_dynpfields.
ENDLOOP.
lw_dynpfields-fieldname = 'S_NAME-LOW'.
MODIFY lt_dynpfields FROM lw_dynpfields INDEX 1 TRANSPORTING fieldname.
CLEAR:s_name[].
LOOP AT lt_dynpfields INTO lw_dynpfields.
IF lw_dynpfields-fieldname EQ 'S_NAME-LOW'.
lwa_xref2-sign = 'I'.
lwa_xref2-option = 'EQ'.
lwa_xref2-low = lw_dynpfields-fieldvalue.
APPEND lwa_name TO s_name.
ENDIF.
ENDLOOP.
CALL FUNCTION 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = lt_dynpfields
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.