SAP ABAP 批量CC01 创建ECN的物料和BOM 清单(RFC: CCAP_ECN_CREATE)

效果如下:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
源代码:

*&---------------------------------------------------------------------*
*& Report ZCYCLE054
*&---------------------------------------------------------------------*
*&批量CC01
*&---------------------------------------------------------------------*
REPORT zcycle054.
DATA: lt_item       TYPE TABLE OF aeoi_api01,
      ls_header     TYPE aenr_api01,
      ls_object_mat TYPE aenv_api01, "物料
      ls_object_bom TYPE aenv_api01, "BOM
      ls_item       TYPE aeoi_api01.

DATA: lv_change_no  TYPE aenrb-aennr.


"表头
ls_header-change_no = 'ECN-TEST4'.
ls_header-status = '01'.
ls_header-valid_from = sy-datum.
ls_header-descript = 'CYCLE TEST'.
ls_header-reason_chg = 'CYCLE TEST'.
"------------------物料start---------------------
"物件类型
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 = '11-I06A000-00004'.
ls_item-chg_objtyp = '4'. "物料
ls_item-plant = '1001'.
APPEND ls_item TO lt_item.
CLEAR ls_item.
"------------------物料end---------------------

"------------------BOM START-------------------
ls_object_bom-active     = 'X'.
ls_object_bom-obj_requ   = 'X'.
"ls_object_bom-mgtrec_gen = 'X'.

ls_item-material = '11-I06A000-00004'.
ls_item-chg_objtyp = '1'. "BOM
ls_item-plant = '1001'.
ls_item-bom_usage = '1'. "BOM 用途
ls_item-bom_cat = 'M'.  "BOM 类别
APPEND ls_item TO lt_item.
CLEAR ls_item.
"------------------BOM END-------------------

APPEND ls_item TO lt_item.
CLEAR ls_item.

CALL FUNCTION 'CCAP_ECN_CREATE'
  EXPORTING
    change_header            = ls_header
    object_mat               = ls_object_mat
    object_bom               = ls_object_bom
  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
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值