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 := 0;
l_mesg_len number;
l_mesg varchar2(4000);
begin
FOR I IN (select
B.*
from
fa_additions a,
fa_books_v b
where
a.asset_id = b.asset_id
AND BOOK_TYPE_CODE = '???????'
AND SALVAGE_VALUE = 0
--AND B.ASSET_ID IN (99437,99438)
AND NOT EXISTS(
SELECT 1
FROM FA_RETIREMENTS FR
WHERE ASSET_ID = B.ASSET_ID
)
ORDER BY B.ASSET_id
) LOOP
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 := I.ASSET_ID;
l_asset_hdr_rec.book_type_code := '???????';
-- fin info
-- l_asset_fin_rec_adj.cost := 24000;
l_asset_fin_rec_adj.SALVAGE_TYPE := 'AMT';
l_asset_fin_rec_adj.SALVAGE_VALUE := 1;
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,
x_return_status => l_return_status,
x_msg_count => l_mesg_count,
x_msg_data => l_mesg,
p_calling_fn => 'ADJ_TEST_SCRIPT',
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,
--px_inv_rate_tbl => l_inv_rate_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
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('asset_id' ||i.asset_id ||
to_char(l_trans_rec.transaction_header_id));
end if;
END LOOP;
end;
commit;
This blog is sharing knowledge of my experience and others. Please do test in your test environment before deploying into prod instance.
Search This Blog
Monday, November 6, 2023
R12 Salvage value update API
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment