--erp系统里的bom展开函数:
declare
l_grp_id number;
l_session_id number;
l_org_id number;
l_levels_to_explode number := 10;
l_module number default 2; -- bom = 2
l_cst_type_id number default - 1; -- all cost = -1 else 0
l_item_id number;
l_bom_or_eng number;
l_using_req_quantity number;
l_using_ass_dem_date date;
l_rev_date varchar2(20) := to_char(bom_dt, 'DD-MON-YY HH24:MI');
l_err_msg varchar2(250);
l_error_code number;
begin
-- 首先要有一个group id
select bom_explosion_temp_s.nextval into l_grp_id from dual;
-- 其次要得到一个session id
select bom_explosion_temp_session_s.nextval into l_session_id from dual;
bompexpl.exploder_userexit(verify_flag => 0,
org_id => l_org_id,
order_by => 1,
grp_id => l_grp_id,
session_id => l_session_id,
levels_to_explode => l_levels_to_explode,
bom_or_eng => l_bom_or_eng,
impl_flag => 1,
plan_factor_flag => 2,
explode_option => 2, -- 2,
module => l_module,
cst_type_id => l_cst_type_id,
std_comp_flag => 2,
expl_qty => 1,
item_id => l_item_id,
alt_desg => '',
comp_code => '',
rev_date => l_rev_date,
err_msg => l_err_msg,
error_code => l_error_code);
end;
/*运行结束后用以下语句得到结果
select * from bom_explosion_temp bet
where bet.group_id = l_grp_id*/