ECN变更单建立——CCAP_ECN_CREATE
代码:
DATA: lt_item TYPE TABLE OF aeoi_api01, ls_header TYPE aenr_api01, ls_object_mat TYPE aenv_api01, ls_item TYPE aeoi_api01. DATA: lv_change_no TYPE aenrb-aennr. "表头 ls_header-change_no = 'ECN-20230407'. 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'. "物件 ls_item-material = 'T80232AG-01-AC'. ls_item-chg_objtyp = '4'. ls_item-plant = '2000'. APPEND ls_item TO lt_item. CLEAR ls_item. CALL FUNCTION 'CCAP_ECN_CREATE' EXPORTING change_header = ls_header object_mat = ls_object_mat IMPORTING change_no = lv_change_no 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变更号建立成功,单号为' && lv_change_no. ENDIF.
说明:物件的参数CHG_OBJTYP(工程更改管理物件)的值来源表TCC01
效果:
落霞与孤鹜齐飞,秋水共长天一色