控制物料無成本不允許入庫或發料

harson發表於2009-10-14
出口增強:ZXMBCU02[@more@]

"檢查物料收貨時無成本產生
TABLES: MBEW.
DATA TEXT(100) TYPE C.
IF SY-TCODE <> 'MBST' AND SY-TCODE <> 'VL09'.
IF ( I_MSEG-KZBEW = 'F' OR I_MSEG-KZBEW = 'L' ) AND I_MSEG-WERKS = '1000'.
SELECT SINGLE VPRSV VERPR STPRS
FROM MBEW
INTO (MBEW-VPRSV,MBEW-VERPR,MBEW-STPRS)
WHERE BWKEY = '1000'
AND MATNR = I_MSEG-MATNR.
IF ( MBEW-VPRSV = 'V' AND MBEW-VERPR = '' ) OR ( MBEW-VPRSV = 'S' AND MBEW-STPRS = '' ).
CONCATENATE I_MSEG-LINE_ID+2(4) '行專案物料' I_MSEG-MATNR '未維護物料成本無法過帳!' INTO TEXT.
MESSAGE TEXT TYPE 'E'.
ENDIF.
* CLEAR: MBEW,I_MSEG.
ENDIF.

IF ( I_MSEG-KZBEW = 'F' OR I_MSEG-KZBEW = 'L' ) AND I_MSEG-WERKS = '2000'.
SELECT SINGLE VPRSV VERPR STPRS
FROM MBEW
INTO (MBEW-VPRSV,MBEW-VERPR,MBEW-STPRS)
WHERE BWKEY = '2000'
AND MATNR = I_MSEG-MATNR.
IF ( MBEW-VPRSV = 'V' AND MBEW-VERPR = '' ) OR ( MBEW-VPRSV = 'S' AND MBEW-STPRS = '' ).
CONCATENATE I_MSEG-LINE_ID+2(4) '行專案物料' I_MSEG-MATNR '未維護物料成本無法過帳!' INTO TEXT.
MESSAGE TEXT TYPE 'E'.
ENDIF.
* CLEAR: MBEW,I_MSEG.
ENDIF.
ENDIF.

"檢查物料無成本不允許發料!
IF ( I_MSEG-BWART = '261' OR I_MSEG-BWART = '201' ) AND I_MSEG-WERKS = '1000'.
SELECT SINGLE VPRSV VERPR STPRS
FROM MBEW
INTO (MBEW-VPRSV,MBEW-VERPR,MBEW-STPRS)
WHERE BWKEY = '1000'
AND MATNR = I_MSEG-MATNR.
IF ( MBEW-VPRSV = 'V' AND MBEW-VERPR = '' ) OR ( MBEW-VPRSV = 'S' AND MBEW-STPRS = '' ).
CONCATENATE I_MSEG-LINE_ID+2(4) '行專案物料' I_MSEG-MATNR '無成本不允許發料!' INTO TEXT.
MESSAGE TEXT TYPE 'E'.
ENDIF.
* CLEAR: MBEW,I_MSEG.
ENDIF.

IF ( I_MSEG-BWART = '261' OR I_MSEG-BWART = '201' ) AND I_MSEG-WERKS = '2000' AND I_MSEG-MATNR+0(2) <> '18'.
SELECT SINGLE VPRSV VERPR STPRS
FROM MBEW
INTO (MBEW-VPRSV,MBEW-VERPR,MBEW-STPRS)
WHERE BWKEY = '2000'
AND MATNR = I_MSEG-MATNR.
IF ( MBEW-VPRSV = 'V' AND MBEW-VERPR = '' ) OR ( MBEW-VPRSV = 'S' AND MBEW-STPRS = '' ).
CONCATENATE I_MSEG-LINE_ID+2(4) '行專案物料' I_MSEG-MATNR '無成本不允許發料!' INTO TEXT.
MESSAGE TEXT TYPE 'E'.
ENDIF.
* CLEAR: MBEW,I_MSEG.
ENDIF.

E_SGTXT = I_MSEG-SGTXT. "保證文字內容能記錄到表中

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/195776/viewspace-1027853/,如需轉載,請註明出處,否則將追究法律責任。

相關文章