Skip to main content

API to Add a Fixed Asset in Oracle Apps R12 without Source info - FA_ADDITION_PUB.DO_ADDITION

In this post, i tried to create a Fixed asset via standard Oracle API FA_ADDITION_PUB.DO_ADDITION. I tested the script in Oracle Apps R12. Hope this helps. 

Script:


set serveroutput on;
DECLARE
   l_trans_rec                FA_API_TYPES.trans_rec_type;
   l_dist_trans_rec           FA_API_TYPES.trans_rec_type;
   l_asset_hdr_rec            FA_API_TYPES.asset_hdr_rec_type;
   l_asset_desc_rec           FA_API_TYPES.asset_desc_rec_type;
   l_asset_cat_rec            FA_API_TYPES.asset_cat_rec_type;
   l_asset_type_rec           FA_API_TYPES.asset_type_rec_type;
   l_asset_hierarchy_rec      FA_API_TYPES.asset_hierarchy_rec_type;
   l_asset_fin_rec            FA_API_TYPES.asset_fin_rec_type;
   l_asset_deprn_rec          FA_API_TYPES.asset_deprn_rec_type;
   l_asset_dist_rec           FA_API_TYPES.asset_dist_rec_type;
   l_asset_dist_tbl           FA_API_TYPES.asset_dist_tbl_type;
   l_inv_tbl                  FA_API_TYPES.inv_tbl_type;
   l_inv_rate_tbl             FA_API_TYPES.inv_rate_tbl_type;

   l_return_status            VARCHAR2(1);    
   l_mesg_count               number;
   l_mesg                     varchar2(4000);
