修改生产订单组件——CO_XT_COMPONENT_CHANGE
转载地址
https://www.cnblogs.com/StephenAmell/p/16742366.html
修改组件仓库的范例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | DATA: lv_po TYPE coxt_ord_key, ls_component TYPE coxt_s_ord_comp_key, ls_requ TYPE coxt_s_quantity, ls_requx TYPE coxt_s_quantityx, ls_conf TYPE coxt_s_quantity, ls_confx TYPE coxt_s_quantityx, lv_matnr TYPE coxt_material, lv_matnrx TYPE coxt_materialx, ls_oper TYPE coxt_s_ord_opr_key, ls_operx TYPE coxt_s_ord_opr_keyx, ls_storage TYPE coxt_s_storage_location, ls_storagex TYPE coxt_s_storage_locationx, lv_charg TYPE coxt_batch, lv_chargx TYPE coxt_batchx, lv_cuobj TYPE coxt_config_object, lv_cuobjx TYPE coxt_config_objectx, ls_return TYPE coxt_bapireturn. "生产订单 lv_po = '000022016565' . "预留单项次 ls_component-rsnum = '0001065926' . ls_component-rspos = '0001' . "组件 lv_matnr = 'CTCN0009-XQ' . lv_matnrx = 'X' . "组件领料仓库 ls_storage-werks = '2000' . ls_storage-lgort = '2173' . ls_storagex-werks = 'X' . ls_storagex-lgort = 'X' . CALL FUNCTION 'CO_XT_COMPONENT_CHANGE' EXPORTING is_order_key = lv_po "生产订单 is_order_component_key = ls_component "组件 is_requirement_quantity = ls_requ "组件需求数量 is_requirement_quantityx = ls_requx is_confirmed_quantity = ls_conf "生产数量 is_confirmed_quantityx = ls_confx i_material = lv_matnr "组件物料 i_materialx = lv_matnrx is_order_operation_key = ls_oper "组件指派工序 is_order_operation_keyx = ls_operx is_storage_location = ls_storage "组件领料仓库 is_storage_locationx = ls_storagex i_batch = lv_charg "批次 i_batchx = lv_chargx i_mi_configuration_object = lv_cuobj "内置对象号码 i_mi_configuration_objectx = lv_cuobjx IMPORTING es_bapireturn = ls_return. IF ls_return-type NE 'E' . CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT' IMPORTING es_bapireturn = ls_return. IF ls_return NE 'E' . COMMIT WORK AND WAIT. WRITE '修改成功' . ELSE. ROLLBACK WORK. WRITE '修改失败' . ENDIF. ELSE. ROLLBACK WORK. WRITE '修改失败' . ENDIF. |
修改组件的工序范例
DATA: lv_po TYPE coxt_ord_key, ls_component TYPE coxt_s_ord_comp_key, ls_requ TYPE coxt_s_quantity, ls_requx TYPE coxt_s_quantityx, ls_conf TYPE coxt_s_quantity, ls_confx TYPE coxt_s_quantityx, lv_matnr TYPE coxt_material, lv_matnrx TYPE coxt_materialx, ls_oper TYPE coxt_s_ord_opr_key, ls_operx TYPE coxt_s_ord_opr_keyx, ls_storage TYPE coxt_s_storage_location, ls_storagex TYPE coxt_s_storage_locationx, lv_charg TYPE coxt_batch, lv_chargx TYPE coxt_batchx, lv_cuobj TYPE coxt_config_object, lv_cuobjx TYPE coxt_config_objectx, ls_return TYPE coxt_bapireturn. DATA: lt_resb_get TYPE TABLE OF resbdget, ls_resb_get TYPE resbdget. "生产订单 lv_po = '000022016565'. "预留单项次 ls_component-rsnum = '0001065926'. ls_component-rspos = '0001'. "组件 lv_matnr = 'CTCN0009-XQ'. lv_matnrx = 'X'. "工厂 ls_storage-werks = '2000'. CALL FUNCTION 'CO_XT_COMPONENT_CHANGE' EXPORTING is_order_key = lv_po "生产订单 is_order_component_key = ls_component "组件 is_requirement_quantity = ls_requ "组件需求数量 is_requirement_quantityx = ls_requx is_confirmed_quantity = ls_conf "生产数量 is_confirmed_quantityx = ls_confx i_material = lv_matnr "组件物料 i_materialx = lv_matnrx is_order_operation_key = ls_oper "组件指派工序 is_order_operation_keyx = ls_operx is_storage_location = ls_storage "组件领料仓库 is_storage_locationx = ls_storagex i_batch = lv_charg "批次 i_batchx = lv_chargx i_mi_configuration_object = lv_cuobj "内置对象号码 i_mi_configuration_objectx = lv_cuobjx IMPORTING es_bapireturn = ls_return. IF ls_return-type NE 'E'. CALL FUNCTION 'CO_XT_ORDER_PREPARE_COMMIT' IMPORTING es_bapireturn = ls_return. IF ls_return NE 'E'. "获取生产订单 CALL FUNCTION 'CO_BC_RESBD_OF_ORDER_GET' EXPORTING aufnr_act = lv_po "生产订单 TABLES resbd_get = lt_resb_get. LOOP AT lt_resb_get INTO ls_resb_get WHERE rsnum = '0001065926' AND rspos = '0001'. "修改组件的工序 ls_resb_get-vornr = '0040'. MODIFY lt_resb_get FROM ls_resb_get. ENDLOOP. CALL FUNCTION 'CO_BC_UPDATE_CMP_OF_ORDERS' TABLES resbd_get = lt_resb_get. COMMIT WORK AND WAIT. CALL FUNCTION 'CO_XT_ORDER_INITIALIZE'. WRITE '修改成功'. ELSE. ROLLBACK WORK. WRITE '修改失败'. ENDIF. ELSE. ROLLBACK WORK. WRITE '修改失败'. ENDIF.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