0% found this document useful (0 votes)
93 views7 pages

Code For Assets

The document contains sample scripts demonstrating how to use the Additions API to add fixed assets via invoices and without invoices. The scripts declare variables, populate records with asset details, call the API, and output the results. Additional examples are provided for using an alternative ledger currency and testing manual changes.

Uploaded by

Anonymous 8fFaeq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views7 pages

Code For Assets

The document contains sample scripts demonstrating how to use the Additions API to add fixed assets via invoices and without invoices. The scripts declare variables, populate records with asset details, call the API, and output the results. Additional examples are provided for using an alternative ledger currency and testing manual changes.

Uploaded by

Anonymous 8fFaeq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

The following sample script shows how you can use the Additions API via invoices

:
set serveroutput on
declare
l_trans_rec
l_dist_trans_rec
l_asset_hdr_rec
l_asset_desc_rec
l_asset_cat_rec
l_asset_type_rec
l_asset_hierarchy_rec
l_asset_fin_rec
l_asset_deprn_rec
l_asset_dist_rec
l_asset_dist_tbl
l_inv_tbl
l_inv_rate_tbl
l_inv_rec

FA_API_TYPES.trans_rec_type;
FA_API_TYPES.trans_rec_type;
FA_API_TYPES.asset_hdr_rec_type;
FA_API_TYPES.asset_desc_rec_type;
FA_API_TYPES.asset_cat_rec_type;
FA_API_TYPES.asset_type_rec_type;
FA_API_TYPES.asset_hierarchy_rec_type;
FA_API_TYPES.asset_fin_rec_type;
FA_API_TYPES.asset_deprn_rec_type;
FA_API_TYPES.asset_dist_rec_type;
FA_API_TYPES.asset_dist_tbl_type;
FA_API_TYPES.inv_tbl_type;
FA_API_TYPES.inv_rate_tbl_type;
FA_API_TYPES.inv_rec_type;

l_return_status
l_mesg_count
l_mesg

VARCHAR2(1);
number;
varchar2(4000);

begin
dbms_output.enable(10000000);
FA_SRVR_MSG.Init_Server_Message;
-- desc info
l_asset_desc_rec.description

:= '&description';

-- cat info
l_asset_cat_rec.category_id

:= &category_id

--type info
l_asset_type_rec.asset_type

:= '&ASSET_TYPE';

-- invoice info
l_inv_rec.fixed_assets_cost
l_inv_rec.deleted_flag
l_inv_rec.description
l_inv_rec.unrevalued_cost
l_inv_rec.create_batch_id
l_inv_rec.payables_code_combination_id
l_inv_rec.feeder_system_name
l_inv_rec.payables_cost
l_inv_rec.payables_units
l_inv_rec.po_vendor_id
l_inv_rec.inv_indicator

:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=

l_inv_tbl (1)

:= l_inv_rec;

-- fin info
l_asset_fin_rec.date_placed_in_service

:= '&DPIS';

2500;
'NO';
l_asset_desc_rec.description;
5555;
1000;
13528;
'ACK';
5555;
1;
1;
1;

l_asset_fin_rec.depreciate_flag

:= 'YES';

-- book / trans info


l_asset_hdr_rec.book_type_code

:= '&book';

-- distribution info
l_asset_dist_rec.units_assigned
l_asset_dist_rec.expense_ccid
l_asset_dist_rec.location_ccid
l_asset_dist_rec.assigned_to
l_asset_dist_rec.transaction_units

:=
:=
:=
:=
:=

l_asset_dist_tbl(1)

:= l_asset_dist_rec;

1;
&ccid
&location_id
null;
l_asset_dist_rec.units_assigned

;
-- call the api
fa_addition_pub.do_addition(
-- std parameters
p_api_version
p_init_msg_list
p_commit
p_validation_level
p_calling_fn
x_return_status
x_msg_count
x_msg_data
-- api parameters
px_trans_rec
px_dist_trans_rec
px_asset_hdr_rec
px_asset_desc_rec
px_asset_type_rec
px_asset_cat_rec
px_asset_hierarchy_rec
px_asset_fin_rec
px_asset_deprn_rec
px_asset_dist_tbl
px_inv_tbl
);

=>
=>
=>
=>
=>
=>
=>
=>

1.0,
FND_API.G_FALSE,
FND_API.G_FALSE,
FND_API.G_VALID_LEVEL_FULL,
null,
l_return_status,
l_mesg_count,
l_mesg,

=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>

