cu41挂配置之前需要先勾选基本视图2的“物料是可配置的选项”
调用bapi:CAMA_CON_PROFILE_MAINTAIN
主要是传这个表的参数:
data:con_object_key like standard table of object_key with header line,
con_pro_attributes like standard table of cpro_attr with header line,
con_pro_dependency_descr like standard table of cpdep_desc with header line.
"CU41挂配置
con_object_key-key_feld = 'MATNR'.
con_object_key-kpara_valu = it_matnr-matnr.
append con_object_key.
con_pro_attributes-c_profile = it_matnr-matnr.
con_pro_attributes-classtype = '300'.
con_pro_attributes-status = '1'.
con_pro_attributes-prio = '00'.
con_pro_attributes-bomappl = 'PP01'.
con_pro_attributes-bomexpl = '4'.
con_pro_attributes-flcasonly = 'X'.
append con_pro_attributes.
con_pro_dependency_descr-language = '1'.
append con_pro_dependency_descr.
clear con_object_key[].
clear con_pro_attributes[].
clear con_pro_dependency_descr[].
call function 'CAMA_CON_PROFILE_MAINTAIN'
exporting
object_type = 'MARA'
* CHANGE_NO =
* FLDELETE = ' '
* INTERNAL_FORMAT = ' '
date = sy-datum
tables
con_object_key = con_object_key
con_pro_attributes = con_pro_attributes
* CON_PRO_DEPENDENCY_DATA =
con_pro_dependency_descr = con_pro_dependency_descr
* CON_PRO_DEPENDENCY_ORDER =
* CON_PRO_DEPENDENCY_SOURCE =
* CON_PRO_DEPENDENCY_DOC =
* CON_PRO_DEPENDENCY_PREC_DATA =
* CON_PRO_DEPENDENCY_PREC_DESCR =
* CON_PRO_DEPENDENCY_PREC_ORDER =
* CON_PRO_DEPENDENCY_PREC_SOURCE =
* CON_PRO_DEPENDENCY_PREC_DOC =
exceptions
error = 1
others = 2.
if sy-subrc = 0.
call function 'BAPI_TRANSACTION_COMMIT' "提交该BAPI
exporting
wait = 'X'.
ot_message-matnr = it_matnr-matnr.
ot_message-zstatus = 'S' .
ot_message-msgty_oa = '0' .
ot_message-zmessage = 'CU41配置成功!' .
append ot_message.
clear: ot_message.
else.
call function 'BAPI_TRANSACTION_ROLLBACK'.
ot_message-matnr = it_matnr-matnr.
ot_message-zstatus = 'E' .
ot_message-msgty_oa = '1' .
ot_message-zmessage = 'CU41配置失败,请联系IT处理' .
append ot_message.
clear: ot_message.
continue.
endif.
其中要注意的参数:
con_pro_attributes-bomexpl = ‘’."1到7对应这里不同的选项