设为首页 收藏本站
查看: 989|回复: 0

[经验分享] ORACLE EBS BOM 展开(使用标准程序bompexpl.exploder_userexit展开)

[复制链接]

尚未签到

发表于 2015-9-23 09:48:47 | 显示全部楼层 |阅读模式
  
  create or replace package cux_bom_pub is
  PROCEDURE bom_expand_to_temp(
    p_organization_id number,
    p_item_id VARCHAR2,
    p_levels_to_explode NUMBER);
end cux_bom_pub;
  create or replace package body cux_bom_pub is
  --g_session_id  NUMBER;
  g_bom_cnt     NUMBER := 0;
  PROCEDURE bom_expand_to_temp(
    p_organization_id number,
    p_item_id VARCHAR2,
    p_levels_to_explode NUMBER) IS
  --  PRAGMA AUTONOMOUS_TRANSACTION;
    --v_cnt         number;
    l_grp_id      number ;
    l_session_id  number ;
   -- l_org_id      number ;
    l_levels_to_explode number;
    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:=1 ;--1 bom 2 eng
    l_rev_date    varchar2(30):= to_char(sysdate, 'YYYY/MM/DD HH24:MI:SS'); --Must be this
    l_err_msg     varchar2(250) ;
    l_error_code  number ;
   -- l_cnt         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 ;
  -- Find item_id
      l_item_id := p_item_id;
    /*select inventory_item_id
    into l_item_id
    from mtl_system_items_b --   mtl_item_flexfields
    where organization_id = p_organization_id and segment1 = p_item_no;
    */
    -- determine maximum levels to explode from bom_explosions
    IF p_levels_to_explode IS NULL THEN
    select maximum_bom_level
      into l_levels_to_explode
      from bom_parameters
     where organization_id = p_organization_id;
    ELSE
      l_levels_to_explode := p_levels_to_explode;
    END IF;
  delete bom.bom_explosion_temp;-- where top_item_id =l_item_id;
   
  --delete bom_explosion_temp;
   -- commit;
  bompexpl.exploder_userexit(
                                verify_flag =>0, -- DEFAULT 0
                                org_id =>p_organization_id,
                                order_by =>1, -- DEFAULT 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,        -- DEFAULT 1
                                plan_factor_flag =>2, -- DEFAULT 2
                                explode_option =>2,   -- DEFAULT 2
                                module =>l_module,    -- DEFAULT 2
                                cst_type_id =>l_cst_type_id,
                                std_comp_flag =>0,
                                expl_qty =>1,         -- DEFAULT 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
                                );
  
    if ( l_error_code <> 0 ) then
      -- rollback;
       dbms_output.put_line('ERROR: ' || l_err_msg);
    else
       INSERT INTO cux_explosion_temp(
        top_bill_sequence_id        ,
        bill_sequence_id            ,
        organization_id             ,
        component_sequence_id       ,
        component_item_id           ,
        plan_level                  ,
        extended_quantity           ,
        sort_order                  ,
        request_id                  ,
        program_application_id      ,
        program_id                  ,
        program_update_date         ,
        group_id                    ,
        session_id                  ,
        select_flag                 ,
        select_quantity             ,
        extend_cost_flag            ,
        top_alternate_designator    ,
        top_item_id                 ,
        context                     ,
        attribute1                  ,
        attribute2                  ,
        attribute3                  ,
        attribute4                  ,
        attribute5                  ,
        attribute6                  ,
        attribute7                  ,
        attribute8                  ,
        attribute9                  ,
        attribute10                 ,
        attribute11                 ,
        attribute12                 ,
        attribute13                 ,
        attribute14                 ,
        attribute15                 ,
        header_id                   ,
        line_id                     ,
        list_price                  ,
        selling_price               ,
        component_yield_factor      ,
        item_cost                   ,
        include_in_rollup_flag      ,
        based_on_rollup_flag        ,
        actual_cost_type_id         ,
        component_quantity          ,
        shrinkage_rate              ,
        so_basis                    ,
        optional                    ,
        mutually_exclusive_options  ,
        check_atp                   ,
        shipping_allowed            ,
        required_to_ship            ,
        required_for_revenue        ,
        include_on_ship_docs        ,
        include_on_bill_docs        ,
        low_quantity                ,
        high_quantity               ,
        pick_components             ,
        primary_uom_code            ,
        primary_unit_of_measure     ,
        base_item_id                ,
        atp_components_flag         ,
        atp_flag                    ,
        bom_item_type               ,
        pick_components_flag        ,
        replenish_to_order_flag     ,
        shippable_item_flag         ,
        customer_order_flag         ,
        internal_order_flag         ,
        customer_order_enabled_flag ,
        internal_order_enabled_flag ,
        so_transactions_flag        ,
        mtl_transactions_enabled_flag,
        stock_enabled_flag          ,
        description                 ,
        assembly_item_id            ,
        alternate_bom_designator    ,
        configurator_flag           ,
        price_list_id               ,
        rounding_factor             ,
        pricing_context             ,
        pricing_attribute1          ,
        pricing_attribute2          ,
        pricing_attribute3          ,
        pricing_attribute4          ,
        pricing_attribute5          ,
        pricing_attribute6          ,
        pricing_attribute7          ,
        pricing_attribute8          ,
        pricing_attribute9          ,
        pricing_attribute10         ,
        pricing_attribute11         ,
        pricing_attribute12         ,
        pricing_attribute13         ,
        pricing_attribute14         ,
        pricing_attribute15         ,
        component_code              ,
        loop_flag                   ,
        inventory_asset_flag        ,
        planning_factor             ,
        operation_seq_num           ,
        parent_bom_item_type        ,
        wip_supply_type             ,
        item_num                    ,
        effectivity_date            ,
        disable_date                ,
        implementation_date         ,
        supply_subinventory         ,
        supply_locator_id           ,
        component_remarks           ,
        change_notice               ,
        operation_lead_time_percent ,
        rexplode_flag               ,
        common_bill_sequence_id     ,
        common_organization_id      ,
        primary_path_flag           ,
        auto_request_material       ,
        explosion_type              ,
        creation_date               ,
        created_by                  ,
        last_update_date            ,
        last_updated_by             ,
        comp_bill_seq_id            ,
        comp_common_bill_seq_id     ,
        num_col1                    ,
        num_col2                    ,
        num_col3                    ,
        date_col1                   ,
        date_col2                   ,
        date_col3                   ,
        char_col1                   ,
        char_col2                   ,
        char_col3                   ,
        include_in_cost_rollup      ,
        parent_sort_order           ,
        structure_type_id           ,
        obj_name                    ,
        pk1_value                   ,
        pk2_value                   ,
        pk3_value                   ,
        pk4_value                   ,
        pk5_value                   ,
        hgrid_flag                  ,
        operation_offset            ,
        current_revision            ,
        locator                     ,
        suggested_vendor_name       ,
        unit_price                  ,
        vendor_id                   ,
        from_end_item_unit_number   ,
        to_end_item_unit_number     ,
        from_end_item_rev_id        ,
        from_end_item_minor_rev_id  ,
        to_end_item_rev_id          ,
        to_end_item_minor_rev_id    ,
        new_component_code          ,
        from_bill_revision_id       ,
        to_bill_revision_id         ,
        revision_id                 ,
        revision_label              ,
        effectivity_control         ,
        access_flag                 ,
        eng_item_flag               ,
        assembly_type               ,
        from_object_revision_id     ,
        from_minor_revision_id      ,
        to_object_revision_id       ,
        to_minor_revision_id        ,
        object_revision_id          ,
        minor_revision_id           ,
        minor_revision_code         ,
        component_item_revision_id  ,
        component_minor_revision_id ,
        bom_implementation_date     ,
        gtin_number                 ,
        gtin_description            ,
        trade_item_descriptor       ,
        top_gtin_number             ,
        top_gtin_description        ,
        top_trade_item_descriptor   ,
        parent_gtin_number          ,
        parent_gtin_description     ,
        parent_trade_item_descriptor,
        trade_item_descriptor_desc  ,
        gtin_publication_status     ,
        quantity_of_children        ,
        total_qty_at_next_level     ,
        change_id                   ,
        acd_type                    ,
        quantity_related            ,
        change_policy_value         ,
        exploded_date               ,
        exploded_unit_number        ,
        exploded_end_item_rev       ,
        exploded_option             ,
        basis_type)
        SELECT top_bill_sequence_id,
  bill_sequence_id            ,
  organization_id             ,
  component_sequence_id       ,
  component_item_id           ,
  plan_level                  ,
  extended_quantity           ,
  sort_order                  ,
  request_id                  ,
  program_application_id      ,
  program_id                  ,
  program_update_date         ,
  group_id                    ,
  session_id                  ,
  select_flag                 ,
  select_quantity             ,
  extend_cost_flag            ,
  top_alternate_designator    ,
  top_item_id                 ,
  context                     ,
  attribute1                  ,
  attribute2                  ,
  attribute3                  ,
  attribute4                  ,
  attribute5                  ,
  attribute6                  ,
  attribute7                  ,
  attribute8                  ,
  attribute9                  ,
  attribute10                 ,
  attribute11                 ,
  attribute12                 ,
  attribute13                 ,
  attribute14                 ,
  attribute15                 ,
  header_id                   ,
  line_id                     ,
  list_price                  ,
  selling_price               ,
  component_yield_factor      ,
  item_cost                   ,
  include_in_rollup_flag      ,
  based_on_rollup_flag        ,
  actual_cost_type_id         ,
  component_quantity          ,
  shrinkage_rate              ,
  so_basis                    ,
  optional                    ,
  mutually_exclusive_options  ,
  check_atp                   ,
  shipping_allowed            ,
  required_to_ship            ,
  required_for_revenue        ,
  include_on_ship_docs        ,
  include_on_bill_docs        ,
  low_quantity                ,
  high_quantity               ,
  pick_components             ,
  primary_uom_code            ,
  primary_unit_of_measure     ,
  base_item_id                ,
  atp_components_flag         ,
  atp_flag                    ,
  bom_item_type               ,
  pick_components_flag        ,
  replenish_to_order_flag     ,
  shippable_item_flag         ,
  customer_order_flag         ,
  internal_order_flag         ,
  customer_order_enabled_flag ,
  internal_order_enabled_flag ,
  so_transactions_flag        ,
  mtl_transactions_enabled_flag,
  stock_enabled_flag          ,
  description                 ,
  assembly_item_id            ,
  alternate_bom_designator    ,
  configurator_flag           ,
  price_list_id               ,
  rounding_factor             ,
  pricing_context             ,
  pricing_attribute1          ,
  pricing_attribute2          ,
  pricing_attribute3          ,
  pricing_attribute4          ,
  pricing_attribute5          ,
  pricing_attribute6          ,
  pricing_attribute7          ,
  pricing_attribute8          ,
  pricing_attribute9          ,
  pricing_attribute10         ,
  pricing_attribute11         ,
  pricing_attribute12         ,
  pricing_attribute13         ,
  pricing_attribute14         ,
  pricing_attribute15         ,
  component_code              ,
  loop_flag                   ,
  inventory_asset_flag        ,
  planning_factor             ,
  operation_seq_num           ,
  parent_bom_item_type        ,
  wip_supply_type             ,
  item_num                    ,
  effectivity_date            ,
  disable_date                ,
  implementation_date         ,
  supply_subinventory         ,
  supply_locator_id           ,
  component_remarks           ,
  change_notice               ,
  operation_lead_time_percent ,
  rexplode_flag               ,
  common_bill_sequence_id     ,
  common_organization_id      ,
  primary_path_flag           ,
  auto_request_material       ,
  explosion_type              ,
  creation_date               ,
  created_by                  ,
  last_update_date            ,
  last_updated_by             ,
  comp_bill_seq_id            ,
  comp_common_bill_seq_id     ,
  num_col1                    ,
  num_col2                    ,
  num_col3                    ,
  date_col1                   ,
  date_col2                   ,
  date_col3                   ,
  char_col1                   ,
  char_col2                   ,
  char_col3                   ,
  include_in_cost_rollup      ,
  parent_sort_order           ,
  structure_type_id           ,
  obj_name                    ,
  pk1_value                   ,
  pk2_value                   ,
  pk3_value                   ,
  pk4_value                   ,
  pk5_value                   ,
  hgrid_flag                  ,
  operation_offset            ,
  current_revision            ,
  locator                     ,
  suggested_vendor_name       ,
  unit_price                  ,
  vendor_id                   ,
  from_end_item_unit_number   ,
  to_end_item_unit_number     ,
  from_end_item_rev_id        ,
  from_end_item_minor_rev_id  ,
  to_end_item_rev_id          ,
  to_end_item_minor_rev_id    ,
  new_component_code          ,
  from_bill_revision_id       ,
  to_bill_revision_id         ,
  revision_id                 ,
  revision_label              ,
  effectivity_control         ,
  access_flag                 ,
  eng_item_flag               ,
  assembly_type               ,
  from_object_revision_id     ,
  from_minor_revision_id      ,
  to_object_revision_id       ,
  to_minor_revision_id        ,
  object_revision_id          ,
  minor_revision_id           ,
  minor_revision_code         ,
  component_item_revision_id  ,
  component_minor_revision_id ,
  bom_implementation_date     ,
  gtin_number                 ,
  gtin_description            ,
  trade_item_descriptor       ,
  top_gtin_number             ,
  top_gtin_description        ,
  top_trade_item_descriptor   ,
  parent_gtin_number          ,
  parent_gtin_description     ,
  parent_trade_item_descriptor,
  trade_item_descriptor_desc  ,
  gtin_publication_status     ,
  quantity_of_children        ,
  total_qty_at_next_level     ,
  change_id                   ,
  acd_type                    ,
  quantity_related            ,
  change_policy_value         ,
  exploded_date               ,
  exploded_unit_number        ,
  exploded_end_item_rev       ,
  exploded_option             ,
  basis_type
          FROM bom_explosion_temp t;-- WHERE t.session_id = l_session_id;
       g_bom_cnt := g_bom_cnt + 1;
       IF g_bom_cnt = 1000 THEN
         commit;
         g_bom_cnt := 0;
       END IF;
    end if;
    COMMIT;
  end;
end cux_bom_pub;

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-117527-1-1.html 上篇帖子: ebs中常用的表字段及其语句 下篇帖子: oracle ebs 11i > concurrent programs –> request group –> responsibility
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

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