zoukankan      html  css  js  c++  java
  • Oracle Assets Additions APISample Script(Invoices)

    Sample Script: Using the Additions API via Invoices

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

    代码
     1 set serveroutput on 
     2 declare 
     3     l_trans_rec FA_API_TYPES.trans_rec_type; 
     4     l_dist_trans_rec FA_API_TYPES.trans_rec_type; 
     5     l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type; 
     6     l_asset_desc_rec FA_API_TYPES.asset_desc_rec_type; 
     7     l_asset_cat_rec FA_API_TYPES.asset_cat_rec_type; 
     8     l_asset_type_rec FA_API_TYPES.asset_type_rec_type; 
     9     l_asset_hierarchy_rec FA_API_TYPES.asset_hierarchy_rec_type; 
    10     l_asset_fin_rec FA_API_TYPES.asset_fin_rec_type; 
    11     l_asset_deprn_rec FA_API_TYPES.asset_deprn_rec_type; 
    12     l_asset_dist_rec FA_API_TYPES.asset_dist_rec_type; 
    13     l_asset_dist_tbl FA_API_TYPES.asset_dist_tbl_type; 
    14     l_inv_tbl FA_API_TYPES.inv_tbl_type; 
    15     l_inv_rate_tbl FA_API_TYPES.inv_rate_tbl_type; 
    16     l_inv_rec FA_API_TYPES.inv_rec_type; 
    17     l_return_status VARCHAR2(1); 
    18     l_mesg_count number := 0
    19     l_mesg_len number
    20     l_mesg varchar2(4000); 
    21 begin 
    22     fnd_profile.put('PRINT_DEBUG''Y'); 
    23     dbms_output.enable(10000000); 
    24     FA_SRVR_MSG.Init_Server_Message; 
    25     FA_DEBUG_PKG.Initialize; 
    26     -- desc info 
    27     l_asset_desc_rec.description := 'Dell computer'
    28     l_asset_desc_rec.asset_key_ccid := 2
    29     -- cat info *** NEED TO CHANGE BASED ON CATEGORY SETUP FOR YOUR BOOK *** 
    30     l_asset_cat_rec.category_id := 21
    31     --type info 
    32     l_asset_type_rec.asset_type := 'CAPITALIZED'
    33     -- invoice info 
    34     l_inv_rec.fixed_assets_cost := 2500
    35     l_inv_rec.deleted_flag := 'NO'
    36     l_inv_rec.description := l_asset_desc_rec.description; 
    37     l_inv_rec.unrevalued_cost := 5555
    38     l_inv_rec.create_batch_id := 1000
    39     l_inv_rec.payables_code_combination_id := 13528
    40     l_inv_rec.feeder_system_name := 'ACK'
    41     l_inv_rec.payables_cost := 5555
    42     l_inv_rec.payables_units := 1
    43     l_inv_rec.po_vendor_id := 1
    44     l_inv_rec.inv_indicator := 1
    45     l_inv_tbl (1) := l_inv_rec; 
    46     -- rate info 
    47     l_inv_rate_tbl(1).inv_indicator := 1
    48     -- *** NEED TO CHANGE BASED ON SOB_ID OF REPORTING BOOKS *** 
    49     l_inv_rate_tbl(1).set_of_books_id := 658-- first reporting book 
    50     l_inv_rate_tbl(1).exchange_rate := .532
    51     l_inv_rate_tbl(2).inv_indicator := 1
    52     l_inv_rate_tbl(2).set_of_books_id := 659-- second reporting book 
    53     l_inv_rate_tbl(2).exchange_rate := .233
    54     -- fin info 
    55     l_asset_fin_rec.date_placed_in_service := '&DPIS'
    56     l_asset_fin_rec.depreciate_flag := 'YES'
    57     -- deprn info 
    58     l_asset_deprn_rec.ytd_deprn := 0
    59     l_asset_deprn_rec.deprn_reserve := 0
    60     l_asset_deprn_rec.bonus_ytd_deprn := 0
    61     l_asset_deprn_rec.bonus_deprn_reserve := 0
    62     -- book / trans info 
    63     l_asset_hdr_rec.book_type_code := '&book'
    64     l_trans_rec.transaction_date_entered := l_asset_fin_rec.date_placed_in_service; 
    65     l_trans_rec.who_info.last_updated_by := FND_GLOBAL.USER_ID
    66     /* distribution info */ 
    67     -- l_asset_dist_tbl := fa_API_TYPES.asset_dist_tbl_type (null); 
    68     l_asset_dist_rec.units_assigned := 1
    69     l_asset_dist_rec.expense_ccid := 12975
    70     l_asset_dist_rec.location_ccid := 2
    71     l_asset_dist_rec.assigned_to := null
    72     l_asset_dist_rec.transaction_units := l_asset_dist_rec.units_assigned; 
    73     l_asset_dist_tbl(1) := l_asset_dist_rec; 
    74     --l_asset_desc_rec.asset_number := 
    75     --l_asset_desc_rec.property_type_code := 
    76     --l_asset_desc_rec.property_1245_1250_code := 
    77     --l_asset_desc_rec.in_use_flag := 
    78     --l_asset_desc_rec.owned_leased := 
    79     --l_asset_desc_rec.new_used := 
    80     --l_asset_desc_rec.inventorial := 
    81     --l_asset_desc_rec.manufacturer_name := 
    82     --l_asset_desc_rec.serial_number := 
    83     --l_asset_desc_rec.model_number := 
    84     --l_asset_desc_rec.tag_number := 
    85     --l_asset_desc_rec.parent_asset_id := 
    86     --l_asset_desc_rec.warranty_id := 
    87     --l_asset_desc_rec.lease_id := 
    88 
    代码
     1     -- call the api 
     2     fa_addition_pub.do_addition (p_api_version => 1.0
     3     p_init_msg_list => FND_API.G_FALSE, 
     4     p_commit => FND_API.G_FALSE, 
     5     p_validation_level => FND_API.G_VALID_LEVEL_FULL, 
     6     x_return_status => l_return_status, 
     7     x_msg_count => l_mesg_count, 
     8     x_msg_data => l_mesg, 
     9     p_calling_fn => null
    10     px_trans_rec => l_trans_rec, 
    11     px_dist_trans_rec => l_dist_trans_rec, 
    12     --l_asset_desc_rec.inventorial := 
    13     --l_asset_desc_rec.manufacturer_name := 
    14     --l_asset_desc_rec.serial_number := 
    15     --l_asset_desc_rec.model_number := 
    16     --l_asset_desc_rec.tag_number := 
    17     --l_asset_desc_rec.parent_asset_id := 
    18     --l_asset_desc_rec.warranty_id := 
    19     --l_asset_desc_rec.lease_id := 
    20     -- call the api fa_addition_pub.do_addition 
    21     (p_api_version => 1.0
    22     p_init_msg_list => FND_API.G_FALSE, 
    23     p_commit => FND_API.G_FALSE, 
    24     p_validation_level => FND_API.G_VALID_LEVEL_FULL, 
    25     x_return_status => l_return_status, 
    26     x_msg_count => l_mesg_count, 
    27     x_msg_data => l_mesg, 
    28     p_calling_fn => null
    29     px_trans_rec => l_trans_rec, 
    30     px_dist_trans_rec => l_dist_trans_rec, 
    31     px_asset_hdr_rec => l_asset_hdr_rec, 
    32     px_asset_desc_rec => l_asset_desc_rec, 
    33     px_asset_type_rec => l_asset_type_rec, 
    34     px_asset_cat_rec => l_asset_cat_rec, 
    35     px_asset_hierarchy_rec => l_asset_hierarchy_rec, 
    36     px_asset_fin_rec => l_asset_fin_rec, 
    37     px_asset_deprn_rec => l_asset_deprn_rec, 
    38     px_asset_dist_tbl => l_asset_dist_tbl, 
    39     px_inv_tbl => l_inv_tbl, 
    40     px_inv_rate_tbl => l_inv_rate_tbl 
    41     ); 
    42     dbms_output.put_line(l_return_status); 
    43     if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then 
    44         dbms_output.put_line('FAILED'); 
    45         -- dbms_output.put_line(to_char(sqlerr)); 
    46         dbms_output.put_line(sqlerrm); 
    47         l_mesg_count := fnd_msg_pub.count_msg; 
    48         if l_mesg_count > 0 then 
    49             l_mesg := chr(10|| substr(fnd_msg_pub.get 
    50             (fnd_msg_pub.G_FIRST, fnd_api.G_FALSE), 
    51             1512); 
    52             for i in 1..2 loop -- (l_mesg_count - 1) loop 
    53                 l_mesg := l_mesg || chr(10|| 
    54                 substr(fnd_msg_pub.get 
    55                 (fnd_msg_pub.G_NEXT, 
    56                 fnd_api.G_FALSE), 1512); 
    57             end loop; 
    58             fnd_msg_pub.delete_msg(); 
    59             l_mesg_len := length(l_mesg); 
    60             for i in 1..ceil(l_mesg_len/255) loop 
    61                 dbms_output.put_line(substr(l_mesg, ((i*255)-254), 255)); 
    62             end loop; 
    63         end if
    64     else 
    65         dbms_output.put_line('SUCCESS'); 
    66         dbms_output.put_line('THID' || to_char(l_trans_rec.transaction_header_id)); 
    67         dbms_output.put_line('ASSET_ID' || to_char(l_asset_hdr_rec.asset_id)); 
    68         dbms_output.put_line('ASSET_NUMBER' || l_asset_desc_rec.asset_number); 
    69     end if
    70 end
    71 /
    72 
  • 相关阅读:
    django 中 null=True 和 blank=True的区别!
    利用js代码屏蔽f12,右键,粘贴,复制,剪切,选中,操作!!秀!秀!秀!
    jupyter notebook快速入门教程
    锁相关
    事务相关
    索引
    体系结构
    数据类型
    字符集
    部署规范
  • 原文地址:https://www.cnblogs.com/benio/p/1615413.html
Copyright © 2011-2022 走看看