调用ORACLE ERP标准过程展开BOM
上一篇 / 下一篇 2008-02-13 16:03:54 / 个人分类:Oracle ERP
转自:MetaLink 几番周折终于实现了ORACLE ERP BOM的完美展开
| Subject: | Bompexpl.exploder_userexit Does Not Seem To Populate the BOM_EXPLOSION_TEMP Table | |||
| Doc ID: | Note:332133.1 | Type: | PROBLEM | |
| Last Revision Date: | 24-AUG-2005 | Status: | PUBLISHED | |
In this Document
/t1q u:ZK1|j0 SymptomsITPUB个人空间q2aq$Mei
CauseITPUB个人空间mxMs*^ y7a
Solution
IcL8Q'pv0
Applies to:
Oracle Bills of Material - Version: 11.5.9
s
H
Q'H:y7Y$fY!H0This problem can occur on any platform.
W9U Gq5f9^A0bompexpl.exploder_userexit
Symptoms
The BOM exploder userexit is run (bompexpl.exploder_userexit) and seems to complete successfully.ITPUB个人空间UP8v W
_6yG
The exploder is supposed to explode a bill into the BOM_EXPLOSION_TEMP table. However, the BOM_EXPLOSION_TEMP table is empty.
Code used to call the exploder:
--
-- BOM Exploder Userexit Example
-- Calls the bompexpl.exploder_userexit to explode a single item in a single org
-- Change v_item and v_org to suitable values
--
set serveroutput on
declare
v_item varchar2(240) := 'AS54888'; -- item to explode
v_org varchar2(3) := 'M1'; -- org in which item is exploded
v_cnt NUMBER := 0;
v_err_msg varchar2(240);
v_err_code NUMBER := 0;
v_verify_flag NUMBER := 0; -- DEFAULT 0
v_online_flag NUMBER := 2; -- DEFAULT 0
v_item_id NUMBER := 0; -- set to inventory_item_id of item to explode
v_org_id NUMBER := 0; -- set to organization_id of item to explode
v_alternate VARCHAR2(240) := NULL; -- DEFAULT null
v_list_id NUMBER := 0; -- for reports (default 0)
v_order_by NUMBER := 1; -- DEFAULT 1
v_grp_id NUMBER := 0; --
v_session_id NUMBER := 0; -- DEFAULT 0
v_req_id NUMBER := 0; -- DEFAULT 0
v_prgm_appl_id NUMBER := -1; -- DEFAULT -1
v_prgm_id NUMBER := -1; -- DEFAULT -1
v_levels_to_explode NUMBER := 1; -- DEFAULT 1
v_bom_or_eng NUMBER := 1; -- DEFAULT 1
v_impl_flag NUMBER := 1; -- DEFAULT 1
v_plan_factor_flag NUMBER := 2; -- DEFAULT 2
v_incl_lt_flag NUMBER := 2; -- DEFAULT 2
v_explode_option NUMBER := 2; -- DEFAULT 2
v_module NUMBER := 2; -- DEFAULT 2
v_cst_type_id NUMBER := 0; -- DEFAULT 0
v_std_comp_flag NUMBER := 0; -- DEFAULT 0
v_rev_date VARCHAR2(240); --
v_comp_code VARCHAR2(240) := NULL; --
v_expl_qty NUMBER := 1; -- DEFAULT 1
begin
-- item revision will be based on this explode date.
-- In this example, we use current date/time
v_rev_date := to_char(SYSDATE);
-- Find org_id
select mp.organization_id into v_org_id
from MTL_PARAMETERS mp
where mp.organization_code = v_org;
-- Find item_id
select inventory_item_id into v_item_id
from MTL_ITEM_FLEXFIELDS
where organization_id = v_org_id and item_number = v_item;
-- v_grp_id is a unique identifier for this run of the exploder
select bom_explosion_temp_s.nextval into v_grp_id from dual;
-- determine maximum levels to explode from bom_explosions
select maximum_bom_level into v_levels_to_explode
from bom_parameters where organization_id = v_org_id;
apps.bompexpl.exploder_userexit (
v_verify_flag,
v_org_id,
v_order_by,
v_grp_id,
v_session_id,
v_levels_to_explode,
v_bom_or_eng,
v_impl_flag,
v_plan_factor_flag,
v_explode_option,
v_module,
v_cst_type_id,
v_std_comp_flag,
v_expl_qty,
v_item_id,
v_alternate,
v_comp_code,
v_rev_date,
v_err_msg,
v_err_code);
if ( v_err_code <> 0 ) then
rollback;
dbms_output.put_line('ERROR: ' || v_err_msg);
else
select count(*) into v_cnt from bom_explosion_temp where group_id=v_grp_id;
dbms_output.put_line('Count=' || v_cnt);
commit;
dbms_output.put_line('.');
dbms_output.put_line('Group Id=' || v_grp_id);
dbms_output.put_line('Org =' || v_org);
dbms_output.put_line('Item =' || v_item);
dbms_output.put_line('Ord Id =' || v_org_id);
dbms_output.put_line('Item Id=' || v_item_id);
dbms_output.put_line('Levels =' || v_levels_to_explode);
end if;
end;
/Cause
The BOM_EXPLOSION_TEMP table is a global temporary table. Data written to the table is automatically
n!H|@%dU2U0removed after the SQL*PLUS session terminates. In addition, the data written in one SQL*PLUS session is
(^d.J+y.|(y4l`;q7G3E0not available to any other SQL*PLUS session.ITPUB个人空间?)f;`@Nc}+cu
Solution
In the same SQL*PLUS session in which the exploder userexit is run, copy the data from the BOM_EXPLOSION_TEMP
G$dn+A@ DV0table to another user created temporary table since the data in the BOM_EXPLOSION_TEMP table is only available to
m9b wDMva&v}B0the session in which you run the exploder and is deleted afterward. For example:
- Start SQL*PLUS
- Create a new table to hold the BOM_EXPLOSION_TEMP dataITPUB个人空间x6p
H;{.R7F
ITPUB个人空间h5G0OS5lpMY r/b3L~
SQL> create table BOM_EXPLOSION_TEMP_SAVE as select * from BOM_EXPLOSION_TEMP; - Run the exploder in this same session
~Ikk b5{q0
6_7Uo,]_2cJvrCZ0SQL> @<<Name_Of_Script_That_Calls_Exploder>> - Copy the explosion data created by the exploder userexit into the new table you created
0}$Xf K m Jj;}|0ITPUB个人空间o-g,N}0]Ue_
SQL> insert into BOM_EXPLOSION_TEMP_SAVE select * from BOM_EXPLOSION_TEMP;ITPUB个人空间7D.w0Fou6N
ITPUB个人空间3w a^fb2AU9C)o5Qjx
SQL> commit; - Exit SQL*PLUSITPUB个人空间;{6l~`
A6S"[m)d
L
ITPUB个人空间AK&R6pWh!g1@`7?
When you exit, all data created for this session is automatically deleted from BOM_EXPLOSION_TEMPITPUB个人空间&h&l;b$O&d4D"X
because it is a global temporary table. - Your explosion data should now reside in the BOM_EXPLOSION_TEMP_SAVE table.
相关阅读:
- [原创]Oracle ERP展开BOM结构树的SQL (ysfabm, 2008-1-15)
- 关于merge into 的使用 (小鸡飞过海, 2008-1-18)
- Oracle的数据扩展 (chenqilong, 2008-1-22)
- Oracle 8i 密码验证 (Dodd, 2008-1-23)
- Oracle9i LogMiner实验记录 (Dodd, 2008-1-23)
- Oracle DBSNMP进程 (Dodd, 2008-1-23)
- Oracle数据库字符集介绍 (oracle_kai, 2008-1-24)
- Oracle DataGuard Standby database ID mismatch错误 (Dodd, 2008-1-30)
- Oracle 10g 两个监听进程的故障 (Dodd, 2008-1-30)
- Oracle 时间戳 (kjh2004yjn, 2008-2-12)
导入论坛 引用链接 收藏 分享给好友 推荐到圈子 管理 举报