l_trans_rec,
l_dist_trans_rec,
l_asset_hdr_rec,
l_asset_desc_rec,
l_asset_type_rec,
l_asset_cat_rec,
l_asset_hierarchy_rec,
l_asset_fin_rec,
l_asset_deprn_rec,
l_asset_dist_tbl,
l_inv_tbl

dbms_output.put_line(l_return_status);
--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));
dbms_output.put_line('ASSET_NUMBER' || l_asset_desc_rec.asset_number);
end if;
end;
/
Sample Script: Using the Additions API with No Invoices
The following sample script shows how you can use the Additions API to test a ma
nual change, when no invoice information is used:
set serveroutput on
declare
l_trans_rec
l_dist_trans_rec
l_asset_hdr_rec
l_asset_desc_rec
l_asset_cat_rec
l_asset_type_rec
l_asset_hierarchy_rec
l_asset_fin_rec
l_asset_deprn_rec
l_asset_dist_rec
l_asset_dist_tbl
l_inv_tbl
l_inv_rate_tbl

FA_API_TYPES.trans_rec_type;
FA_API_TYPES.trans_rec_type;
FA_API_TYPES.asset_hdr_rec_type;
FA_API_TYPES.asset_desc_rec_type;
FA_API_TYPES.asset_cat_rec_type;
FA_API_TYPES.asset_type_rec_type;
FA_API_TYPES.asset_hierarchy_rec_type;
FA_API_TYPES.asset_fin_rec_type;
FA_API_TYPES.asset_deprn_rec_type;
FA_API_TYPES.asset_dist_rec_type;
FA_API_TYPES.asset_dist_tbl_type;
FA_API_TYPES.inv_tbl_type;
FA_API_TYPES.inv_rate_tbl_type;

l_return_status
l_mesg_count
l_mesg

VARCHAR2(1);
number;
varchar2(4000);

begin
dbms_output.enable(10000000);
FA_SRVR_MSG.Init_Server_Message;
-- desc info
l_asset_desc_rec.description
l_asset_desc_rec.asset_key_ccid

:= '&description';
:= null;

-- cat info
l_asset_cat_rec.category_id

:= &category_id

--type info

l_asset_type_rec.asset_type

:= '&asset_type';

-- fin info
l_asset_fin_rec.cost
l_asset_fin_rec.date_placed_in_service
l_asset_fin_rec.depreciate_flag

:= &cost
:= '&DPIS';
:= 'YES';

-- deprn info
l_asset_deprn_rec.ytd_deprn
l_asset_deprn_rec.deprn_reserve
l_asset_deprn_rec.bonus_ytd_deprn
l_asset_deprn_rec.bonus_deprn_reserve

:=
:=
:=
:=

-- book / trans info


l_asset_hdr_rec.book_type_code

:= '&book';

-- distribution info
l_asset_dist_rec.units_assigned
l_asset_dist_rec.expense_ccid
l_asset_dist_rec.location_ccid
l_asset_dist_rec.assigned_to
l_asset_dist_rec.transaction_units
ned;
l_asset_dist_tbl(1)
-- call the api
fa_addition_pub.do_addition(
-- std parameters
p_api_version
p_init_msg_list
p_commit
p_validation_level
p_calling_fn
x_return_status
x_msg_count
x_msg_data
-- api parameters
px_trans_rec
px_dist_trans_rec
px_asset_hdr_rec
px_asset_desc_rec
px_asset_type_rec
px_asset_cat_rec
px_asset_hierarchy_rec
px_asset_fin_rec
px_asset_deprn_rec
px_asset_dist_tbl
px_inv_tbl
);

:=
:=
:=
:=
:=

&ytd
&reserve
0;
0;

1;
&ccid
&location_id
null;
l_asset_dist_rec.units_assig

:= l_asset_dist_rec;

=>
=>
=>
=>
=>
=>
=>
=>

1.0,
FND_API.G_FALSE,
FND_API.G_FALSE,
FND_API.G_VALID_LEVEL_FULL,
null,
l_return_status,
l_mesg_count,
l_mesg,

=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>

l_trans_rec,
l_dist_trans_rec,
l_asset_hdr_rec,
l_asset_desc_rec,
l_asset_type_rec,
l_asset_cat_rec,
l_asset_hierarchy_rec,
l_asset_fin_rec,
l_asset_deprn_rec,
l_asset_dist_tbl,
l_inv_tbl

