财务信息更改调整接口,固定资产调整

DECLARE
  l_trans_rec                 FA_API_TYPES.trans_rec_type;
  l_asset_hdr_rec             FA_API_TYPES.asset_hdr_rec_type;
  l_asset_fin_rec_adj         FA_API_TYPES.asset_fin_rec_type;
  l_asset_fin_rec_new         FA_API_TYPES.asset_fin_rec_type;
  l_asset_fin_mrc_tbl_new     FA_API_TYPES.asset_fin_tbl_type;
  l_inv_trans_rec             FA_API_TYPES.inv_trans_rec_type;
  l_inv_tbl                   FA_API_TYPES.inv_tbl_type;
  l_inv_rate_tbl              FA_API_TYPES.inv_rate_tbl_type;
  l_asset_deprn_rec_adj       FA_API_TYPES.asset_deprn_rec_type;
  l_asset_deprn_rec_new       FA_API_TYPES.asset_deprn_rec_type;
  l_asset_deprn_mrc_tbl_new   FA_API_TYPES.asset_deprn_tbl_type;
  l_inv_rec                   FA_API_TYPES.inv_rec_type;
  l_group_reclass_options_rec FA_API_TYPES.group_reclass_options_rec_type;
  l_return_status             VARCHAR2(1);
  l_mesg_count                NUMBER := 0;
  l_mesg_len                  NUMBER;
  l_mesg                      VARCHAR2(4000);
  l_current_cost              NUMBER := 0;
  l_change_cost               NUMBER := 0;
BEGIN
  fnd_profile.put('PRINT_DEBUG', 'Y');
  dbms_output.enable(1000000);
  FA_SRVR_MSG.Init_Server_Message;
  FA_DEBUG_PKG.Initialize;
  -- asset header info
  l_asset_hdr_rec.asset_id       := 67685;
  l_asset_hdr_rec.book_type_code := 'FA_301';
  -- fin info
  select fb.cost
    into l_current_cost
    from fa_books fb
   where fb.asset_id = 67685
     and fb.book_type_code = 'FA_301'
     and fb.transaction_header_id_out is null;
  l_change_cost := 500000 - l_current_cost;
  dbms_output.put_line('l_current_cost:'||l_current_cost);
  dbms_output.put_line('l_change_cost:'||l_change_cost);
  l_asset_fin_rec_adj.cost := l_change_cost;--10000;--l_change_cost;
  --l_asset_fin_rec_adj.original_cost := 1000;
  --l_asset_fin_rec_adj.adjusted_cost := 1000;
  --l_asset_fin_rec_adj.unrevalued_cost :=1000;
  --l_asset_fin_rec_new.cost :=10000;
  --l_asset_fin_rec_new.original_cost :=10000;
  --l_asset_fin_rec_new.adjusted_cost :=10000;
  fa_adjustment_pub.do_adjustment(p_api_version               => 1.0,
                                  p_init_msg_list             => FND_API.G_FALSE,
                                  p_commit                    => FND_API.G_FALSE,
                                  p_validation_level          => FND_API.G_VALID_LEVEL_FULL,
                                  p_calling_fn                => 'ADJ_TEST_SCRIPT',
                                  x_return_status             => l_return_status,
                                  x_msg_count                 => l_mesg_count,
                                  x_msg_data                  => l_mesg,
                                  px_trans_rec                => l_trans_rec,
                                  px_asset_hdr_rec            => l_asset_hdr_rec,
                                  p_asset_fin_rec_adj         => l_asset_fin_rec_adj,
                                  x_asset_fin_rec_new         => l_asset_fin_rec_new,
                                  x_asset_fin_mrc_tbl_new     => l_asset_fin_mrc_tbl_new,
                                  px_inv_trans_rec            => l_inv_trans_rec,
                                  px_inv_tbl                  => l_inv_tbl,
                                  p_asset_deprn_rec_adj       => l_asset_deprn_rec_adj,
                                  x_asset_deprn_rec_new       => l_asset_deprn_rec_new,
                                  x_asset_deprn_mrc_tbl_new   => l_asset_deprn_mrc_tbl_new,
                                  p_group_reclass_options_rec => l_group_reclass_options_rec);
  dbms_output.put_line(l_return_status);
  IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
    fa_debug_pkg.dump_debug_messages(max_mesgs => 0);
    l_mesg_count := fnd_msg_pub.count_msg;
    IF l_mesg_count > 0 THEN
      l_mesg := substr(fnd_msg_pub.get(fnd_msg_pub.G_FIRST, fnd_api.G_FALSE),
                       1,
                       512);
      dbms_output.put_line(substr(l_mesg, 1, 255));
      FOR i IN 1 .. l_mesg_count - 1 LOOP
        l_mesg := substr(fnd_msg_pub.get(fnd_msg_pub.G_NEXT,
                                         fnd_api.G_FALSE),
                         1,
                         512);
        dbms_output.put_line(substr(l_mesg, 1, 255));
      END LOOP;
      fnd_msg_pub.delete_msg();
    END IF;
  ELSE
    dbms_output.put_line('SUCCESS');
    dbms_output.put_line('THID' ||
                         to_char(l_trans_rec.transaction_header_id));
  END IF;
END;

—–需要注意的是,此方法并不是oracle的标准功能,cost字段的作用是自动与当前成本进行相加,所以调整的时候,先进行运算,看传入的值与原值的差,再传入到
—–标准API中进行运算,若是追求规范,还是应该去查看oracle官方文档中,对do_adjustment方法的介绍。

“`

猜你喜欢

转载自blog.csdn.net/lzl1101206656/article/details/80508118