业务需要,开发就搞。。。。
EBAN中增强结构:CI_EBANDB
ANAME 1 类型 UNAME CHAR 12 0 用户名 ADATE 1 类型 AEDAT DATS 8 0 更改日期 ATIME 1 类型 UZEIT TIMS 6 0 时间 BNAME 1 类型 UNAME CHAR 12 0 用户名 BDATE 1 类型 AEDAT DATS 8 0 更改日期 BTIME 1 类型 UZEIT TIMS 6 0 时间
二级审批
ME54N的增强:
LMEREQF06
在函数:ME_UPDATE_REQUISITION 前加上
ENHANCEMENT 1 ZME54N_PR. "active version DATA:LY_EBAN TYPE UEBAN. DATA:LU_EBAN TYPE UEBAN. DATA:LV_TABIX TYPE I. DATA:LT_EKPO TYPE TABLE OF EKPO. CLEAR:LY_EBAN,LU_EBAN,LV_TABIX,LT_EKPO[]. LOOP AT LT_YEBAN INTO LY_EBAN. READ TABLE LT_UEBAN INTO LU_EBAN WITH KEY BANFN = LY_EBAN-BANFN BNFPO = LY_EBAN-BNFPO. IF SY-SUBRC = 0. LV_TABIX = SY-TABIX. IF LY_EBAN-FRGKZ = 'X' AND LU_EBAN-FRGKZ = 'A'."一审 LU_EBAN-ANAME = SY-UNAME. LU_EBAN-ADATE = SY-DATUM. LU_EBAN-ATIME = SY-UZEIT. MODIFY LT_UEBAN FROM LU_EBAN INDEX LV_TABIX. ENDIF. IF LY_EBAN-FRGKZ = 'A' AND LU_EBAN-FRGKZ = 'B'."二审 LU_EBAN-BNAME = SY-UNAME. LU_EBAN-BDATE = SY-DATUM. LU_EBAN-BTIME = SY-UZEIT. MODIFY LT_UEBAN FROM LU_EBAN INDEX LV_TABIX. ENDIF. * IF LY_EBAN-FRGKZ = 'B' AND LU_EBAN-FRGKZ = 'A'."取消二审 * SELECT * INTO TABLE LT_EKPO FROM EKPO WHERE BANFN = LU_EBAN-BANFN AND BNFPO = LU_EBAN-BNFPO. * IF SY-SUBRC = 0. * MESSAGE '已经产生采购订单,不能取消!' TYPE 'E'. * EXIT. * ENDIF. * ENDIF. ENDIF. ENDLOOP. ENDENHANCEMENT.
ME55或者自开发的都是在函数 BAPI_REQUISITION_RELEASE中
开头或者结尾
ENHANCEMENT 1 ZME55_PR. "active version *DATA:LT_EKPO TYPE TABLE OF EKPO, * LS_EKPO TYPE EKPO. * *SELECT EBELN EBELP INTO CORRESPONDING FIELDS OF TABLE LT_EKPO * FROM EKPO WHERE BANFN = NUMBER AND BNFPO = ITEM AND LOEKZ <> 'X'. * IF SY-SUBRC = 0. * MESSAGE E689(06). * ENDIF. IF REL_CODE = 'Z1'. UPDATE EBAN SET ANAME = SY-UNAME ADATE = SY-DATUM ATIME = SY-UZEIT WHERE BANFN = NUMBER AND BNFPO = ITEM. COMMIT WORK. ELSEIF REL_CODE = 'Z2'. UPDATE EBAN SET BNAME = SY-UNAME BDATE = SY-DATUM BTIME = SY-UZEIT WHERE BANFN = NUMBER AND BNFPO = ITEM.. COMMIT WORK. ENDIF. ENDENHANCEMENT.
如果已有审批记录,可通过下面代码批量更新
***************************************************************** * System : 正业科技 ERP项目 * Module : BC * Program ID : ZBCR001 * Program : 事业部核算利润表(新) * Author : 李渊 * Date : 20160510 * Description : ***************************************************************** * Modified Recorder : * Date C#NO Author Content * ----------- ------- ------------------ --------------- * 修改日期 C票或变更文档ID 修改者 修改内容 REPORT ZBCR001. TYPES : BEGIN OF GS_CDHDR , OBJECTCLAS TYPE CDPOS-OBJECTCLAS, OBJECTID TYPE CDPOS-OBJECTID, CHANGENR TYPE CDPOS-CHANGENR, TABNAME TYPE CDPOS-TABNAME, TABKEY TYPE CDPOS-TABKEY, FNAME TYPE CDPOS-FNAME, CHNGIND TYPE CDPOS-CHNGIND, VALUE_NEW TYPE CDPOS-VALUE_NEW, VALUE_OLD TYPE CDPOS-VALUE_OLD, USERNAME TYPE CDHDR-USERNAME, UDATE TYPE CDHDR-UDATE, UTIME TYPE CDHDR-UTIME, END OF GS_CDHDR . TYPES:BEGIN OF GS_EBAN, BANFN TYPE CDOBJECTV, "EBAN-BANFN, BNFPO TYPE EBAN-BNFPO, FRGKZ TYPE EBAN-FRGKZ, BADAT TYPE EBAN-BADAT, END OF GS_EBAN. DATA:GT_CDHDR TYPE TABLE OF GS_CDHDR. DATA:GW_CDHDR TYPE GS_CDHDR. DATA:GT_EBAN TYPE TABLE OF GS_EBAN, GW_EBAN TYPE GS_EBAN. SELECT BANFN AS BANFN "TYPE EBAN-BANFN, BNFPO "TYPE EBAN-BNFPO, FRGKZ "TYPE EBAN-FRGKZ, BADAT "TYPE EBAN-BADAT, INTO CORRESPONDING FIELDS OF TABLE GT_EBAN FROM EBAN WHERE FRGKZ = 'B' AND BADAT >= '20160408' AND BNAME = ''. CHECK GT_EBAN[] IS NOT INITIAL. SELECT CDPOS~OBJECTCLAS CDPOS~OBJECTID CDPOS~CHANGENR CDPOS~TABNAME CDPOS~TABKEY CDPOS~FNAME CDPOS~CHNGIND CDPOS~VALUE_NEW CDPOS~VALUE_OLD CDHDR~USERNAME CDHDR~UDATE CDHDR~UTIME INTO TABLE GT_CDHDR FROM CDPOS INNER JOIN CDHDR ON CDHDR~OBJECTCLAS = CDPOS~OBJECTCLAS AND CDHDR~OBJECTID = CDPOS~OBJECTID AND CDHDR~CHANGENR = CDPOS~CHANGENR FOR ALL ENTRIES IN GT_EBAN WHERE CDPOS~OBJECTID = GT_EBAN-BANFN AND CDPOS~OBJECTCLAS = 'BANF' AND CDPOS~TABNAME = 'EBAN' AND CDPOS~FNAME = 'FRGKZ' AND CDPOS~CHNGIND = 'U' AND CDPOS~VALUE_NEW = 'B' AND CDPOS~VALUE_OLD = 'A' . SORT GT_CDHDR BY UDATE DESCENDING UTIME DESCENDING . LOOP AT GT_EBAN INTO GW_EBAN. LOOP AT GT_CDHDR INTO GW_CDHDR WHERE OBJECTID = GW_EBAN-BANFN. IF GW_CDHDR-TABKEY+13(5) = GW_EBAN-BNFPO. UPDATE EBAN SET BNAME = GW_CDHDR-USERNAME BDATE = GW_CDHDR-UDATE BTIME = GW_CDHDR-UTIME. ENDIF. ENDLOOP. ENDLOOP.
酌情修改!!!!
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/18687.html