Fixed Assets API import Test

Source: Internet
Author: User

Backdrop:

1. it took a long time to check all Fixed Assets. I mainly deal with electronic products. The electronic products have management records on OA and management records on ERP, however, after the check, it is found that the actual data is not clear with the data recorded by OA and ERP.

2. Solution: all fixed assets (only electronic products) in ERP are decommissioned, existing assets are sorted by finance, and then imported through API.

Difficulties:

1. Time: starting from January 1, November 25 to closing account No. 30.

2. I am not familiar with FA, interface operations, and APIs.

3. After obtaining FA-related APIs, You need to test the time. In particular, you need to consider whether the import will affect some things that have not been noticed.

Test Script:

Procedure auto_import_info_p (errbuf out varchar2, retcode out number) is
Rochelle trans_rec fa_api_types.trans_rec_type;
Rochelle dist_trans_rec fa_api_types.trans_rec_type;
Rochelle asset_hdr_rec fa_api_types.asset_hdr_rec_type;
Rochelle asset_desc_rec fa_api_types.asset_desc_rec_type;
Rochelle asset_cat_rec fa_api_types.asset_cat_rec_type;
Rochelle asset_type_rec fa_api_types.asset_type_rec_type;
Rochelle asset_hierarchy_rec fa_api_types.asset_hierarchy_rec_type;
Rochelle asset_fin_rec fa_api_types.asset_fin_rec_type;
Rochelle asset_deprn_rec fa_api_types.asset_deprn_rec_type;
Rochelle asset_dist_rec fa_api_types.asset_dist_rec_type;
Rochelle asset_dist_tbl fa_api_types.asset_dist_tbl_type;
Rochelle inv_tbl fa_api_types.inv_tbl_type;
Rochelle inv_rate_tbl fa_api_types.inv_rate_tbl_type;

Rochelle return_status varchar2 (1 );
Rochelle mesg_count number: = 0;
Rochelle mesg_len number;
Rochelle mesg varchar2 (4000 );

Begin

Fnd_profile.put ('print _ debug', 'y'); -- used to specify the relevant configuration information
Errbuf: = null;
Retcode: = null;
Fa_srvr_msg.init_server_message; -- initialize the error message stack.
Fa_debug_pkg.initialize; -- initialize the debugging information stack.

-- Desc info
Rochelle asset_desc_rec.description: = null; -- 'Dell compute'; -- Description
Rochelle asset_desc_rec.asset_key_ccid: = 1; -- code combination ID corresponding to the asset keyword

-- Cat info *** need to change based on category setup for your book ***
Rochelle asset_cat_rec.category_id: = 3; -- category id fa_categories_ B

-- Type info
Rochelle asset_type_rec.asset_type: = 'capitalized'; -- capitalization

-- Fin info
Rochelle asset_fin_rec.cost: = 1001; -- current cost
Rochelle asset_fin_rec.date_placed_in_service: = to_date ('2017-08-31 ',
'Yyyy-mm-dd'); -- enable date -- '& DPIS ';
Rochelle asset_fin_rec.depreciate_flag: = 'yes'; -- depreciation check box
Rochelle asset_fin_rec.deprn_method_code: = 'stl '; -- Method
Rochelle asset_fin_rec.life_in_months: = 60; -- total number of months

-- Deprn info
Rochelle asset_deprn_rec.ytd_deprn: = 0; -- YTD depreciation
Rochelle asset_deprn_rec.deprn_reserve: = 0; -- accumulated depreciation
Rochelle asset_deprn_rec.bonus_ytd_deprn: = 0; -- additional depreciation ???????
Rochelle asset_deprn_rec.bonus_deprn_reserve: = 0; -- estimated additional depreciation ????

-- Book/trans info
Rochelle asset_hdr_rec.book_type_code: = 'book'; -- '& Book ';
L_trans_rec.transaction_date_entered: = l_asset_fin_rec.date_placed_in_service; -- Transfer Date
Rochelle trans_rec.who_info.last_updated_by: = fnd_global.user_id; -- the current user *****************

-- Distribution info -- allocation information -- fa_distribution_history

Rochelle asset_dist_rec.units_assigned: = 2; -- select distinct units_assigned from fa_distribution_history;
Rochelle asset_dist_rec.expense_ccid: = 64157; -- is a combination id.
/*
Select * from fa_distribution_history
Where trunc (last_update_date, 'dd') = trunc (to_date ('2017-11-20 ', 'yyyy-mm-dd'), 'dd'); -- expense_ccid is actually code_combination_id

Select * from GL_CODE_COMBINATIONS
Where code_combination_id = 64157;
*/

Rochelle asset_dist_rec.location_ccid: = 40 ;--
-- HEK _ fixed asset superuser-> Settings-> financial system-> employee person_ID
Rochelle asset_dist_rec.assigned_to: = 120; -- employee ID of the employee responsible for the asset
Apps. fnd_file.put_line (apps. fnd_file.log,
'Employee ID: '| l_asset_dist_rec.assigned_to );
Rochelle asset_dist_rec.transaction_units: = Rochelle asset_dist_rec.units_assigned;
Rochelle asset_dist_tbl (1): = Rochelle asset_dist_rec;

