OracleAssetsAdjustmentsAPI
2026-01-23 16:49阅读:
Oracle Assets Adjustments API
示例脚本:不使用发票信息调用调整API
以下示例演示了在无发票信息且无报告货币的情况下调整资产。本例中,我们将成本增加600,000美元(即当前成本100,000美元,新成本700,000美元)。脚本填充必要结构后调用调整API。请注意,仅在FIN_REC_TYPE中填充差额成本,因为这是唯一需要变更的项。其余所有值均由API内部自动推导生成。
set serveroutput on
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;
l_mesg
varchar2(512);
begin
dbms_output.enable(10000000);
FA_SRVR_MSG.Init_Server_Message;
-- asset header info
l_asset_hdr_rec.asset_id
:= &asset_id
l_asset_hdr_rec.book_type_code := '&book';
-- fin rec info
l_asset_fin_rec_adj.cost
:= &delta_cost
FA_ADJUSTMENT_PUB.do_adjustment(
-- std parameters
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
=>
null,
x_return_status
=>
l_return_status,
x_msg_count
=>
l_mesg_count,
x_msg_data
=>
l_mesg,
-- api parameters
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
);
--dump messages
l_mesg_count := fnd_msg_pub.count_msg;
if l_mesg_count > 0 then
l_mesg := chr(10) ||
substr(fnd_msg_pub.get
(fnd_msg_pub.G_FIRST, fnd_api.G_FALSE),
1, 250);
dbms_output.put_line(l_mesg);
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, 250);
dbms_output.put_line(l_mesg);
end loop;
fnd_msg_pub.delete_msg();
end if;
if (l_return_status <>
FND_API.G_RET_STS_SUCCESS) then
dbms_output.put_line('FAILURE');
else
dbms_output.put_line('SUCCESS');
dbms_output.put_line('THID' ||
to_char(l_trans_rec.transaction_header_id));
dbms_output.put_line('ASSET_ID' ||
to_char(l_asset_hdr_rec.asset_id));
end if;
end;
/
示例脚本:使用调整API处理发票信息
以下示例模拟通过关联单一报告货币的发票明细行调整资产。该脚本先填充所需结构,随后调用调整API。本例中,我们向资产新增一条发票明细行,发票成本为5000美元。请注意财务结构保持为空值,因为如文档先前所述,私有发票API将负责根据所有发票结构的总和计算成本基础的总变动额。
set serveroutput on
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;
l_mesg
varchar2(512);
begin
dbms_output.enable(10000000);
FA_SRVR_MSG.Init_Server_Message;
-- asset header info
l_asset_hdr_rec.asset_id
:= &asset_id
l_asset_hdr_rec.book_type_code := '&book';
-- invoice trans
l_inv_trans_rec.transaction_type
:= 'INVOICE ADDITION';
-- invoice info
l_inv_rec.fixed_assets_cost
:= 2500;
l_inv_rec.deleted_flag
:=
'NO';
l_inv_rec.description
:=
'test inv';
l_inv_rec.unrevalued_cost
:= 5555;
l_inv_rec.create_batch_id
:= 1000;
l_inv_rec.payables_code_combination_id
:= 13528;
l_inv_rec.feeder_system_name
:= 'ACK';
l_inv_rec.payables_cost
:=
5555;
l_inv_rec.payables_units
:= 1;
l_inv_rec.po_vendor_id
:=
1;
l_inv_rec.inv_indicator
:= 1;
l_inv_tbl (1)
:= l_inv_rec;
FA_ADJUSTMENT_PUB.do_adjustment(
-- std parameters
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