假设选择屏幕上有2个输入字段,
parameters: p_werks type marc-werks, "工厂
p_matnr type marc-matnr. “物料
为物料输入字段设置F4输入帮助,其F4输入帮助内容是根据工厂值来确定的,就是说物料是输入的工厂下的所有物料。
但是在下列事件为物料设置输入帮助时获取不到屏幕输入的工厂值p_werks,不信可以加断点调试一下。
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_mantr.
我们需要在此调用一个
CALL FUNCTION ‘DYNP_VALUES_READ‘ EXPORTING DYNAME = SY-CPROG DYNUMB = SY-DYNNR TABLES DYNPFIELDS = LT_DYNPFIELDS EXCEPTIONS INVALID_ABAPWORKAREA = 1 INVALID_DYNPROFIELD = 2 INVALID_DYNPRONAME = 3 INVALID_DYNPRONUMMER = 4 INVALID_REQUEST = 5 NO_FIELDDESCRIPTION = 6 INVALID_PARAMETER = 7 UNDEFIND_ERROR = 8 DOUBLE_CONVERSION = 9 STEPL_NOT_FOUND = 10 OTHERS = 11. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. READ TABLE LT_DYNPFIELDS INTO LW_DYNPFIELDS WITH KEY FIELDNAME = ‘P_WERKS‘. IF LW_DYNPFIELDS-FIELDVALUE <> SPACE. P_WERKS = LW_DYNPFIELDS-FIELDVALUE+0(4). "工厂值 ELSE. SET CURSOR FIELD CNS_P_BUKRS. MESSAGE E711(ZCM) WITH TEXT-009 SPACE SPACE SPACE. ENDIF.
以上是对parameter的获取,如果是select-option,分2种情况:
1. 读取一条值,调用function ‘RS_SELECTIONSCREEN_READ‘,此function只能读取一条,不能读取多条;
2. 读取多条值,调用function ‘RS_REFRESH_FROM_SELECTOPTIONS‘,此function只能读取多条,不能读取一条。
时间: 2024-09-28 15:58:23