代码:
************************************************************************ * Program Name : * Descriptions : * T-Code : * Updates Tables : * Input Parameters : * Output Parameters : * Return Codes : * Special Logic : * Includes : ************************************************************************ * Modification Log ************************************************************************ * Date Ver. Programmer Descriptions * -------- ---- ------------ ------------------------------------------- * 2020 3.8 XXX Create * ************************************************************************ REPORT ZMMRTEST. DATA: l_changeNo LIKE aenrb-aennr, ls_header LIKE aenr_api01, ls_object_mat LIKE aenv_api01, lt_item TYPE TABLE OF aeoi_api01 WITH HEADER LINE. "表头 ls_header-change_no = 'ECN-20200309'. ls_header-status = '01'. ls_header-valid_from = sy-datum. ls_header-descript = 'BOM变更'. ls_header-reason_chg = 'BOM变更'. "物件类型 ls_object_mat-active = 'X'. ls_object_mat-obj_requ = 'X'. ls_object_mat-mgtrec_gen = 'X'. ls_object_mat-gen_new = 'X'. "物件 lt_item-material = 'T80232AG-01-AC'. lt_item-chg_objtyp = '4'. lt_item-plant = '2000'. APPEND lt_item. CLEAR lt_item. CALL FUNCTION 'CCAP_ECN_CREATE' EXPORTING CHANGE_HEADER = ls_header OBJECT_MAT = ls_object_mat IMPORTING CHANGE_NO = l_changeNo TABLES * ALT_DATES = OBJMGREC = lt_item * EFFECTIVITY = * TEXTHEADER = * TEXTLINES = EXCEPTIONS CHANGE_NO_ALREADY_EXISTS = 1 ERROR = 2 OTHERS = 3. IF SY-SUBRC <> 0. WRITE: / 'ECN变更号建立失败'. ELSE. WRITE: / 'ECN变更号建立成功'. ENDIF.
说明:物件的参数CHG_OBJTYP(工程更改管理物件)的值来源表TCC01
效果: