工程变更号的创建CCAP_ECN_CREATE 实例
作者:互联网
前台界面CC01
CCAP_ECN_CREATE 使用注意点请参考修改实例https://www.cnblogs.com/twttafku/p/14351983.html
FUNCTION zepe00_create_ecm.
*"--------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" REFERENCE(SYNC) TYPE CHAR1 OPTIONAL
*" REFERENCE(SUBJECT) TYPE /AIFECC/TDM_CHANGE_SUBJECT
*" REFERENCE(VALID_FROM) TYPE /AIFECC/TDM_SHORT_TIMESTAMP
*" REFERENCE(NOTE) TYPE STRING
*" EXPORTING
*" REFERENCE(ECN) TYPE AENNR
*"--------------------------------------------------------------------
DATA ls_ecm_data TYPE aenr_api01.
DATA ls_object_bom TYPE aenv_api01.
DATA ls_object_mat TYPE aenv_api01.
DATA ls_object_doc TYPE aenv_api01.
DATA lt_text_header TYPE TABLE OF ccthead.
DATA lt_text_lines TYPE TABLE OF cctline.
DATA lv_date TYPE datum.
DATA lv_time TYPE uzeit.
DATA lv_timestamp TYPE /aifecc/tdm_short_timestamp.
DATA lv_timezone TYPE tznzone.
DATA lo_plm_object_badi TYPE REF TO /aifecc/badi_plm_objects.
* change header
lv_timestamp = valid_from.
IF lv_timestamp IS INITIAL.
GET TIME STAMP FIELD lv_timestamp.
ENDIF.
lv_timezone = 'UTC'.
CONVERT TIME STAMP lv_timestamp TIME ZONE lv_timezone INTO DATE lv_date TIME lv_time.
ls_ecm_data-descript = subject.
WRITE lv_date TO ls_ecm_data-valid_from. "Bapi needs external date
ls_ecm_data-reason_chg = note.
ls_ecm_data-status = '01'.
* relevant for BOM
ls_object_bom-active = abap_true.
ls_object_bom-obj_requ = abap_true.
ls_object_bom-mgtrec_gen = abap_true.
* relevant for material
ls_object_mat-active = abap_true.
ls_object_mat-obj_requ = abap_true.
ls_object_mat-mgtrec_gen = abap_true.
* relevant for document
ls_object_doc-active = abap_true.
ls_object_doc-obj_requ = abap_true.
ls_object_doc-mgtrec_gen = abap_true.
* customer enhancement
TRY.
GET BADI lo_plm_object_badi.
CALL BADI lo_plm_object_badi->assign_ecm_before
CHANGING
cs_ecm_data = ls_ecm_data
cs_object_bom = ls_object_bom
cs_object_mat = ls_object_mat
cs_object_doc = ls_object_doc.
CATCH cx_badi.
ENDTRY.
CALL FUNCTION 'CCAP_ECN_CREATE'
EXPORTING
change_header = ls_ecm_data
object_bom = ls_object_bom
object_mat = ls_object_mat
object_doc = ls_object_doc
fl_commit_and_wait = 'X'
IMPORTING
change_no = ecn
TABLES
* alt_dates =
* objmgrec =
* effectivity =
textheader = lt_text_header
textlines = lt_text_lines
EXCEPTIONS
change_no_already_exists = 1
error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFUNCTION.
使用注意点请参考修改实例https://www.cnblogs.com/twttafku/p/14351983.html
标签:CCAP,CREATE,object,lv,ls,ECN,DATA,TYPE,ecm 来源: https://www.cnblogs.com/twttafku/p/14352004.html