采购订单审核函数:

BAPI_PO_RELEASE

结尾加上

ENHANCEMENT   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 = .
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 = ''.
LS_ZEKKOADD-BNAME = SY-UNAME.
LS_ZEKKOADD-BDATE = SY-DATUM.
LS_ZEKKOADD-BTIME = SY-UZEIT.
ELSEIF PO_REL_CODE = 'ZZ'.
LS_ZEKKOADD-FRGKE = ''.
LS_ZEKKOADD-CNAME = SY-UNAME.
LS_ZEKKOADD-CDATE = SY-DATUM.
LS_ZEKKOADD-CTIME = SY-UZEIT.
ELSEIF PO_REL_CODE = 'ZX'.
LS_ZEKKOADD-FRGKE = ''.
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 = ''.
LS_ZEKKOADD-ANAME = SY-UNAME.
LS_ZEKKOADD-ADATE = SY-DATUM.
LS_ZEKKOADD-ATIME = SY-UZEIT.
ELSEIF PO_REL_CODE = 'ZY'.
LS_ZEKKOADD-FRGKE = ''.
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 = ''
BNAME = SY-UNAME
BDATE = SY-DATUM
BTIME = SY-UZEIT
WHERE EBELN = PURCHASEORDER.
ELSEIF PO_REL_CODE = 'ZZ'.
UPDATE ZEKKOADD SET FRGKE = ''
CNAME = SY-UNAME
CDATE = SY-DATUM
CTIME = SY-UZEIT
WHERE EBELN = PURCHASEORDER.
ELSEIF PO_REL_CODE = 'ZX'.
UPDATE ZEKKOADD SET FRGKE = ''
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 = ''
ANAME = SY-UNAME
ADATE = SY-DATUM
ATIME = SY-UZEIT
WHERE EBELN = PURCHASEORDER.
ELSEIF PO_REL_CODE = 'ZY'.
UPDATE ZEKKOADD SET FRGKE = ''
CNAME = SY-UNAME
CDATE = SY-DATUM
CTIME = SY-UZEIT
WHERE EBELN = PURCHASEORDER.
ENDIF.
ENDIF.
ENDIF.
ENDIF. ENDENHANCEMENT.
05-06 10:43