壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1865|回复: 0

關於報表開發的問題

[复制链接]
发表于 2007/5/12 16:37:06 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
在咝袌蟊碇埃視行before Report這個Report trigger,
裡面的程序是以下,大俠們幫忙看看有沒有錯誤。
function BeforePForm return boolean is
begin
  SRW.USER_EXIT('FND SRWINIT');
--  dbms_application_info.set_client_info('262');
  select gsb.name into :p_company
    from
gl_sets_of_books gsb,financials_system_parameters fsp
  where  gsb.set_of_books_id=fsp.set_of_books_id;
declare
   x_inventory_item_id     MTL_SYSTEM_ITEMS.INVENTORY_ITEM_ID%TYPE;
   x_Group_Id              Number;
   x_organization_id       number;
CURSOR C_find_bom IS
select distinct msi.segment1 Part_number,msi.organization_id
from bom_bill_of_materials bbom,
      mtl_system_items msi
where msi.organization_id = bbom.organization_id
   and msi.inventory_item_id = bbom.assembly_item_id
   and msi.segment1 like '4111%'
   and msi.item_type like 'Anctive'
   and msi.organization_id =433;
BEGIN
  delete from MKL_FP_BOM_LISTS;
  commit;
  delete from mkl_fp_shortage_bom_temp;
  commit;
  delete from Surplus_shortage_detail;
FOR C2 IN C_find_bom LOOP
   
   Select MKL_FP_BOM_LISTS_S.Nextval Into x_Group_Id From Dual;
   SELECT inventory_item_id,organization_id  
     INTO x_inventory_item_id,x_organization_id
     FROM  mtl_system_items
     WHERE segment1=C2.part_number
       AND organization_id=c2.organization_id;
   Insert Into mkl_fp_BOM_LISTS (group_id,organization_id, Assembly_Item_Id)
   Values (x_Group_Id,x_organization_id,x_inventory_Item_Id);
   mkl_shortage_bom_exploder(x_Group_Id,x_organization_id,x_inventory_Item_Id, 0, sysdate, 1, 1, 60, Null);
   commit;
   END LOOP;
  insert into SURPLUS_SHORTAGE_DETAIL
((select distinct msi1.segment1,msi1.description, msi2.segment1,
       msi2.description, msi1.organization_id
from mkl_fp_shortage_BOM_TEMP a,
     mkl_fp_shortage_BOM_TEMP b,
     mtl_system_items msi1,
     mtl_system_items msi2
where a.organization_id = b.organization_id
  and a.top_parent_item_id <>b.top_parent_item_id
  and a.organization_id = msi1.organization_id
  and a.top_parent_item_id = msi1.inventory_item_id
  and a.item_number = b.item_number
  and b.component_s_exists_flag <>1
  and b.organization_id = msi2.organization_id
  and b.top_parent_item_id = msi2.inventory_item_id
  and a.substitute_flag <>1
  and substr(a.item_number,1,4) in
    (select f.item_prefix
     from fp.mkl_fp_parts_list f
     where f.category =(_Category)
       and f.disable_date is null))   
intersect
(select distinct msi1.segment1,msi1.description, msi2.segment1,
       msi2.description, msi1.organization_id
from mkl_fp_shortage_BOM_TEMP a,
     mkl_fp_shortage_BOM_TEMP b,
     mtl_system_items msi1,
     mtl_system_items msi2
where a.organization_id = b.organization_id
  and a.top_parent_item_id <>b.top_parent_item_id
  and a.organization_id = msi1.organization_id
  and a.top_parent_item_id = msi1.inventory_item_id
  and a.item_number = b.item_number
  and b.component_s_exists_flag <>1
  and a.substitute_flag <>1
  and b.organization_id = msi2.organization_id
  and b.top_parent_item_id = msi2.inventory_item_id
  and substr(a.item_number,1,4) in
   (select f.item_prefix
     from fp.mkl_fp_parts_list f
     where f.category in (select decode((:P_Category2),null,(:P_Category)) from dual)
       and f.disable_date is null))
intersect
(select distinct msi1.segment1,msi1.description, msi2.segment1,
       msi2.description, msi1.organization_id
from mkl_fp_shortage_BOM_TEMP a,
     mkl_fp_shortage_BOM_TEMP b,
     mtl_system_items msi1,
     mtl_system_items msi2
where a.organization_id = b.organization_id
  and a.top_parent_item_id <>b.top_parent_item_id
  and a.organization_id = msi1.organization_id
  and a.top_parent_item_id = msi1.inventory_item_id
  and a.item_number = b.item_number
  and b.component_s_exists_flag <>1
  and a.substitute_flag <>1
  and b.organization_id = msi2.organization_id
  and b.top_parent_item_id = msi2.inventory_item_id
  and substr(a.item_number,1,4) in
   (select f.item_prefix
     from fp.mkl_fp_parts_list f
     where f.category in (select decode((:P_Category3),null,(:P_Category)) from dual)
       and f.disable_date is null))
intersect
(select distinct msi1.segment1,msi1.description, msi2.segment1,
       msi2.description, msi1.organization_id
from mkl_fp_shortage_BOM_TEMP a,
     mkl_fp_shortage_BOM_TEMP b,
     mtl_system_items msi1,
     mtl_system_items msi2
where a.organization_id = b.organization_id
  and a.top_parent_item_id <>b.top_parent_item_id
  and a.organization_id = msi1.organization_id
  and a.top_parent_item_id = msi1.inventory_item_id
  and a.item_number = b.item_number
  and a.substitute_flag <>1
  and b.component_s_exists_flag <>1
  and b.organization_id = msi2.organization_id
  and b.top_parent_item_id = msi2.inventory_item_id
  and substr(a.item_number,1,4) in
   (select f.item_prefix
     from fp.mkl_fp_parts_list f
     where f.category in (select decode((:P_Category4),null,(:P_Category)) from dual)
       and f.disable_date is null)));
end;
  return (TRUE);
end;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/30 15:04 , Processed in 0.011986 second(s), 14 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表