标签:comm clear ant orm bom head bsp app status
FUNCTION ZEPE00_CHANGE_ECN .
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" VALUE(LEAD_CHANGE_NO) TYPE /PLMB/AENNR OPTIONAL
*" VALUE(LV_EFFECTIVE_DT) TYPE CC_DATUV_BI OPTIONAL
*" EXPORTING
*" VALUE(EP_SUBRC) TYPE SY-SUBRC
*"----------------------------------------------------------------------
DATA:LS_CHANGE_HEADER TYPE AENR_API01,
LS_OBJECT_MAT TYPE AENV_API01,
LS_OBJECT_BOM_MAT TYPE AENV_API01,
LS_OBJECT_DOC TYPE AENV_API01,
LS_CHANGE_HEADER_CUS TYPE CCCI_AENR.
DATA:LT_OBJMGREC LIKE AEOI_API01 OCCURS 0 WITH HEADER LINE.
DATA:CHANGE_HEADER02 TYPE AENR_API02.
* DATA: LEAD_CHANGE_NO TYPE /PLMB/AENNR.
"get EC header
CALL FUNCTION ‘CCAP_ECN_HEADER_READ‘
EXPORTING
CHANGE_NO = LEAD_CHANGE_NO
IMPORTING
CHANGE_HEADER = CHANGE_HEADER02
EXCEPTIONS
NO_RECORD_FOUND = 1
ERROR = 2
OTHERS = 3.
MOVE SY-SUBRC TO EP_SUBRC.
CHECK EP_SUBRC = 0 .
DATA: BEGIN OF LS_UOBJ,
MATERIAL TYPE MATNR,
PLANT TYPE WERKS_D,
BOM_USAGE TYPE CC_STLAN,
END OF LS_UOBJ.
DATA: IT_AEOI LIKE AEOI OCCURS 0 WITH HEADER LINE.
SELECT AENNR
AETYP
OBJKT
USOBJ
INTO CORRESPONDING FIELDS OF TABLE IT_AEOI
FROM AEOI
WHERE AENNR = LEAD_CHANGE_NO
AND AETYP = ‘02‘.
LOOP AT IT_AEOI.
MOVE IT_AEOI-USOBJ TO LS_UOBJ.
MOVE-CORRESPONDING LS_UOBJ TO LT_OBJMGREC.
LT_OBJMGREC-BOM_CAT = IT_AEOI-OBJKT+0(1).
APPEND LT_OBJMGREC.
ENDLOOP.
MOVE-CORRESPONDING CHANGE_HEADER02 TO LS_CHANGE_HEADER.
* LS_CHANGE_HEADER-STATUS = ‘01‘."#### ###
* LS_CHANGE_HEADER-FUNCTION = ‘1‘."####
LS_CHANGE_HEADER_CUS-XFLAG = ‘X‘.
LS_OBJECT_BOM_MAT-ACTIVE = ‘X‘.
LS_OBJECT_BOM_MAT-OBJ_REQU = ‘X‘.
LS_OBJECT_BOM_MAT-MGTREC_GEN = ‘X‘.
* LS_OBJECT_BOM_MAT-GEN_NEW = ‘X‘.
LS_OBJECT_MAT-ACTIVE = ‘X‘.
LS_OBJECT_MAT-OBJ_REQU = ‘X‘.
LS_OBJECT_MAT-MGTREC_GEN = ‘X‘.
LS_OBJECT_DOC-ACTIVE = ‘X‘.
LS_OBJECT_DOC-OBJ_REQU = ‘X‘.
LS_OBJECT_DOC-MGTREC_GEN = ‘X‘.
LS_CHANGE_HEADER-VALID_FROM = LV_EFFECTIVE_DT.
* CALL FUNCTION ‘FORMAT_DATE_4_OUTPUT‘
* EXPORTING
* DATIN = LV_EFFECTIVE_DT
* FORMAT = ‘DDMMYYYY‘
* IMPORTING
* DATEX = LS_CHANGE_HEADER-VALID_FROM.
CLEAR: LS_CHANGE_HEADER-INDATE_RULE,
LS_CHANGE_HEADER-OUTDATE_RULE.
"change date first and then change status to 2.
CALL FUNCTION ‘CCAP_ECN_MAINTAIN‘
EXPORTING
CHANGE_HEADER = LS_CHANGE_HEADER
OBJECT_BOM_MAT = LS_OBJECT_BOM_MAT
OBJECT_MAT = LS_OBJECT_MAT
OBJECT_DOC = LS_OBJECT_DOC
FL_SYNCH = ‘ ‘
FL_COMMIT_AND_WAIT = ‘X‘
FL_NO_COMMIT_WORK = ‘‘
TABLES
OBJMGREC = LT_OBJMGREC
EXCEPTIONS
ERROR = 1
OTHERS = 2.
MOVE SY-SUBRC TO EP_SUBRC.
CHECK EP_SUBRC = 0 .
ENDFUNCTION.
标签:comm clear ant orm bom head bsp app status
原文地址:https://www.cnblogs.com/twttafku/p/14351890.html