PP篇10 修改工单组件行

时间:2021-05-11 08:12:34

CO_XT_COMPONENT_CHANGE 修改工单组件行

DATA :
is_order_key TYPE coxt_ord_key,
is_order_component_key TYPE coxt_s_ord_comp_key,
l_mode TYPE char1 VALUE 'A'. DATA :
wa_resb TYPE resb,
es_bapireturn TYPE coxt_bapireturn,
e_error_occurred TYPE c,
l_dyn_lgort TYPE string,
l_tag TYPE char2. is_order_key = uv_aufnr. SELECT *
INTO TABLE @DATA(lt_resb)
FROM resb
WHERE aufnr EQ @is_order_key. DATA:ls_resb TYPE resb.
* DATA is_order_key TYPE coxt_ord_key.
* DATA is_order_component_key TYPE coxt_s_ord_comp_key.
DATA is_requirement_quantity TYPE coxt_s_quantity.
DATA is_requirement_quantityx TYPE coxt_s_quantityx.
DATA is_confirmed_quantity TYPE coxt_s_quantity.
DATA is_confirmed_quantityx TYPE coxt_s_quantityx.
DATA i_material TYPE coxt_material.
DATA i_materialx TYPE coxt_materialx.
DATA is_storage_location TYPE coxt_s_storage_location.
DATA is_storage_locationx TYPE coxt_s_storage_locationx.
DATA i_batch TYPE coxt_batch.
DATA:is_order_operation_key TYPE coxt_s_ord_opr_key.
DATA:is_order_operation_keyx TYPE coxt_s_ord_opr_keyx.
DATA i_batchx TYPE coxt_batchx.
DATA i_mi_configuration_object TYPE coxt_config_object.
DATA i_mi_configuration_objectx TYPE coxt_config_objectx. LOOP AT lt_resb INTO ls_resb. " 锁定预留.
* "锁定预留.
CALL FUNCTION 'ENQUEUE_EMRESB'
EXPORTING
mode_resb = 'E'
mandt = sy-mandt
rsnum = ls_resb-rsnum
rspos = ls_resb-rspos
rsart = ls_resb-rsart
EXCEPTIONS
foreign_lock =
system_failure =
OTHERS = .
IF sy-subrc <> .
e_error_occurred = 'X'. es_bapireturn-type = 'E'.
es_bapireturn-id = ''.
es_bapireturn-number = ''.
es_bapireturn-message = '预留锁定失败!'.
RETURN.
ENDIF. is_order_component_key-rsnum = ls_resb-rsnum.
is_order_component_key-rspos = ls_resb-rspos.
is_order_component_key-rsart = ls_resb-rsart. * is_requirement_quantity-quantity = zcoxt_s_quantity-menge.
* is_requirement_quantity-uom = ls_resb-meins.
* is_requirement_quantityx-quantity = 'X'.
i_material = ls_resb-matnr. is_storage_location-werks = ls_resb-werks.
is_storage_locationx-werks = 'X'.
is_storage_location-lgort = uv_lgort.
is_storage_locationx-lgort = 'X'.
* i_batch = ls_resb-charg. * is_order_operation_key
DATA:ls_afko TYPE afko.
SELECT SINGLE * INTO ls_afko FROM afko WHERE aufnr = is_order_key.
IF sy-subrc = .
SELECT SINGLE aplzl INTO is_order_operation_key-aplzl FROM afvc WHERE aufpl = ls_afko-aufpl AND vornr = ls_resb-vornr.
ENDIF.
is_order_operation_key-aufnr = uv_aufnr. is_order_operation_keyx-aufnr = 'X'.
is_order_operation_keyx-aplzl = 'X'. CALL FUNCTION 'CO_XT_ORDER_INITIALIZE'. CALL FUNCTION 'CO_XT_COMPONENT_CHANGE'
EXPORTING
is_order_key = ls_resb-aufnr
is_order_component_key = is_order_component_key
is_requirement_quantity = is_requirement_quantity
is_requirement_quantityx = is_requirement_quantityx
is_confirmed_quantity = is_confirmed_quantity
is_confirmed_quantityx = is_confirmed_quantityx
i_material = i_material
i_materialx = i_materialx
is_order_operation_key = is_order_operation_key
is_order_operation_keyx = is_order_operation_keyx
* IS_REQUIREMENT_DATE = IS_REQUIREMENT_DATE
* IS_REQUIREMENT_DATEX = IS_REQUIREMENT_DATEX
is_storage_location = is_storage_location
is_storage_locationx = is_storage_locationx
i_batch = i_batch
i_batchx = i_batchx
i_mi_configuration_object = i_mi_configuration_object
i_mi_configuration_objectx = i_mi_configuration_objectx
IMPORTING
es_bapireturn = es_bapireturn
e_error_occurred = e_error_occurred.
IF sy-subrc <> .
RETURN.
ELSE.
DATA e_order_key TYPE coxt_ord_key.
DATA et_ord_key_map TYPE coxt_t_ord_key_map.
DATA et_bapireturn TYPE coxt_t_bapireturn. CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT'
IMPORTING
e_order_key = e_order_key
es_bapireturn = es_bapireturn
e_error_occurred = e_error_occurred
TABLES
et_ord_key_map = et_ord_key_map
et_bapireturn = et_bapireturn.
IF sy-subrc = .
COMMIT WORK AND WAIT.
ELSE.
DELETE et_bapireturn WHERE type <> 'E' OR type <> 'A'.
READ TABLE et_bapireturn INTO es_bapireturn INDEX .
ENDIF.
ENDIF. *解锁
CALL FUNCTION 'DEQUEUE_EMRESB'
EXPORTING
mode_resb = 'E'
mandt = sy-mandt
rsnum = ls_resb-rsnum
rspos = ls_resb-rspos
rsart = ls_resb-rsart. ENDLOOP.
————————————————
版权声明:本文为CSDN博主「倔强的ABAPER」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sq1986127/article/details/