新知一下
海量新知
6 5 1 3 9 2 6

搜索帮助demo(3)F4IF_INT_TABLE_VALUE_REQUEST 根据选择屏幕添加条件限制

SAP干货铺 | 好好学习,天天向上! 2022/09/22 09:22

下面的例子不是很贴切,但是为了减少改动,省事儿

新知达人, 搜索帮助demo(3)F4IF_INT_TABLE_VALUE_REQUEST 根据选择屏幕添加条件限制

代码:

TABLES MAKT.

PARAMETERS P_MATNR TYPE MATNR.

PARAMETERS P_MAKTX TYPE MAKTX.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MAKTX.

PERFORM FRM_F4 CHANGING P_MAKTX.

*--------------------------------------------------------------------*

* Form

*--------------------------------------------------------------------*

FORM FRM_F4 CHANGING P_MAKTX.

TYPES: BEGIN OF VALUES,

MATNR TYPE MATNR,

MAKTX TYPE MAKTX,

END OF VALUES.

DATA: PROGNAME TYPE SY-REPID,

DYNNUM TYPE SY-DYNNR,

DYNPRO_VALUES TYPE TABLE OF DYNPREAD,

FIELD_VALUE LIKE LINE OF DYNPRO_VALUES,

VALUES_TAB TYPE TABLE OF VALUES.

PROGNAME = SY-REPID.

DYNNUM = SY-DYNNR.

CLEAR: FIELD_VALUE, DYNPRO_VALUES.

"指定需要取值的屏幕字段

FIELD_VALUE-FIELDNAME = 'P_MATNR'. "

APPEND FIELD_VALUE TO DYNPRO_VALUES.

"获取屏幕 P_WERKS 字段的值

CALL FUNCTION 'DYNP_VALUES_READ'

EXPORTING

DYNAME = PROGNAME

DYNUMB = DYNNUM

TRANSLATE_TO_UPPER = 'X'

TABLES

DYNPFIELDS = DYNPRO_VALUES.

"根据屏幕输入值进行进一步搜索

READ TABLE DYNPRO_VALUES INDEX 1 INTO FIELD_VALUE.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'

EXPORTING

INPUT = FIELD_VALUE-FIELDVALUE

IMPORTING

OUTPUT = FIELD_VALUE-FIELDVALUE.

SELECT MAKT~MATNR MAKT~MAKTX

FROM MAKT

INTO CORRESPONDING FIELDS OF TABLE VALUES_TAB

WHERE MATNR = FIELD_VALUE-FIELDVALUE

AND SPRAS = 1.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'MAKTX' "需要回传的字段

DYNPPROG = PROGNAME

DYNPNR = DYNNUM

DYNPROFIELD = 'MAKTX' "需要显示的字段

WINDOW_TITLE = '情选择物料 '

VALUE_ORG = 'S'

TABLES

VALUE_TAB = VALUES_TAB.

ENDFORM.

仅仅是demo,项目上自己改就行。

更多“搜索帮助demo”相关内容

更多“搜索帮助demo”相关内容

新知精选

更多新知精选