news 2026/4/23 8:53:22

Oracle EBS BOM 通过ECO批量新增或者更新资源

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
Oracle EBS BOM 通过ECO批量新增或者更新资源

通过ECO来新建或者更新BOM Routing对基础数据的要求很高而且总会出些莫名其妙的问题,本人就发现同一批数据没有做任何操作通过多次执行的方式就跑过去了,如果实在执行不过去可以通过控制数据量来执行程序,小批量多次的方式,本身数量量大了之后这个API执行的时间会非常久,如果执行很久后失败就很蛋疼

新增、更新、失效通过字段acd_type来控制(Add:1 Change:2 Disable:3)

以下代码供参考

--ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'; DECLARE l_eco_rec eng_eco_pub.eco_rec_type := eng_eco_pub.g_miss_eco_rec; l_eco_revision_tbl eng_eco_pub.eco_revision_tbl_type := eng_eco_pub.g_miss_eco_revision_tbl; l_revised_item_tbl eng_eco_pub.revised_item_tbl_type := eng_eco_pub.g_miss_revised_item_tbl; l_rev_component_tbl bom_bo_pub.rev_component_tbl_type := eng_eco_pub.g_miss_rev_component_tbl; l_sub_component_tbl bom_bo_pub.sub_component_tbl_type := eng_eco_pub.g_miss_sub_component_tbl; l_ref_designator_tbl bom_bo_pub.ref_designator_tbl_type := eng_eco_pub.g_miss_ref_designator_tbl; l_rev_operation_tbl bom_rtg_pub.rev_operation_tbl_type := eng_eco_pub.g_miss_rev_operation_tbl; l_rev_op_resource_tbl bom_rtg_pub.rev_op_resource_tbl_type := eng_eco_pub.g_miss_rev_op_resource_tbl; l_rev_sub_resource_tbl bom_rtg_pub.rev_sub_resource_tbl_type := eng_eco_pub.g_miss_rev_sub_resource_tbl; -- API output variables x_eco_rec eng_eco_pub.eco_rec_type := eng_eco_pub.g_miss_eco_rec; x_eco_revision_tbl eng_eco_pub.eco_revision_tbl_type := eng_eco_pub.g_miss_eco_revision_tbl; x_revised_item_tbl eng_eco_pub.revised_item_tbl_type := eng_eco_pub.g_miss_revised_item_tbl; x_rev_component_tbl bom_bo_pub.rev_component_tbl_type := eng_eco_pub.g_miss_rev_component_tbl; x_sub_component_tbl bom_bo_pub.sub_component_tbl_type := eng_eco_pub.g_miss_sub_component_tbl; x_ref_designator_tbl bom_bo_pub.ref_designator_tbl_type := eng_eco_pub.g_miss_ref_designator_tbl; x_rev_operation_tbl bom_rtg_pub.rev_operation_tbl_type := eng_eco_pub.g_miss_rev_operation_tbl; x_rev_op_resource_tbl bom_rtg_pub.rev_op_resource_tbl_type := eng_eco_pub.g_miss_rev_op_resource_tbl; x_rev_sub_resource_tbl bom_rtg_pub.rev_sub_resource_tbl_type := eng_eco_pub.g_miss_rev_sub_resource_tbl; l_return_status VARCHAR2(1); l_msg_count NUMBER; l_msg_data VARCHAR2(2000); l_error_table error_handler.error_tbl_type; l_message_text VARCHAR2(2000); i NUMBER; l_user_id NUMBER; l_application_id NUMBER; l_resp_id NUMBER; l_user_name VARCHAR2(30) := 'SYSADMIN'; -- YOUR USER l_resp_name VARCHAR2(30) := 'HCP_MDM_ITEM_MST_ADMIN'; -- YOUR RESP NAME v_eco_name VARCHAR2(50); org_code VARCHAR2(5) := 'MXH'; -- Organization Code l_organization_id NUMBER; l_cnt NUMBER; l_op_cnt NUMBER; l_op_res_cnt NUMBER; l_batch_no NUMBER := 20251215001; /*l_seq_from NUMBER; l_seq_to NUMBER;*/ x_return_status VARCHAR2(10); CURSOR c_routings(p_batch_no IN NUMBER) IS SELECT c.item_number ,c.alternate_routing_designator ,c.organization_id ,ood.organization_code FROM cux.cux_bom_routings_upd c ,org_organization_definitions ood WHERE c.organization_id = ood.organization_id AND c.batch_no = p_batch_no --AND c.seq_num > 50 --AND c.seq_num <= 52 AND c.routing_sequence_id IS NOT NULL AND c.operation_sequence_id IS NOT NULL AND c.resource_seq_num IS NOT NULL AND c.item_number NOT IN ('1038797140069' ,'2099307140089') GROUP BY c.item_number ,c.alternate_routing_designator ,c.organization_id ,ood.organization_code; CURSOR c_routings_op(p_batch_no IN NUMBER ,p_item IN VARCHAR2 ,p_organization_id IN VARCHAR2 ,p_alternate_routing_designator IN VARCHAR2) IS SELECT DISTINCT c.item_number ,c.alternate_routing_designator ,ood.organization_code ,c.organization_id ,c.operation_seq_num ,c.department_code ,bos.effectivity_date ,bos.option_dependent_flag FROM cux.cux_bom_routings_upd c ,org_organization_definitions ood ,bom_operation_sequences bos WHERE c.organization_id = ood.organization_id AND c.item_number = p_item AND nvl(c.alternate_routing_designator ,'-xx') = nvl(p_alternate_routing_designator ,'-xx') AND c.organization_id = p_organization_id AND c.batch_no = p_batch_no --AND c.seq_num > 50 --AND c.seq_num <= 52 AND c.routing_sequence_id IS NOT NULL AND c.operation_sequence_id IS NOT NULL AND c.resource_seq_num IS NOT NULL AND c.operation_sequence_id = bos.operation_sequence_id; CURSOR c_routings_op_res(p_batch_no IN NUMBER ,p_item IN VARCHAR2 ,p_organization_id IN VARCHAR2 ,p_alternate_routing_designator IN VARCHAR2 ,p_op_seq_no IN NUMBER) IS SELECT DISTINCT c.item_number ,c.alternate_routing_designator ,ood.organization_code ,c.operation_seq_num ,bos.effectivity_date ,c.resource_seq_num -- ,c.basis_type ,c.resource_code ,c.usage_rate_or_amount FROM cux.cux_bom_routings_upd c ,org_organization_definitions ood ,bom_operation_sequences bos WHERE c.organization_id = ood.organization_id AND c.item_number = p_item AND c.operation_seq_num = p_op_seq_no AND nvl(c.alternate_routing_designator ,'-xx') = nvl(p_alternate_routing_designator ,'-xx') AND c.organization_id = p_organization_id AND c.batch_no = p_batch_no --AND c.seq_num > 50 --AND c.seq_num <= 52 AND c.routing_sequence_id IS NOT NULL AND c.operation_sequence_id IS NOT NULL AND c.resource_seq_num IS NOT NULL AND c.operation_sequence_id = bos.operation_sequence_id; BEGIN -- Get the user_id SELECT user_id INTO l_user_id FROM fnd_user WHERE user_name = l_user_name; -- Get the application_id and responsibility_id SELECT application_id ,responsibility_id INTO l_application_id ,l_resp_id FROM fnd_responsibility WHERE responsibility_key = l_resp_name; fnd_global.apps_initialize(user_id => l_user_id ,resp_id => l_resp_id ,resp_appl_id => l_application_id); error_handler.initialize; SELECT ood.organization_id INTO l_organization_id FROM org_organization_definitions ood WHERE ood.organization_code = org_code; bompcoan.bom_eco_autonumber(p_user_id => l_user_id ,p_organization_id => l_organization_id ,p_mode => 1 ,p_prefix => v_eco_name ,x_return_status => x_return_status); dbms_output.put_line('ECO Name:' || v_eco_name); -- change order l_eco_rec.eco_name := v_eco_name; l_eco_rec.organization_code := org_code; l_eco_rec.change_type_code := 'Manufacturing'; l_eco_rec.description := 'Mexico Standard Cost update 2026'; l_eco_rec.approval_list_name := NULL; l_eco_rec.approval_status_name := 'Approved'; l_eco_rec.plm_or_erp_change := 'ERP'; l_eco_rec.status_name := 'Open'; l_eco_rec.transaction_type := 'CREATE'; l_eco_rec.return_status := NULL; l_cnt := 1; l_op_cnt := 1; l_op_res_cnt := 1; FOR r_routings IN c_routings(l_batch_no) LOOP -- revised items l_revised_item_tbl(l_cnt).eco_name := l_eco_rec.eco_name; l_revised_item_tbl(l_cnt).organization_code := l_eco_rec.organization_code; l_revised_item_tbl(l_cnt).revised_item_name := r_routings.item_number; l_revised_item_tbl(l_cnt).alternate_bom_code := nvl(r_routings.alternate_routing_designator ,fnd_api.g_null_char); l_revised_item_tbl(l_cnt).start_effective_date := SYSDATE; l_revised_item_tbl(l_cnt).status_type := 1; l_revised_item_tbl(l_cnt).transaction_type := 'CREATE'; -- routings operation FOR r_routings_op IN c_routings_op(l_batch_no ,r_routings.item_number ,r_routings.organization_id ,r_routings.alternate_routing_designator) LOOP l_rev_operation_tbl(l_op_cnt).eco_name := l_eco_rec.eco_name; l_rev_operation_tbl(l_op_cnt).organization_code := l_eco_rec.organization_code; l_rev_operation_tbl(l_op_cnt).revised_item_name := r_routings.item_number; l_rev_operation_tbl(l_op_cnt).alternate_routing_code := nvl(r_routings.alternate_routing_designator ,fnd_api.g_null_char); l_rev_operation_tbl(l_op_cnt).old_start_effective_date := r_routings_op.effectivity_date; l_rev_operation_tbl(l_op_cnt).start_effective_date := SYSDATE; --l_rev_operation_tbl(l_op_cnt).old_operation_sequence_number := 10; l_rev_operation_tbl(l_op_cnt).operation_sequence_number := r_routings_op.operation_seq_num; l_rev_operation_tbl(l_op_cnt).option_dependent_flag := r_routings_op.option_dependent_flag; --l_rev_operation_tbl(l_op_cnt).reference_flag := 2; --l_rev_operation_tbl(l_op_cnt).Standard_Operation_Code := 'T600'; --l_rev_operation_tbl(l_op_cnt).department_code := r_routings_op.depcode; -- Add:1 Change:2 Disable:3 l_rev_operation_tbl(l_op_cnt).acd_type := 2; l_rev_operation_tbl(l_op_cnt).transaction_type := 'CREATE'; -- transaction type : CREATE / UPDATE -- routings operation resource FOR r_routings_op_res IN c_routings_op_res(l_batch_no ,r_routings.item_number ,r_routings.organization_id ,r_routings.alternate_routing_designator ,r_routings_op.operation_seq_num) LOOP l_rev_op_resource_tbl(l_op_res_cnt).eco_name := l_eco_rec.eco_name; l_rev_op_resource_tbl(l_op_res_cnt).organization_code := l_eco_rec.organization_code; l_rev_op_resource_tbl(l_op_res_cnt).revised_item_name := r_routings.item_number; l_rev_op_resource_tbl(l_op_res_cnt).alternate_routing_code := nvl(r_routings.alternate_routing_designator ,fnd_api.g_null_char); l_rev_op_resource_tbl(l_op_res_cnt).operation_sequence_number := r_routings_op.operation_seq_num; l_rev_op_resource_tbl(l_op_res_cnt).resource_sequence_number := r_routings_op_res.resource_seq_num; l_rev_op_resource_tbl(l_op_res_cnt).op_start_effective_date := SYSDATE; --l_rev_op_resource_tbl(l_op_res_cnt).Basis_Type := r_routings_op_res.basis_type; l_rev_op_resource_tbl(l_op_res_cnt).resource_code := r_routings_op_res.resource_code; l_rev_op_resource_tbl(l_op_res_cnt).usage_rate_or_amount := r_routings_op_res.usage_rate_or_amount; --l_rev_op_resource_tbl(l_op_res_cnt).assigned_units := r_routings_op_res.变更后assignedunits; -- Add:1 Change:2 Disable:3 l_rev_op_resource_tbl(l_op_res_cnt).acd_type := 1; l_rev_op_resource_tbl(l_op_res_cnt).transaction_type := 'CREATE'; l_op_res_cnt := l_op_res_cnt + 1; END LOOP; l_op_cnt := l_op_cnt + 1; END LOOP; l_cnt := l_cnt + 1; END LOOP; dbms_output.put_line('Comes before process_eco call'); -- Call the private API eng_eco_pub.process_eco(p_api_version_number => 1.0 ,p_init_msg_list => TRUE ,x_return_status => l_return_status ,x_msg_count => l_msg_count ,p_bo_identifier => 'ECO' ,p_eco_rec => l_eco_rec ,p_eco_revision_tbl => l_eco_revision_tbl ,p_revised_item_tbl => l_revised_item_tbl ,p_rev_component_tbl => l_rev_component_tbl ,p_ref_designator_tbl => l_ref_designator_tbl ,p_sub_component_tbl => l_sub_component_tbl ,p_rev_operation_tbl => l_rev_operation_tbl ,p_rev_op_resource_tbl => l_rev_op_resource_tbl ,p_rev_sub_resource_tbl => l_rev_sub_resource_tbl ,x_eco_rec => x_eco_rec ,x_eco_revision_tbl => x_eco_revision_tbl ,x_revised_item_tbl => x_revised_item_tbl ,x_rev_component_tbl => x_rev_component_tbl ,x_ref_designator_tbl => x_ref_designator_tbl ,x_sub_component_tbl => x_sub_component_tbl ,x_rev_operation_tbl => x_rev_operation_tbl ,x_rev_op_resource_tbl => x_rev_op_resource_tbl ,x_rev_sub_resource_tbl => x_rev_sub_resource_tbl ,p_debug => 'N' ,p_output_dir => '/usr/tmp' ,p_debug_filename => 'ECO_BO_ROUTINGS_Debug.log'); -- error_handler.get_message_list(x_message_list => l_error_table); FOR i IN 1 .. l_error_table.count LOOP dbms_output.put_line('Entity Id:' || l_error_table(i).entity_id); dbms_output.put_line('Index:' || l_error_table(i).entity_index); dbms_output.put_line('Mesg:' || l_error_table(i).message_text); dbms_output.put_line('---------------------------------------'); END LOOP; dbms_output.put_line('Total Messages:' || to_char(i)); l_msg_count := error_handler.get_message_count; dbms_output.put_line('Message Count Function:' || to_char(l_msg_count)); error_handler.dump_message_list; error_handler.get_entity_message(p_entity_id => 'ECO' ,x_message_list => l_error_table); error_handler.get_entity_message(p_entity_id => 'REV' ,x_message_list => l_error_table); error_handler.get_entity_message(p_entity_id => 'RI' ,x_message_list => l_error_table); error_handler.get_entity_message(p_entity_id => 'RC' ,x_message_list => l_error_table); error_handler.get_entity_message(p_entity_id => 'SC' ,x_message_list => l_error_table); error_handler.get_entity_message(p_entity_id => 'RD' ,x_message_list => l_error_table); IF l_return_status = 'S' THEN --COMMIT; dbms_output.put_line('SUCCESS'); ELSE --ROLLBACK; dbms_output.put_line('ERROR'); END IF; EXCEPTION WHEN OTHERS THEN dbms_output.put_line(SQLCODE || '.' || SQLERRM); END;
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/22 20:37:21

