zoukankan      html  css  js  c++  java
  • 批量更新 ITEM 物料属性

    由于期初物料导入有问题,需要批量修改 物料说明, 只能通过 创建临时表 、调用API 的方式。

    DECLARE
      l_item_rec      inv_item_grp.item_rec_type;
      l_error_tbl     inv_item_grp.error_tbl_type;
      x_item_rec      inv_item_grp.item_rec_type;
      l_return_status VARCHAR2(40);
    
      l_inventory_item_id NUMBER;
    BEGIN
    
      dbms_output.enable(1000000);
    
      FOR r IN (SELECT tmp.seq_no, tmp.item_number, tmp.item_description
                  FROM cux.cux_item_temp tmp) LOOP
      
        SELECT msi.inventory_item_id
          INTO l_inventory_item_id
          FROM mtl_system_items_b msi
         WHERE msi.organization_id = 88 --主组织
           AND msi.segment1 = r.item_number;
      
        inv_globals.set_org_id(88);
      
        fnd_global.apps_initialize(1150, 50679, 401); --userid,resposi_id,app_id
      
        -- 更新标准物料表属性
        l_item_rec.inventory_item_id := l_inventory_item_id;
        l_item_rec.organization_id   := 88; --You master organization
        l_item_rec.description       := r.item_description;
      
        inv_item_grp.update_item(p_commit           => fnd_api.g_false,
                                 p_lock_rows        => fnd_api.g_true,
                                 p_validation_level => fnd_api.g_valid_level_full,
                                 p_item_rec         => l_item_rec,
                                 x_item_rec         => x_item_rec,
                                 x_return_status    => l_return_status,
                                 x_error_tbl        => l_error_tbl);
      
        dbms_output.put_line(r.seq_no || ',物料说明更新成功:' || l_return_status);
      
        IF l_error_tbl.count() > 0 THEN
          FOR i IN 1 .. l_error_tbl.count LOOP
            dbms_output.put_line(r.seq_no || ',更新失败: ' || l_error_tbl(i).message_text);
            dbms_output.put_line(r.seq_no || ',更新失败: ' || l_error_tbl(i).message_name);
          END LOOP;
        END IF;
      
        --COMMIT;
      
      END LOOP;
    END;
  • 相关阅读:
    非常牛的实现三个数交换
    assert后面如果是假则程序崩溃
    python三元操作符
    三种方法划分成绩等级
    爱因斯坦难题
    打印奇数
    判断给到的年份是否为闰年
    【bzoj1895】Pku3580 supermemo Splay
    【bzoj1050】[HAOI2006]旅行comf 并查集
    【bzoj4002】[JLOI2015]有意义的字符串 数论+矩阵乘法
  • 原文地址:https://www.cnblogs.com/Cqiang/p/3570956.html
Copyright © 2011-2022 走看看