1 需求 交货单满足特定条件后更新按钮变灰色,不能刷新价格。
首先找到屏幕。
该屏幕不包含下面的价格更新按钮,因此是子屏幕
找到这个屏幕,加红框出的事件(需要计算KEY)
添加如下代码,完成。
MODULE SET_BUTTONS_STATUS OUTPUT. *DATA ld_mem(62) TYPE c. DATA ls_xlikp TYPE likpvb . FIELD-SYMBOLS <FS_INFO> TYPE ANY . FIELD-SYMBOLS <FS_GO> TYPE ANY . ASSIGN ('(SAPMV50A)XLIKP') TO <FS_INFO>. IF SY-SUBRC = 0. ASSIGN COMPONENT 'VBELN' OF STRUCTURE <FS_INFO> TO <FS_GO> . IF SY-SUBRC = 0 . SELECT COUNT(*) FROM LIKP WHERE VBELN = <FS_GO> AND ZHD2 <> '' and ZQYG <> '' AND ZDDG <> ''. IF SY-SUBRC <> 0 . LOOP AT SCREEN. IF screen-name = 'BT_KONX' . screen-INPUT = '0'. MODIFY SCREEN . ENDIF. ENDLOOP. ENDIF. ENDIF. ENDIF. * IF screen-name = 'BT_KOAN' OR screen-name = 'BT_KOLO'. * IF vfprcs_viewkey-viewkey = '0001'. * screen-invisible = '0'. * ELSE. * screen-invisible = '1'. ENDMODULE.
20180421 修改。
这一段是当交货单更新价格时候的出口,SAP中BILING 和 交货单和销售订单等涉及到价格更新的都会走到此段程序。
ENHANCEMENT 1 ZDNBILL. "active version *** Add by zengyong 20170728 data ls_xkomv TYPE komv_index. if sy-tcode = 'VF01' or sy-tcode = 'VF04'. if KOMK-PLTYP = '01' or KOMK-PLTYP = '02' or KOMK-PLTYP = '11' or KOMK-PLTYP = '12' or KOMK-PLTYP = '31' or KOMK-PLTYP = '32'. if komk-AUART_SD = 'ZECS' and KOMK-VKORG = '2010' and komk-VTWEG = '32'. loop at XKOMV into ls_xkomv . if ls_xkomv-kschl = 'ZY00'. ls_xkomv-KBETR = 0. ls_xkomv-KDIFF = 0. ls_xkomv-KWERT = 0. MODIFY XKOMV FROM LS_XKOMV TRANSPORTING KBETR KDIFF KWERT. ENDIF. endloop.. endif. else. * data lv_KWERT(17) type c. . * FIELD-SYMBOLS <FS> TYPE VBRP-VGBEL..... * if komk-AUART_SD = 'ZECS' and KOMK-VKORG = '2010' and komk-VTWEG = '32'. * DATA: LV_IN TYPE I, * LV_MK TYPE I. * LV_MK = LV_MK + 1. * read table XKOMV into ls_xkomv with key kschl = 'ZY00'. * if sy-subrc = 0. * LV_IN = SY-TABIX. * ASSIGN ('(SAPLV60A)VBRP-VGBEL') TO <FS>. * select single INVDTAAMT into lv_KWERT * from ZSHKIN * where SDHNUM = <FS>. * if sy-subrc = 0. * ls_xkomv-KWERT = lv_KWERT. * MODIFY XKOMV FROM LS_XKOMV INDEX LV_IN TRANSPORTING KWERT. * endif. * endif. * ENDIF. endif. eNDIF. ENDENHANCEMENT.