码迷,mamicode.com
首页 > 其他好文 > 详细

更新物料存储期限

时间:2015-01-05 13:04:37      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:

DECLARE
   l_item_rec      inv_item_grp.item_rec_type;
   x_item_rec      inv_item_grp.item_rec_type;
   l_error_tbl     inv_item_grp.error_tbl_type;
   l_error_msg     VARCHAR2(4000);
   x_return_status VARCHAR2(30);

   CURSOR cur_item IS
      SELECT *
        FROM mtl_system_items_b l
       WHERE l.item_type = ‘TIRES‘
         AND l.shelf_life_days <> 3650;
BEGIN

   FOR rec_item IN cur_item LOOP
      l_item_rec := inv_item_grp.g_miss_item_rec;
   
      l_item_rec.organization_id := rec_item.organization_id;
      --l_item_rec.organization_code := rec_item.organization_code;
      l_item_rec.segment1                    := rec_item.segment1;
      l_item_rec.segment2                    := rec_item.segment2;
      l_item_rec.description                 := rec_item.description;
      l_item_rec.shelf_life_days             := 3650; --rec_item.shelf_life_days;
      l_item_rec.forecast_horizon            := rec_item.forecast_horizon; --成熟天数    
      l_item_rec.tax_code                    := rec_item.tax_code;
      l_item_rec.min_minmax_quantity         := rec_item.min_minmax_quantity;
      l_item_rec.max_minmax_quantity         := rec_item.max_minmax_quantity;
      l_item_rec.process_supply_subinventory := rec_item.process_supply_subinventory;
      l_item_rec.attribute16                 := rec_item.attribute16; --对应通知单行
      l_item_rec.attribute2                  := rec_item.attribute2; --产成品简称
      l_item_rec.attribute6                  := rec_item.attribute6; --原麦汁浓度
      l_item_rec.primary_uom_code            := rec_item.primary_uom_code;
      l_item_rec.cost_of_sales_account       := rec_item.cost_of_sales_account;
      l_item_rec.sales_account               := rec_item.sales_account;
      l_item_rec.buyer_id                    := rec_item.buyer_id;
      l_item_rec.expense_account             := rec_item.expense_account;
      l_item_rec.process_supply_locator_id   := rec_item.process_supply_locator_id;
      l_item_rec.attribute5                  := rec_item.attribute5;
      l_item_rec.attribute1                  := rec_item.attribute1;
   
      inv_item_grp.update_item(p_commit        => fnd_api.g_true,
                               p_item_rec      => l_item_rec,
                               x_item_rec      => x_item_rec,
                               x_return_status => x_return_status,
                               x_error_tbl     => l_error_tbl,
                               p_template_id   => NULL);
   
      IF x_return_status <> fnd_api.g_ret_sts_success THEN
      
        /* FOR i IN 1 .. l_error_tbl.last LOOP
            l_error_msg := substrb(l_error_msg || l_error_tbl(i)
                                   .column_name || ‘:‘ || l_error_tbl(i)
                                   .message_text || ‘#‘,
                                   1,
                                   200);
         END LOOP;*/
         dbms_output.put_line(rec_item.segment1 || ‘.‘ ||
                              rec_item.segment2 || ‘ 出错:‘ || l_error_msg);
      END IF;
   
   END LOOP; --FOR rec_item IN cur_item LOOP
END;

更新物料存储期限

标签:

原文地址:http://blog.csdn.net/cai_xingyun/article/details/42420171

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!