--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));
dbms_output.put_line('ASSET_NUMBER' || l_asset_desc_rec.asset_number);
end if;
end;
/
Sample Script: Using the Additions API via Invoices with Alternative Ledger Curr
ency
set serveroutput on
declare
l_trans_rec
l_dist_trans_rec
l_asset_hdr_rec
l_asset_desc_rec
l_asset_cat_rec
l_asset_type_rec
l_asset_hierarchy_rec
l_asset_fin_rec
l_asset_deprn_rec
l_asset_dist_rec
l_asset_dist_tbl
l_inv_tbl
l_inv_rate_tbl
l_inv_rec

FA_API_TYPES.trans_rec_type;
FA_API_TYPES.trans_rec_type;
FA_API_TYPES.asset_hdr_rec_type;
FA_API_TYPES.asset_desc_rec_type;
FA_API_TYPES.asset_cat_rec_type;
FA_API_TYPES.asset_type_rec_type;
FA_API_TYPES.asset_hierarchy_rec_type;
FA_API_TYPES.asset_fin_rec_type;
FA_API_TYPES.asset_deprn_rec_type;
FA_API_TYPES.asset_dist_rec_type;
FA_API_TYPES.asset_dist_tbl_type;
FA_API_TYPES.inv_tbl_type;
FA_API_TYPES.inv_rate_tbl_type;
FA_API_TYPES.inv_rec_type;

l_return_status
l_mesg_count
l_mesg

VARCHAR2(1);
number;
varchar2(4000);

begin
dbms_output.enable(10000000);
FA_SRVR_MSG.Init_Server_Message;
-- desc info
l_asset_desc_rec.description
-- cat info

:= '&description';

l_asset_cat_rec.category_id

:= &category_id

--type info
l_asset_type_rec.asset_type

:= '&ASSET_TYPE';

-- invoice info
l_inv_rec.fixed_assets_cost
l_inv_rec.deleted_flag
l_inv_rec.description
l_inv_rec.unrevalued_cost
l_inv_rec.create_batch_id
l_inv_rec.payables_code_combination_id
l_inv_rec.feeder_system_name
l_inv_rec.payables_cost
l_inv_rec.payables_units
l_inv_rec.po_vendor_id
l_inv_rec.inv_indicator

:=
:=
:=
:=
:=
:=
:=
:=
:=
:=
:=

l_inv_tbl (1)

:= l_inv_rec;

2500;
'NO';
l_asset_desc_rec.description;
5555;
1000;
13528;
'ACK';
5555;
1;
1;
1;

-- rate info
l_inv_rec.inv_rate_tbl(1).set_of_books_id := 102;
l_inv_rec.inv_rate_tbl(1).exchange_rate
:= 2;
l_inv_rec.inv_rate_tbl(1).cost
:= 2001;
-- fin info
l_asset_fin_rec.date_placed_in_service
l_asset_fin_rec.depreciate_flag

:= '&DPIS';
:= 'YES';

-- book / trans info


l_asset_hdr_rec.book_type_code

:= '&book';

-- distribution info
l_asset_dist_rec.units_assigned
l_asset_dist_rec.expense_ccid
l_asset_dist_rec.location_ccid
l_asset_dist_rec.assigned_to
l_asset_dist_rec.transaction_units

:=
:=
:=
:=
:=

l_asset_dist_tbl(1)

:= l_asset_dist_rec;

1;
&ccid
&location_id
null;
l_asset_dist_rec.units_assigned

;
-- call the api
fa_addition_pub.do_addition(
-- std parameters
p_api_version
p_init_msg_list
p_commit
p_validation_level
p_calling_fn
x_return_status
x_msg_count
x_msg_data
-- api parameters
px_trans_rec
px_dist_trans_rec
px_asset_hdr_rec
px_asset_desc_rec
px_asset_type_rec
px_asset_cat_rec

=>
=>
=>
=>
=>
=>
=>
=>

1.0,
FND_API.G_FALSE,
FND_API.G_FALSE,
FND_API.G_VALID_LEVEL_FULL,
null,
l_return_status,
l_mesg_count,
l_mesg,

=>
=>
=>
=>
=>
=>

l_trans_rec,
l_dist_trans_rec,
l_asset_hdr_rec,
l_asset_desc_rec,
l_asset_type_rec,
l_asset_cat_rec,

px_asset_hierarchy_rec
px_asset_fin_rec
px_asset_deprn_rec
px_asset_dist_tbl
px_inv_tbl
);

=>
=>
=>
=>
=>

l_asset_hierarchy_rec,
l_asset_fin_rec,
l_asset_deprn_rec,
l_asset_dist_tbl,
l_inv_tbl

dbms_output.put_line(l_return_status);
--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));
dbms_output.put_line('ASSET_NUMBER' || l_asset_desc_rec.asset_number);
end if;
end;
/

You might also like