这个事情,反映了自己做事情不够坚决,中间尝试了BAPI_SALESORDER_CHANGE,浪费了不少时间。
既然可以同步了已经存在的配置,有配置但没有维护过的,应该也可以维护,可自己没有再深入一步。多走了许多弯 路。
type-pools:ibco2.
data:it_config_old type ibco2_instance_tab2,
g_object type cuib_business_object,
g_cuobj type vbap-cuobj.
*& 检查配置的合法性,即当传入的特性,在系统里没有的直接报错
perform configuration_validity_check tables cfg_list
using it_config_old
salesdocument
ret_msg
g_object
g_cuobj.
*& update configuration.
check ret_msg is initial.
perform update_configuration using it_config_old
g_cuobj
g_object
ret_msg .
*& update status
check ret_msg is initial.
if not status is initial.
perform update_order_header_status using salesdocument
status
ret_msg.
endif.
*& create header text.
check ret_msg is initial.
if not text[] is initial.
perform create_order_header_text tables text
using salesdocument
ret_msg.
endif.
if ret_msg is initial.
ret_msg-type = 'S'.
ret_msg-message = '系统同步成功!'.
endif.
*&---------------------------------------------------------------------*
*& Form configuration_validity_check
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->T_CFG_LIST text
* -->CFG_OLD text
* -->P_VBELN text
* -->R_MSG text
* -->CUIB_BUSINESS_OBJECT text
*----------------------------------------------------------------------*
form configuration_validity_check tables t_cfg_list
using cfg_old type ibco2_instance_tab2
p_vbeln
r_msg type bapiret2
p_object type cuib_business_object
p_cuobj.
data:wa type ibvalue0,
wa_config type line of ibco2_instance_tab2 ,
wa_ibco2 type ibco2_value_rec,
g_object type cuib_business_object,
l_index like sy-tabix,
l_atinn_inner_format(10).
*& 注意应该修改,不 应该硬编码:特性不能指定内部形式
loop at t_cfg_list into wa.
if wa-atinn <> '0000002288' and
wa-atinn <> '0000002291' and
wa-atinn <> '0000002292' .
r_msg-type =