-- L_asset_desc_rec.asset_number: = -- asset number -- automatically generated
-- L_asset_desc_rec.property_type_code: = 'real ';
-- L_asset_desc_rec.property_1245_1250_code: = '20140901 ';
-- L_asset_desc_rec.in_use_flag: = 'yes ';
-- L_asset_desc_rec.owned_leased: = 'owner ';
-- L_asset_desc_rec.new_used: = 'new ';
-- L_asset_desc_rec.inventorial: = 'yes ';
-- L_asset_desc_rec.manufacturer_name: =
-- L_asset_desc_rec.serial_number: =
-- L_asset_desc_rec.model_number: =
-- L_asset_desc_rec.tag_number: =
-- L_asset_desc_rec.parent_asset_id: =
-- L_asset_desc_rec.warranty_id: =
-- L_asset_desc_rec.lease_id: =

-- For tax addition, will need existing asset_id
-- L_asset_hdr_rec.asset_id: =

-- L_asset_fin_rec.salvage_value: =
-- L_asset_fin_rec.unrevalued_cost: =
-- L_asset_fin_rec.short_fiscal_year_flag: =
-- L_asset_fin_rec.conversion_date: =
-- L_asset_fin_rec.orig_deprn_start_date: =
-- L_asset_fin_rec.unit_of_measure: =

-- L_asset_deprn_rec.reval_deprn_reserve: =
-- L_asset_deprn_rec.reval_amortization_basis: =

-- Accept amort start date for amortize NBV additions
-- L_trans_rec.amortization_start_date: =
-- To_date ('& amort_start_date', 'dd-MON-YYYY ');

-- Call the api
Fa_addition_pub.do_addition (p_api_version => 1.0, -- version -- Internal use parameters, Version Information
P_init_msg_list => fnd_api.g_false, -- Do not initialize the message -- determine whether the message stack should be initialized and cleared.
P_commit => fnd_api.g_false, -- whether to automatically submit assets that have been processed
P_validation_level => fnd_api.g_valid_level_full, -- check whether the API should verify assets
X_return_status => l_return_status, -- determines whether the API is successfully completed.
X_msg_count => l_mesg_count, -- message of the number of mail stacks.
X_msg_data => l_mesg, -- message Stack
P_calling_fn => null, -- call the API Function
Px_trans_rec => l_trans_rec, -- describes the transaction occurrence.
Px_dist_trans_rec => l_dist_trans_rec, -- describes the transaction distribution?
Px_asset_hdr_rec => l_asset_hdr_rec, -- add the unique identifier of the asset.
Px_asset_desc_rec => l_asset_desc_rec, -- asset description
Px_asset_type_rec => l_asset_type_rec, -- asset type
Px_asset_cat_rec => l_asset_cat_rec, -- asset category Information
Px_asset_hierarchy_rec => l_asset_hierarchy_rec, -- Hierarchy information of the asset
Px_asset_fin_rec => l_asset_fin_rec, -- asset financial information
Px_asset_deprn_rec => l_asset_deprn_rec, -- Asset Depreciation Information
Px_asset_dist_tbl => l_asset_dist_tbl, -- asset distribution information
Px_inv_tbl => l_inv_tbl, -- asset invoice
Px_inv_rate_tbl => l_inv_rate_tbl -- invoice for the Interest Rate Table as assets of the Medical Research Board
);
Apps. fnd_file.put_line (apps. fnd_file.log,
'L _ return_status: '| l_return_status );
Apps. fnd_file.put_line (apps. fnd_file.log,
'Fnd _ api. g_ret_sts_success: '|
Fnd_api.g_ret_sts_success );
If (l_return_status <> fnd_api.g_ret_sts_success) then
Apps. fnd_file.put_line (apps. fnd_file.log, 'failed ');
Apps. fnd_file.put_line (apps. fnd_file.log, 'error: '| sqlerrm );
Rochelle 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,
512 );
For I in 1 .. 2
Loop
L_mesg: = l_mesg | chr (10) | substr (fnd_msg_pub.get (fnd_msg_pub.g_next,
Fnd_api.g_false ),
1,
512 );

End loop;

Fnd_msg_pub.delete_msg ();

Rochelle mesg_len: = length (l_mesg );
For I in 1 .. ceil (l_mesg_len/255)
Loop
Apps. fnd_file.put_line (apps. fnd_file.log,
Substr (l_mesg, (I * 255)-254), 255 ));
End loop;
End if;

Else
Apps. fnd_file.put_line (apps. fnd_file.log, 'success ');
Apps. fnd_file.put_line (apps. fnd_file.log,
'Thid: '|
To_char (l_trans_rec.transaction_header_id ));
Apps. fnd_file.put_line (apps. fnd_file.log,
'Asset _ ID: '|
To_char (l_asset_hdr_rec.asset_id ));
Apps. fnd_file.put_line (apps. fnd_file.log,
'Asset _ NUMBER: '|
Rochelle asset_desc_rec.asset_number );

End if;

End auto_import_info_p;

The test script is OK, and the test data can be smoothly imported into the system O (partition _ partition) O

The acquisition of CCID remains to be studied...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.