news 2026/7/22 4:38:52

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/7/21 20:57:46

思科网络发现协议CDP基础

学习目标: CDP:cisco discover protocol 思科网络发现协议(为了发现邻居) Q:发现邻居的前提条件是什么? A:要先建立邻居,然后再关联,最后查看邻居的状况 LLDP(链路状态的协议) NTP IOS系统的镜像(网络设备的操作系统)NOS(网络服务器操作系统)OS(一般指代的是客…

作者头像 李华
网站建设 2026/7/20 10:27:54

思科网络设备密码配置技术基础1

温故知新:上午我们讲了IP地址的相关内容,下午主要给思科的网络设备配置密码。 密码分为(四种)两类:明文密码-----加密密码 (console 控制台密码;vtp虚拟终端的密码) 一,给设备配置密码并验证 1.配置明文密码 问号?代表了寻找帮助;(在当前模式下寻找帮助信息) 上…

作者头像 李华
网站建设 2026/7/21 10:24:18

部署Qwen3-VL-30B:多模态大模型实战指南

部署Qwen3-VL-30B&#xff1a;多模态大模型实战指南 在智能文档分析、医学影像解读和自动驾驶语义理解等前沿场景中&#xff0c;AI 正面临一个关键瓶颈&#xff1a;“看得见”不等于“读得懂”。传统视觉语言模型&#xff08;VLM&#xff09;往往只能做图文标签匹配&#xff0c…

作者头像 李华
网站建设 2026/7/20 20:44:04

Wan2.2-T2V-A14B部署指南:快速构建高保真视频生成能力

Wan2.2-T2V-A14B部署指南&#xff1a;快速构建高保真视频生成能力 在影视制作周期动辄数月、广告创意反复打磨的今天&#xff0c;有没有可能让一段“脑海中的画面”瞬间变成可播放的高清视频&#xff1f;不是草图&#xff0c;不是分镜&#xff0c;而是真正动作连贯、光影自然、…

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

《机器人:智能时代的“钢铁伙伴“》

机器人&#xff1a;智能时代的"钢铁伙伴" 一、机器人的本质与定义 机器人(Robot) 是一种集成机械、电子、控制和人工智能技术的智能装置&#xff0c;具备三大核心能力&#xff1a;感知(通过传感器"看"和"感觉")、决策(借助AI"思考")和…

作者头像 李华
网站建设 2026/7/21 12:13:30

OpenAI gpt-oss-20b 模型部署与优化全指南

OpenAI gpt-oss-20b 模型部署与优化全指南 你有没有遇到过这样的困境&#xff1a;手握一个参数高达210亿的语言模型&#xff0c;却因为显存不足、推理延迟高、部署流程复杂而不得不放弃本地运行&#xff1f;更别提在企业生产环境中稳定服务了。传统大模型动辄需要A100集群和百G…

作者头像 李华