ABAP 屏幕下拉框值根据选择框填值赋值
DATA: name TYPE vrm_id,
list TYPE vrm_values,
value LIKE LINE OF list.
DATA lt_itab5 TYPE TABLE OF dynpread.
DATA ls_itab5 TYPE dynpread.
DATA l_kunag TYPE likp-kunag.
ls_itab5-fieldname = 'S_KUNAG'.
APPEND ls_itab5 TO lt_itab5.
***获取屏幕输入框值
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-cprog
dynumb = sy-dynnr
TABLES
dynpfields = lt_itab5.
IF sy-subrc <> 0.
ENDIF.
READ TABLE lt_itab5 INTO ls_itab5 WITH KEY fieldname = 'S_KUNAG'.
IF ls_itab5-fieldvalue IS NOT INITIAL.
CLEAR l_kunag.
l_kunag = ls_itab5-fieldvalue.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = l_kunag
IMPORTING
output = l_kunag.
****获取屏幕输入值之后当作条件可以在table中select 下拉框所需的key值
REFRESH list.
CLEAR list.
SELECT DISTINCT type AS key INTO CORRESPONDING FIELDS OF TABLE list FROM [table] WHERE kunnr = l_kunag.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 's_type'
values = list.
ENDIF.