【独家揭秘】大型AI项目中Docker-LangGraph多Agent通信的底层原理

第一章&#xff1a;【独家揭秘】大型AI项目中Docker-LangGraph多Agent通信的底层原理在构建复杂的AI系统时&#xff0c;多Agent架构已成为主流选择。Docker与LangGraph的深度集成&#xff0c;为分布式智能体通信提供了轻量级、可扩展的解决方案。其核心在于通过容器化隔离运行环…

作者头像 李华
网站建设 2026/4/23 8:52:31

掌握这7个R语言技巧,轻松实现气候与农业产量关联分析

第一章&#xff1a;农业产量的 R 语言气候影响分析在现代农业研究中&#xff0c;理解气候因素对农作物产量的影响至关重要。R 语言凭借其强大的统计分析与可视化能力&#xff0c;成为探索气温、降水、湿度等气象变量与农业产出之间关系的理想工具。通过整合公开的气象数据集与农…

作者头像 李华
网站建设 2026/4/23 8:52:10

《开发板大全:从入门到专业的完整指南》

开发板大全&#xff1a;从入门到专业的完整指南 一、主流开发板分类 1. 微控制器开发板 (MCU Boards) 特点&#xff1a;体积小、功耗低、价格亲民&#xff0c;适合嵌入式控制&#xff0c;无完整操作系统Arduino系列&#xff1a; UNO&#xff1a;经典入门款(ATmega328P)&#xf…