BEGIN

   dbms_output.enable(10000000);

   FA_SRVR_MSG.Init_Server_Message; 

   -- desc info
 --  l_asset_desc_rec.asset_number                 := '1234567';
   l_asset_desc_rec.tag_number                   := 'TEAM12345-1';
   l_asset_desc_rec.serial_number                := 'TEAM3567-1';
   l_asset_desc_rec.in_use_flag                  := 'YES';
   l_asset_desc_rec.new_used                     := 'NEW';
   l_asset_desc_rec.owned_leased                 := 'OWNED';
   l_asset_desc_rec.current_units                := 1;
   l_asset_desc_rec.description                  := 'Shareoracleapps Test Asset';
   l_asset_desc_rec.asset_key_ccid               := 1;

   -- cat info
   -- Valid Value in FA_CATEGORIES
   l_asset_cat_rec.category_id                   := '332';

   --type info
   l_asset_type_rec.asset_type                   := 'CAPITALIZED';

   -- Asset Financial Information --
   l_asset_fin_rec.set_of_books_id               := 2243;    
   l_asset_fin_rec.date_placed_in_service        := TO_DATE('01-JUN-2014','DD-MON-RRRR');
   l_asset_fin_rec.deprn_start_date              := TO_DATE('01-JUN-2014','DD-MON-RRRR');
   l_asset_fin_rec.deprn_method_code             := 'STL';
   l_asset_fin_rec.life_in_months                := 240;
   l_asset_fin_rec.original_cost                 := 50000;
   l_asset_fin_rec.cost                          := 50000;
   l_asset_fin_rec.prorate_convention_code       := 'SAME MONTH';
   l_asset_fin_rec.salvage_type                  := 'AMT'; -- PCT - for Percentage
   l_asset_fin_rec.salvage_value                 := 1000;
   l_asset_fin_rec.percent_salvage_value         := NULL;
   l_asset_fin_rec.depreciate_flag               := 'YES';
   l_asset_fin_rec.orig_deprn_start_date         := TO_DATE('01-AUG-2010','DD-MON-RRRR');

   -- deprn info
   l_asset_deprn_rec.set_of_books_id             := 2243;    
   l_asset_deprn_rec.ytd_deprn                   := 20000;
   l_asset_deprn_rec.deprn_reserve               := 20000;
   l_asset_deprn_rec.bonus_ytd_deprn             := 0;
   l_asset_deprn_rec.bonus_deprn_reserve         := 0;

   -- book / trans info
   -- Valid value in FA_BOOK_CONTROLS
   l_asset_hdr_rec.book_type_code                := 'SHARE BOOK';

   -- distribution info
   l_asset_dist_rec.units_assigned               := 1;
   -- Valid Record from GL Code cominations with record type = 'E' (Expense)
   l_asset_dist_rec.expense_ccid                 := 12345;
   -- Valid Value in FA Locations  
   l_asset_dist_rec.location_ccid                := 1881098;
   l_asset_dist_rec.assigned_to                  := NULL;
   l_asset_dist_rec.transaction_units            := l_asset_dist_rec.units_assigned;
   l_asset_dist_tbl(1)                           := l_asset_dist_rec;

   -- call the api
   fa_addition_pub.do_addition(
           -- 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_dist_trans_rec         => l_dist_trans_rec,
           px_asset_hdr_rec          => l_asset_hdr_rec,
           px_asset_desc_rec         => l_asset_desc_rec,
           px_asset_type_rec         => l_asset_type_rec,
           px_asset_cat_rec          => l_asset_cat_rec,
           px_asset_hierarchy_rec    => l_asset_hierarchy_rec,
           px_asset_fin_rec          => l_asset_fin_rec,
           px_asset_deprn_rec        => l_asset_deprn_rec,
           px_asset_dist_tbl         => l_asset_dist_tbl,
           px_inv_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('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;
/

Comments

Popular posts from this blog

Create Accounting for a Payment generates errors 95333 and 95359

Create Accounting for a Payment generates errors 95333 and 95359 Error: 95333: A conversion rate does not exist to convert USD to AUD for the conversion type Corporate and conversion date 20-MAR-09 for line -25. Please use the Daily Rates form in General Ledger to enter a conversion rate for these currencies, conversion date and conversion type. 95359: There is no accounted amount for the subledger journal entry line. Please inform your system administrator or support representative that: The source assigned to the accounting attribute Accounted Amount has no value for extract line number 88547. Please make sure the source assigned to the accounting attribute Accounted Amount has a valid value, or assign a different source to this accounting attribute. Solution: 1. Specify a conversion rate for the currencies and conversion date mentioned in the error message 95333 Navigation under the General Ledger responsibility: Setup > Currencies > Currency Rates Manager > Daily Rates ...

Public API’s for FA Transactions

Public API’s for FA Transactions So far Oracle FA is have all the good things except the lack on reporting.Oracle FA is now offer lot of public API's that can be used to interfacing with third party or Oracle application other modules. Here are some of transaction's API's:   Additions API if you have requirement to add assets directly via PL/SQL then use  FA_ADDITION_PUB.DO_ADDITION. If you have selected the Allow CIP Assets check box on the Book Controls window of a tax book when adding CIP assets using the Additions API, the this API automatically adds those CIP assets to that tax book at the same time that they are added to the corporate book. Adjustments API you can make cost adjustments to your assetsdirectly via PL/SQL using  FA_ADJUSTMENT_PUB.DO_ADJUSTMENT  for any  process adjustment. Detail can be found in appendix H) You can use this API if you have a custom interface that makes it difficult to use with the existing Oracle Assets interfaces for adjusti...

AP Table Relation Oracle Apps

AP Table Relation Oracle Apps ORACLE PAYABLE TABLE RELATION Source Table Dependent Table Condition AP_INVOICE_LINES_ALL AIL ZX_LINES_SUMMARY ZLS AIL.invoice_id = ZLS.trx_id and  ZLS.application_id  = 200 and  ZLS.entity_code  = 'AP_INVOICES' and  ZLS.event_class_code  in ('STANDARD INVOICES', 'PREPAYMENT INVOICES', 'EXPENSE REPORTS') and  AIL.summary_tax_line_id = ZLS.summary_tax_line_id AP_INVOICE_LINES_ALL AIL ZX_LINES ZL AIL.invoice_id = ZL.trx_id and  ZL.application_id  = 200 and  ZL.entity_code  = 'AP_INVOICES' and  ZL.event_class_code  in ('STANDARD INVOICES', 'PREPAYMENT INVOICES', 'EXPENSE REPORTS') and  AIL.line_number = ZL.trx_line_number AP_INVOICE_DISTRIBUTIONS_ALL AID ZX_REC_NREC_DIST ZD AID.invoice_id = ZD.trx_id and  ZD.application_id  = 200 and  ZD.entity_code  = 'AP_INVOICES' and  ZD.event_class_code  in ('STANDARD INVOICES', 'PREPAYMENT INVOICES', 'EXPENSE REPORTS') and...