采购订单审核函数:
BAPI_PO_RELEASE
结尾加上
ENHANCEMENT 1 ZME28_PO. "active version DATA:LS_EKKO TYPE EKKO. DATA:LS_ZEKKOADD TYPE ZEKKOADD. CLEAR:LS_EKKO,LS_ZEKKOADD. SELECT SINGLE * INTO LS_ZEKKOADD FROM ZEKKOADD WHERE EBELN = PURCHASEORDER. SELECT SINGLE * INTO LS_EKKO FROM EKKO WHERE EBELN = PURCHASEORDER. IF SY-SUBRC = 0. IF LS_ZEKKOADD IS INITIAL. LS_ZEKKOADD-EBELN = LS_EKKO-EBELN. LS_ZEKKOADD-FRGGR = LS_EKKO-FRGGR. LS_ZEKKOADD-FRGSX = LS_EKKO-FRGSX. IF LS_EKKO-FRGSX = 'ZB'."三级审批 IF PO_REL_CODE = 'ZY'. LS_ZEKKOADD-FRGKE = '2'. LS_ZEKKOADD-BNAME = SY-UNAME. LS_ZEKKOADD-BDATE = SY-DATUM. LS_ZEKKOADD-BTIME = SY-UZEIT. ELSEIF PO_REL_CODE = 'ZZ'. LS_ZEKKOADD-FRGKE = '3'. LS_ZEKKOADD-CNAME = SY-UNAME. LS_ZEKKOADD-CDATE = SY-DATUM. LS_ZEKKOADD-CTIME = SY-UZEIT. ELSEIF PO_REL_CODE = 'ZX'. LS_ZEKKOADD-FRGKE = '1'. LS_ZEKKOADD-ANAME = SY-UNAME. LS_ZEKKOADD-ADATE = SY-DATUM. LS_ZEKKOADD-ATIME = SY-UZEIT. ENDIF. ELSEIF LS_EKKO-FRGSX = 'ZC'."2级审批 IF PO_REL_CODE = 'ZX'. LS_ZEKKOADD-FRGKE = '1'. LS_ZEKKOADD-ANAME = SY-UNAME. LS_ZEKKOADD-ADATE = SY-DATUM. LS_ZEKKOADD-ATIME = SY-UZEIT. ELSEIF PO_REL_CODE = 'ZY'. LS_ZEKKOADD-FRGKE = '3'. LS_ZEKKOADD-CNAME = SY-UNAME. LS_ZEKKOADD-CDATE = SY-DATUM. LS_ZEKKOADD-CTIME = SY-UZEIT. ENDIF. ENDIF. MODIFY ZEKKOADD FROM LS_ZEKKOADD. ELSE. IF LS_EKKO-FRGSX = 'ZB'."三级审批 IF PO_REL_CODE = 'ZY'. UPDATE ZEKKOADD SET FRGKE = '2' BNAME = SY-UNAME BDATE = SY-DATUM BTIME = SY-UZEIT WHERE EBELN = PURCHASEORDER. ELSEIF PO_REL_CODE = 'ZZ'. UPDATE ZEKKOADD SET FRGKE = '3' CNAME = SY-UNAME CDATE = SY-DATUM CTIME = SY-UZEIT WHERE EBELN = PURCHASEORDER. ELSEIF PO_REL_CODE = 'ZX'. UPDATE ZEKKOADD SET FRGKE = '1' ANAME = SY-UNAME ADATE = SY-DATUM ATIME = SY-UZEIT WHERE EBELN = PURCHASEORDER. ENDIF. ELSEIF LS_EKKO-FRGSX = 'ZC'."2级审批 IF PO_REL_CODE = 'ZX'. UPDATE ZEKKOADD SET FRGKE = '1' ANAME = SY-UNAME ADATE = SY-DATUM ATIME = SY-UZEIT WHERE EBELN = PURCHASEORDER. ELSEIF PO_REL_CODE = 'ZY'. UPDATE ZEKKOADD SET FRGKE = '3' CNAME = SY-UNAME CDATE = SY-DATUM CTIME = SY-UZEIT WHERE EBELN = PURCHASEORDER. ENDIF. ENDIF. ENDIF. ENDIF. ENDENHANCEMENT.
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/18686.html