作者头像 李华
网站建设 2026/4/15 18:43:21

从0到1构建高相关性检索系统,Dify平台调优全攻略

第一章&#xff1a;检索结果的 Dify 相关性评估在构建基于大语言模型的应用时&#xff0c;Dify 作为低代码平台提供了强大的工作流编排与数据处理能力。评估检索结果的相关性是优化问答系统、知识库匹配准确率的关键步骤。通过定义明确的评估指标并结合 Dify 提供的自定义节点逻…

作者头像 李华
网站建设 2026/4/18 13:31:54

2025年阿里云国际版性价比分析:精打细算背后的策略选择

随着全球数字化转型进入深水区&#xff0c;无论是出海的初创企业还是寻求业务扩展的成熟公司&#xff0c;选择一款稳定、高效且成本可控的云服务已成为刚需。时间来到2025年&#xff0c;阿里云国际版&#xff08;Alibaba Cloud International&#xff09;依然是众多企业的首选之…

作者头像 李华
网站建设 2026/4/13 21:45:52

私有化Dify用户权限设计全解析,打造零信任架构的第一道防线

第一章&#xff1a;私有化 Dify 用户管理的核心价值在企业级 AI 应用部署中&#xff0c;私有化 Dify 的用户管理系统提供了对身份验证、权限控制和数据隔离的全面掌控。通过将用户管理能力下沉至本地基础设施&#xff0c;组织能够在保障安全合规的前提下&#xff0c;灵活定义访…

作者头像 李华