在tablecontrol中根据输入的MATNR,得到VBELN和POSNR的搜索帮助,选择后,同时填入vbeln和posnr
1、获取matnr的值
https://www.cnblogs.com/CtrlS/p/10755592.html
2、获取数据
定义STRUCTURE(SE11)
DATA: LT_STRU TYPE TABLE OF <STRUCTURE> WITH HEADER LINE.
SELECT ....
如果取不到数,请注意字段的前导零是否正确(CONVERSION_EXIT_ALPHA_OUTPUT)
3、调用 F4IF_INT_TABLE_VALUE_REQUEST 获取F4选择的订单号和行项目
L_DSELC-FLDNAME = ‘VBELN‘. L_DSELC-DYFLDNAME = ‘VBELN‘. APPEND L_DSELC. L_DSELC-FLDNAME = ‘POSNR‘. L_DSELC-DYFLDNAME = ‘POSNR‘. APPEND L_DSELC. CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST‘ EXPORTING DDIC_STRUCTURE = ‘Z51_STCT‘"structure名称 RETFIELD = ‘VBELN‘ * PVALKEY = ‘ ‘ DYNPPROG = SY-REPID DYNPNR = SY-DYNNR DYNPROFIELD = ‘GW_TAB-VBELN‘ * STEPL = 0 WINDOW_TITLE = ‘订单号选择‘ * VALUE = ‘ ‘ VALUE_ORG = ‘S‘"Structure * MULTIPLE_CHOICE = ‘ ‘ * DISPLAY = ‘ ‘ * CALLBACK_PROGRAM = ‘ ‘ * CALLBACK_FORM = ‘ ‘ * MARK_TAB = * IMPORTING * USER_RESET = TABLES VALUE_TAB = LT_VBELN[] FIELD_TAB = L_DFIES[] RETURN_TAB = L_DDSHRETVAL[] DYNPFLD_MAPPING = L_DSELC[] EXCEPTIONS PARAMETER_ERROR = 1 NO_VALUES_FOUND = 2 OTHERS = 3. IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ELSE. READ TABLE L_DDSHRETVAL WITH KEY FIELDNAME = ‘VBELN‘. L_VBELN = L_DDSHRETVAL-FIELDVAL. READ TABLE L_DDSHRETVAL WITH KEY FIELDNAME = ‘POSNR‘. L_POSNR = L_DDSHRETVAL-FIELDVAL. ENDIF.
4、DYNP_VALUES_READ返回订单号和行项目到屏幕
CLEAR:dynpfields[],L_LINES_VB. GET CURSOR LINE L_LINES_VB."获取当前操作行数 DYNPFIELDS-FIELDNAME = ‘GW_TAB-VBELN‘. DYNPFIELDS-STEPL = L_LINES_VB."当前操作行数 DYNPFIELDS-FIELDVALUE = L_VBELN. DYNPFIELDS-FIELDINP = ‘X‘. APPEND DYNPFIELDS. DYNPFIELDS-FIELDNAME = ‘GW_TAB-POSNR‘. DYNPFIELDS-STEPL = L_LINES_VB."当前操作行数 DYNPFIELDS-FIELDVALUE = L_POSNR. DYNPFIELDS-FIELDINP = ‘X‘. APPEND DYNPFIELDS. CALL FUNCTION ‘DYNP_VALUES_UPDATE‘ EXPORTING DYNAME = SY-REPID DYNUMB = SY-DYNNR TABLES DYNPFIELDS = DYNPFIELDS[].
原文地址:https://www.cnblogs.com/CtrlS/p/10757431.html
时间: 2024-11-13 04:01:51