DBA Data[Home] [Help]

APPS.PA_MASS_ADDITIONS_CREATE_PKG SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 39

     l_TxnUpdatedByTab     pa_utils.IdTabTyp ;
Line: 84

     t_TxnUpdatedByTab     pa_utils.IdTabTyp ;
Line: 117

      select 1
       from gl_code_combinations
      where code_combination_id = p_ccid
        and account_type        = 'A' ;
Line: 123

            select assets_tracking_flag
	      from ap_invoice_distributions_all
	     where invoice_distribution_id =  p_related_id
	       and invoice_distribution_id <> related_id
	       and assets_tracking_flag = 'Y' ;
Line: 130

            select assets_tracking_flag
	      from ap_invoice_distributions_all
	     where invoice_distribution_id =  p_charge_appl_to_dist_id
	       and assets_tracking_flag = 'Y' ;
Line: 149

   PROCEDURE  Insert_Receipts(
                           P_acctg_date                IN    DATE,
                           P_ledger_id                 IN    number,
                           P_user_id                   IN    number,
                           P_request_id                IN    number,
                           P_bt_code                   IN    varchar2,
                           P_primary_accounting_method IN    varchar2,
                           P_calling_sequence          IN    varchar2 DEFAULT NULL) ;
Line: 161

   PROCEDURE  Insert_Mass( p_api_version               IN  number,
                           p_init_msg_list	       IN  varchar2 default FND_API.G_FALSE,
			   p_commit	    	       IN  varchar2 default FND_API.G_FALSE,
			   p_validation_level	       IN  number   default FND_API.G_VALID_LEVEL_FULL,
                           x_return_status	       OUT NOCOPY varchar2,
	                   x_msg_count		       OUT NOCOPY number,
	                   x_msg_data		       OUT NOCOPY varchar2,
			   x_count                     OUT NOCOPY number,
                           P_acctg_date                IN  DATE,
                           P_ledger_id                 IN  number,
                           P_user_id                   IN  number,
                           P_request_id                IN  number,
                           P_bt_code                   IN  varchar2,
                           P_primary_accounting_method IN  varchar2,
                           P_calling_sequence          IN  varchar2 DEFAULT NULL) IS
    --
    lrec	         number ;
Line: 191

    l_api_name         CONSTANT  varchar2(100) := 'PA INSERT_MASS';
Line: 202

    select ei.expenditure_item_id,
    	   ei.expenditure_item_date ,
           cdl.line_num,
           ei.document_header_id,
           ei.document_distribution_id,
           ei.document_payment_id,
           ei.document_line_number,
           ei.document_type,
           ei.document_distribution_type,
           ei.transaction_source,
           rtrim(SUBSTRB(eic.expenditure_comment,1,80)) description,
	   (NVL(XDL.unrounded_accounted_dr,0) - NVL(XDL.unrounded_accounted_cr,0)) acct_raw_cost,
           --cdl.acct_raw_cost				acct_raw_cost,
	   cdl.gl_date,
	   cdl.acct_event_id,
           cdl.quantity,
           ei.net_zero_adjustment_flag,
           ei.adjusted_expenditure_item_id,
           ei.transferred_from_exp_item_id,
           ei.vendor_id,
           rtrim(POV.segment1)  vendor_number,
           apb.batch_name,
           api.invoice_date,
           api.created_by       invoice_created_by,
           api.last_updated_by  invoice_updated_by,
           api.invoice_id	invoice_id,
           api.source,
           rtrim(api.invoice_num) invoice_num,
           apil.warranty_number,
           apil.manufacturer,
           apil.serial_number,
           apil.model_number,
           decode(apd.line_type_lookup_code,  'ITEM', 'PA-ADJ', apd.line_type_lookup_code) line_type_lookup_code,
           apd.po_distribution_id,
           apd.related_id,
           apd.distribution_line_number,
           apd.invoice_distribution_id,
           apd.dist_code_combination_id,
           apd.invoice_line_number ,
           decode(cdl.reversed_flag, NULL, NULL,
                      ( select cdl2.si_assets_addition_flag
                        from pa_cost_distribution_lines_all cdl2
                       where cdl2.expenditure_item_id = cdl.expenditure_item_id
                         and cdl2.line_num_reversed   = cdl.line_num ) ) reversed_assets_flag,
           decode(cdl.line_num_reversed, NULL, NULL,
                      ( select cdl2.si_assets_addition_flag
                        from pa_cost_distribution_lines_all cdl2
                       where cdl2.expenditure_item_id = cdl.expenditure_item_id
                         and cdl2.line_num            = cdl.line_num_reversed ) ) source_assets_flag,
           DECODE(apd.line_type_lookup_code,
                  'ITEM',   decode( apd.corrected_invoice_dist_id,
                                    NULL,apd.invoice_distribution_id,
                                    apd.corrected_invoice_dist_id),
                  'ACCRUAL',decode(apd.corrected_invoice_dist_id,
                                   NULL, apd.invoice_distribution_id,
                                   apd.corrected_invoice_dist_id),
                  'IPV',    apd.related_id,
                  'ERV',    apd.related_id, apd.charge_applicable_to_dist_id) parent_invoice_dist_id,
           apd.assets_addition_flag            ap_assets_addition_flag,
           apd.dist_match_type,
           glcc.account_type ,
           xal.code_combination_id,
	   algt.ledger_category_code,
	   algt.ledger_id,
	   fsp.inventory_organization_id,
	   apd.assets_tracking_flag
     from  pa_expenditure_items 	ei,
           pa_expenditure_comments  	eic,
           pa_cost_distribution_lines 	cdl,
           ap_invoices                	api,
           ap_batches_all               apb,
           ap_invoice_lines           	apil,
           ap_invoice_distributions   	apd,
	   financials_system_params_all fsp,
           po_vendors                 	pov,
           xla_distribution_links       xdl,
           xla_ae_headers               xah,
	   ap_alc_ledger_gt             algt,
           xla_ae_lines                 xal,
	   ap_acct_class_code_gt        aagt,
           gl_code_combinations         glcc,
           --
           -- bug:4778189 - cross charge projects related transactions didn't generate assets.
	   --
	   pa_projects_all              p,
	   pa_project_types_all         pt
    where  ei.expenditure_item_id       = cdl.expenditure_item_id
      and  cdl.expenditure_item_id      = eic.expenditure_item_id (+)
      and  cdl.line_num                 = eic.line_number (+)
      and  ei.transaction_source in ('AP INVOICE' , 'AP EXPENSE', 'AP NRTAX', 'AP VARIANCE', 'AP ERV', /* Bug 5284323 */
                                     'INTERPROJECT_AP_INVOICES','INTERCOMPANY_AP_INVOICES')
      and  cdl.gl_date                  <= P_acctg_date
      and  cdl.line_type                = 'R'
      and  cdl.transfer_status_code     = 'A'
      and  cdl.si_assets_addition_flag  = 'T'
      and  cdl.project_id               = p.project_id
      and  p.project_type               = pt.project_type
      -- Bug : 5368600
      and  p.org_id                     = pt.org_id
      and  pt.project_type_class_code   <> 'CAPITAL'
      and  ei.document_header_id        = api.invoice_id
      and  ei.document_distribution_id  = apd.invoice_distribution_id
      and  ei.document_line_number      = apd.invoice_line_number
      and  apil.invoice_id              = api.invoice_id
      and  api.org_id                   = fsp.org_id
      and  apil.line_number             = apd.invoice_line_number
      and  api.batch_id                 = apb.batch_id(+)
      and  apd.posted_flag              = 'Y'
      and  api.vendor_id                = pov.vendor_id
      and  apd.set_of_books_id          = P_ledger_id
      -- 5911379: Modified the join
      AND  xah.application_id 	        = 275
      and  xah.event_id       	        = cdl.acct_event_id
      AND  xah.balance_type_code        = 'A'
      and  xah.accounting_entry_status_code = 'F'
      and  xal.application_id 	        = xah.application_id
      AND  xal.ae_header_id             = xah.ae_header_id
      and  xal.accounting_class_code    = aagt.accounting_class_code
      and  xdl.event_id       	        = xah.event_id
      AND  xdl.ae_header_id             = xal.ae_header_id
      AND  xdl.ae_line_num              = xal.ae_line_num
      and  xdl.application_id 	        = xal.application_id
      and  xdl.source_distribution_id_num_1 = ei.expenditure_item_id
      and  xdl.source_distribution_id_num_2 = cdl.line_num
      and  xah.ledger_id                = algt.ledger_id
      and  decode(algt.org_id, -99, algt.org_id, cdl.org_id) =
           decode(algt.org_id, -99, -99, algt.org_id)
      and  glcc.code_combination_id     = xal.code_combination_id
      -- 5911379: ends
     ORDER BY ei.document_distribution_id, ei.expenditure_item_id, cdl.line_num  ;
Line: 335

                    'Insert_Mass';
Line: 341

       write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', '*** 10 : ORACLE PROJECTS INSERT MASS PROCESSING ***') ;
Line: 345

    				           'INSERT_MASS',
    					   G_pkg_name) THEN

          RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
Line: 359

       write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'INSERT MASS Processing begins.') ;
Line: 361

       write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Calling Insert_Receipts processing.') ;
Line: 364

       Insert_Receipts( P_acctg_date    ,
                        P_ledger_id     ,
                        P_user_id       ,
                        P_request_id    ,
                        P_bt_code       ,
                        P_primary_accounting_method ,
                        P_calling_sequence ) ;
Line: 372

       write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Insert Mass Main Loop Begins Here.') ;
Line: 378

	 write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Main Loop Iteration Begins' ) ;
Line: 379

	 write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Initialize Plsql variables' ) ;
Line: 382

         write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Fetching records from cursor c_apinv.') ;
Line: 407

	       t_TxnUpdatedByTab,
	       t_invoiceIdTab,
	       t_sourceTab,
	       t_InvoiceNumberTab,
	       t_warrantyNumberTab,
	       t_ManufacturerTab,
	       t_SerialNumberTab,
	       t_ModelNumberTab,
	       t_linetypeLcdTab,
	       t_poDistIdTab,
	       t_RelatedIdTab,
	       t_DistLineNumberTab,
	       t_invDistIdTab,
	       t_DistCcidTab,
	       t_InvLineNumberTab,
	       t_RvrAssetsFlagTab,
	       t_SrcAssetsFlagTab,
	       t_parentInvDstIdTab,
	       t_apAssetsFlagTab,
	       t_DstMatchTypeTab,
               t_accTypeTab,
               t_XalccidTab,
	       t_ledgercatcdTab,
	       t_ledgeridTab,
	       t_invOrgIDTab,
	       t_ATrackFlagTab
         limit l_count ;
Line: 437

            write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Exiting from main loop') ;
Line: 448

           write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Expenditure Item ID:'||t_eiIDTab(indx)) ;
Line: 449

	   write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL Line Number:'||t_lineNumTab(indx)) ;
Line: 450

	   write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','t_cdlEventIDTab:'||t_cdlEventIDTab(indx) ) ;
Line: 457

	      write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','Reversing and reversed cdls are ignored' ) ;
Line: 471

	          write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL ignored because ap distribution not eligible' ) ;
Line: 480

	          write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL c_assets_tracking_flagA returns N for related ID '|| t_RelatedIdTab(indx) ) ;
Line: 487

	          write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL c_assets_tracking_flagA and B returns N  ' ) ;
Line: 491

	           write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL c_assets_tracking_flagA and B returns Y  ' ) ;
Line: 498

	    --  write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL ignored because ap distribution not eligible' ) ;
Line: 509

	      write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL does not belong to assets account.' ) ;
Line: 516

	      write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL does not belong to assets account.' ) ;
Line: 539

	         write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass',
		                                       'Getting asset_category_id for po distribution:'||t_poDistIdTab(indx));
Line: 541

                 select mtlsi.asset_category_id,
                        polt.order_type_lookup_code,
                        decode(pod.accrue_on_receipt_flag, 'Y', pod.code_combination_id, NULL ),
                        pod.deliver_to_person_id,
                        rtrim(upper(poh.segment1))
                   into l_assets_category_id,
                        l_po_order_type_lcd,
                        l_po_ccid,
                        l_assigned_to,
                        l_po_number
                   from po_distributions_all         pod,
                        po_headers                   poh,
                        po_lines_all                 pol,
                        po_line_types_b              polt,
                        mtl_system_items             mtlsi
                  where pod.po_distribution_id   = t_PoDistIdTab(indx)
                    and pod.po_header_id         = poh.po_header_id
                    and pod.po_line_id           = pol.po_line_id
                    and pol.line_type_id         = polt.line_type_id
                    and pol.item_id              = mtlsi.inventory_item_id(+)
		    and t_invOrgIDTab(indx)      = mtlsi.organization_id (+) ;
Line: 563

	          write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass',
		                                       'Asset_category_id for po distribution:'||l_assets_category_id);
Line: 595

	      l_TxnUpdatedByTab(lrec)  := t_TxnUpdatedByTab(indx) ;
Line: 616

	         write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Intercompany Invoice' ) ;
Line: 624

	      write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Code combination ID:'|| l_payCCIDTab(lrec) ) ;
Line: 627

	   write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Ignore CDL flag value:'||l_ignore_cdl ) ;
Line: 640

	    write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'Count of cdls ignored:'||Flag_no_eiIDTab.COUNT ) ;
Line: 642

               UPDATE pa_cost_distribution_lines
                  SET si_assets_addition_flag = 'N',
                      program_update_date     = SYSDATE,
                      program_application_id  = FND_GLOBAL.prog_appl_id,
                      program_id              = FND_GLOBAL.conc_program_id,
                      request_id              = p_request_id
                WHERE si_assets_addition_flag = 'T'
                  AND expenditure_item_id     =  Flag_no_eiIDTab(i)
                  AND line_num                = Flag_no_lineNumTab(i);
Line: 654

	    write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'FA_MASS_ADDITIONS_GT Count:'||l_eiIDtab.count) ;
Line: 657

               INSERT INTO FA_MASS_ADDITIONS_GT(
                           mass_addition_id,
                           description,
                           asset_category_id,
                           manufacturer_name,
                           serial_number,
                           model_number,
                           book_type_code,
                           transaction_date,
                           fixed_assets_cost,
                           payables_units,
                           fixed_assets_units,
                           payables_cost,
                           payables_code_combination_id,
                           assigned_to,
                           feeder_system_name,
                           create_batch_date,
                           create_batch_id,
                           last_update_date,
                           last_updated_by,
                           invoice_date,
                           invoice_created_by,
                           invoice_updated_by,
                           invoice_id,
                           invoice_number,
                           invoice_distribution_id,
                           invoice_line_number,
                           ap_distribution_line_number,
                           merge_invoice_number,
                           merge_vendor_number,
                           vendor_number,
                           po_vendor_id,
                           po_number,
                           payables_batch_name,
                           accounting_date,
                           created_by,
                           creation_date,
                           last_update_login,
                           parent_invoice_dist_id,
                           ledger_id,
                           ledger_category_code,
                           warranty_number,
                           line_type_lookup_code,
                           po_distribution_id,
                           expenditure_item_id,
                           line_num,
                           line_status ,
                           posting_status,
                           queue_name,
		           asset_number,
                           tag_number,
                           depreciate_flag,
                           parent_mass_addition_id,
                           parent_asset_id,
                           split_merged_code,
                           inventorial,
                           date_placed_in_service,
                           transaction_type_code,
                           expense_code_combination_id,
                           location_id,
                           reviewer_comments,
                           post_batch_id,
                           add_to_asset_id,
                           amortize_flag,
                           new_master_flag,
                           asset_key_ccid,
                           asset_type,
                           deprn_reserve,
                           ytd_deprn,
                           beginning_nbv,
                           salvage_value)
               SELECT  fa_mass_additions_s.nextval,
                           l_descriptionTab(i),
                           l_assetsCatIDTab(i) ,
	                   l_ManufacturerTab(i),
                           l_SerialNumberTab(i),
                           l_ModelNumberTab(i),
	                   l_BookTypCdTab(i) ,
	                   l_eiDateTab(i),
                           l_payCostTab(i),
                           l_PayUnitTab(i),
                           l_FAUnitTab(i),
                           l_payCostTab(i),
	                   l_payCCIDTab(i),
                           l_assignedToTab(i) ,
                           'ORACLE PROJECTS',
                           trunc(SYSDATE)	Create_batch_date,
                           P_request_id   	create_batch_id,
                           trunc(SYSDATE)    last_update_date,
                           p_user_id		last_update_by,
	                   l_TxnDateTab(i) ,
	                   l_TxnCreatedByTab(i),
	                   l_TxnUpdatedByTab(i),
	                   l_invoiceIdTab(i) ,
                           l_InvoiceNumberTab(i),
	                   l_invDistIdtab(i)  ,
	                   l_InvLineNumberTab(i),
                           l_DistLineNumberTab(i),
                           l_InvoiceNumberTab(i),
	                   l_vendorNumberTab(i),
	                   l_vendorNumberTab(i),
	                   l_vendorIdTab(i),
	                   l_PoNumberTab(i),
                           l_payBatchNameTab(i), --	Payables Batch Name,
                           l_GlDateTab(i) ,
                           p_user_id,	-- Created by
                           trunc(SYSDATE),	-- creation date
                           p_user_id, 	-- lst update login
	                   l_parentInvDstIdTab(i),
                           l_ledgerIdTab(i),
			   l_ledgercatcdTab(i) ,
	                   l_warrantyNumberTab(i),
	                   l_linetypeLcdtab(i),
                           l_poDistIdTab(i),
	                   l_eiIDtab(i),
                           l_lineNumTab(lrec) ,
	                   'NEW',
	                   'NEW',
	                   'NEW',
	                   NULL, 	-- assets_number
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL,
	                   NULL -- Salvage Value
                     FROM dual ;
Line: 812

	    write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass', 'When Others:'||SQLERRM ) ;
Line: 815

    END Insert_Mass;
Line: 820

    PROCEDURE  Insert_Discounts(p_api_version          IN    number,
                               p_init_msg_list	       IN    varchar2 default FND_API.G_FALSE,
			       p_commit	    	       IN    varchar2 default FND_API.G_FALSE,
			       p_validation_level      IN    number   default FND_API.G_VALID_LEVEL_FULL,
                               x_return_status	       OUT   NOCOPY varchar2,
	                       x_msg_count	       OUT   NOCOPY number,
	                       x_msg_data	       OUT   NOCOPY varchar2,
			       x_count                 OUT   NOCOPY number,
                               P_acctg_date            IN    DATE,
                               P_ledger_id             IN    number,
                               P_user_id               IN    number,
                               P_request_id            IN    number,
                               P_bt_code               IN    varchar2,
                               P_primary_accounting_method IN    varchar2,
                               P_calling_sequence          IN    varchar2 DEFAULT NULL) IS
    --
    l_current_calling_sequence   varchar2(2000);
Line: 840

    l_api_name           CONSTANT  varchar2(100) := 'INSERT_DISCOUNTS';
Line: 860

    select ei.expenditure_item_id,
    	   ei.expenditure_item_date ,
           cdl.line_num,
           ei.document_header_id,
           ei.document_distribution_id,
           ei.document_payment_id,
           ei.document_line_number,
           ei.document_type,
           ei.document_distribution_type,
           ei.transaction_source,
           RTRIM(SUBSTRB(eic.expenditure_comment,1,80)) description,
	   (NVL(XDL.unrounded_accounted_dr,0) - NVL(XDL.unrounded_accounted_cr,0)) acct_raw_cost,
           --cdl.acct_raw_cost				acct_raw_cost,
	   cdl.gl_date,
	   cdl.acct_event_id,
           cdl.quantity,
           ei.net_zero_adjustment_flag,
           ei.adjusted_expenditure_item_id,
           ei.transferred_from_exp_item_id,
           ei.vendor_id,
           rtrim(POV.segment1)  vendor_number,
           apb.batch_name,
           api.invoice_date,
           cdl.created_by       invoice_created_by,
           ei.last_updated_by   invoice_updated_by,
           api.invoice_id	invoice_id,
           api.source,
           rtrim(api.invoice_num) invoice_num,
           apil.warranty_number,
           apil.manufacturer,
           apil.serial_number,
           apil.model_number,
	   apd.line_type_lookup_code line_type_lookup_code,
           apd.po_distribution_id,
           apd.related_id,
           apd.distribution_line_number,
           apd.invoice_distribution_id,
           apd.dist_code_combination_id,
           apd.invoice_line_number,
           decode(cdl.reversed_flag, NULL, NULL,
                      ( select cdl2.si_assets_addition_flag
                        from pa_cost_distribution_lines_all cdl2
                       where cdl2.expenditure_item_id = cdl.expenditure_item_id
                         and cdl2.line_num_reversed   = cdl.line_num ) ) reversed_assets_flag,
           decode(cdl.line_num_reversed, NULL, NULL,
                      ( select cdl2.si_assets_addition_flag
                        from pa_cost_distribution_lines_all cdl2
                       where cdl2.expenditure_item_id = cdl.expenditure_item_id
                         and cdl2.line_num            = cdl.line_num_reversed ) ) source_assets_flag,
           DECODE(apd.line_type_lookup_code,
                      'ITEM',   decode(apd.corrected_invoice_dist_id,
                                           NULL, apd.invoice_distribution_id,
                                                 apd.corrected_invoice_dist_id),
                      'ACCRUAL',decode(apd.corrected_invoice_dist_id,
                                           NULL, apd.invoice_distribution_id,
                                           apd.corrected_invoice_dist_id),
                                apd.charge_applicable_to_dist_id  ) parent_invoice_dist_id,
           apip.assets_addition_flag            ap_assets_addition_flag,
           apd.dist_match_type,
           glcc.account_type ,
           xal.code_combination_id,
	   algt.ledger_category_code,
	   algt.ledger_id,
	   fsp.inventory_organization_id,
	   apd.assets_tracking_flag
     from  pa_expenditure_items 	ei,
           pa_expenditure_comments  	eic,
           pa_cost_distribution_lines 	cdl,
           ap_invoices                	api,
           ap_invoice_lines           	apil,
           ap_invoice_distributions   	apd,
	   financials_system_params_all fsp,
	   ap_invoice_payments          apip,
           ap_batches_all               apb,
           po_vendors                 	pov,
           xla_distribution_links       xdl,
           xla_ae_headers               xah,
           xla_ae_lines                 xal,
	   ap_alc_ledger_gt             algt,
	   ap_acct_class_code_gt        aagt,
           gl_code_combinations         glcc,
	   pa_projects_all              p,
	   pa_project_types_all         pt
    where  ei.expenditure_item_id       = cdl.expenditure_item_id
      and  cdl.expenditure_item_id      = eic.expenditure_item_id (+)
      and  cdl.line_num                 = eic.line_number (+)
      and  ei.transaction_source in ('AP DISCOUNTS')
      and  cdl.gl_date                  <= P_acctg_date
      and  cdl.line_type                = 'R'
      and  cdl.transfer_status_code     = 'A'
      and  cdl.si_assets_addition_flag  = 'T'
      and  cdl.project_id               = p.project_id
      and  p.project_type               = pt.project_type
      and  p.org_id                     = pt.org_id
      and  pt.project_type_class_code   <> 'CAPITAL'
      and  ei.document_header_id        = api.invoice_id
      and  ei.document_distribution_id  = apd.invoice_distribution_id
      and  ei.document_line_number      = apd.invoice_line_number
      and  apil.invoice_id              = api.invoice_id
      and  api.org_id                   = fsp.org_id
      and  apil.line_number             = apd.invoice_line_number
      and  API.batch_id                 = apb.batch_id(+)
      and  apd.posted_flag              = 'Y'
      --and  apd.cash_posted_flag       = 'Y'
      --and  apd.assets_addition_flag     = 'Y'
      and  api.vendor_id                = pov.vendor_id
      and  ei.document_payment_id       = apip.invoice_payment_id
      and  apip.accounting_date        <= P_acctg_date
      and  apip.set_of_books_id         = P_ledger_id
      AND  xah.application_id 	        = 275
      -- 5911379: Modified the join
      and  xdl.application_id 	        = xah.application_id
      and  xah.event_id       	        = cdl.acct_event_id
      AND  xah.balance_type_code        = 'A'
      and  xah.accounting_entry_status_code = 'F'
      and  xal.application_id 	        = xah.application_id
      AND  xal.ae_header_id             = xah.ae_header_id
      and  xal.accounting_class_code    = aagt.accounting_class_code
      and  xdl.event_id       	        = xah.event_id
      AND  xdl.ae_header_id             = xal.ae_header_id
      AND  xdl.ae_line_num              = xal.ae_line_num
      and  xdl.application_id 	        = xal.application_id
      and  xdl.source_distribution_id_num_1 = ei.expenditure_item_id
      and  xdl.source_distribution_id_num_2 = cdl.line_num
      AND  xah.ledger_id                = algt.ledger_id
      and  decode(algt.org_id, -99, algt.org_id, cdl.org_id) =
           decode(algt.org_id, -99, -99, algt.org_id)
      and  glcc.code_combination_id      = xal.code_combination_id
      -- 5911379: ends
     order by ei.document_distribution_id, ei.expenditure_item_id, cdl.line_num  ;
Line: 993

			    'Insert_Discounts';
Line: 1002

    					'INSERT_DISCOUNTS',
    					G_pkg_name) THEN

	       RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
Line: 1019

	    write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Begin discount processing.') ;
Line: 1021

	    write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Begin Main LOOP.') ;
Line: 1025

	      write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Init PLSQL Tab variables.') ;
Line: 1053

		     t_TxnUpdatedByTab,
		     t_invoiceIdTab,
		     t_sourceTab,
		     t_InvoiceNumberTab,
		     t_warrantyNumberTab,
		     t_ManufacturerTab,
		     t_SerialNumberTab,
		     t_ModelNumberTab,
		     t_linetypeLcdTab,
		     t_poDistIdTab,
		     t_RelatedIdTab,
		     t_DistLineNumberTab,
		     t_invDistIdTab,
		     t_DistCcidTab,
		     t_InvLineNumberTab,
		     t_RvrAssetsFlagTab,
		     t_SrcAssetsFlagTab,
		     t_parentInvDstIdTab,
		     t_apAssetsFlagTab,
		     t_DstMatchTypeTab,
		     t_accTypeTab,
		     t_XalccidTab,
		     t_ledgercatcdTab,
		     t_ledgerIdTab ,
		     t_InvOrgIDTab,
		     t_ATrackFlagTab
	      limit l_count ;
Line: 1083

	         write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Leaving main LOOP.') ;
Line: 1091

	           write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Exp Item ID:'||t_eiIDTab(indx)) ;
Line: 1092

	           write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'CDL Line num:'||t_lineNumTab(indx)) ;
Line: 1112

	                  write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL ignored because ap distribution not eligible' ) ;
Line: 1121

	                 write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL c_assets_tracking_flagA returns N ') ;
Line: 1128

	                 write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL c_assets_tracking_flagA  and B returns N ') ;
Line: 1132

	                 write_to_log(FND_LOG.LEVEL_STATEMENT, '10:PA Insert_mass','CDL c_assets_tracking_flagA  or  B returns Y ') ;
Line: 1148

	           write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Invoice Source:'||t_sourceTab(indx)) ;
Line: 1149

	           write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Account Type  :'||t_accTypeTab(indx)) ;
Line: 1163

	           write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Ignore CDL    :'||l_ignore_cdl) ;
Line: 1168

	                      write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'PO DistributionID:'||t_poDistIdTab(indx));
Line: 1169

			      SELECT mtlsi.asset_category_id,
				     polt.order_type_lookup_code,
				     decode(pod.accrue_on_receipt_flag, 'Y', pod.code_combination_id, NULL ),
				     pod.deliver_to_person_id,
				     rtrim(upper(poh.segment1))
				into l_assets_category_id,
				     l_po_order_type_lcd,
				     l_po_ccid,
				     l_assigned_to,
				     l_po_number
				FROM po_distributions_all         pod,
				     po_headers                   poh,
				     po_lines_all                 pol,
				     po_line_types_b              polt,
				     mtl_system_items             mtlsi
			       WHERE pod.po_distribution_id   = t_PoDistIdTab(indx)
				 AND pod.po_header_id         = poh.po_header_id
				 AND pod.po_line_id           = pol.po_line_id
				 AND pol.line_type_id         = polt.line_type_id
				 AND pol.item_id              = mtlsi.inventory_item_id(+)
				 AND t_InvOrgIDTab(indx)      = mtlsi.organization_id (+) ;
Line: 1191

	                        write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS',
		                         'Asset_category_id for po distribution:'||l_assets_category_id);
Line: 1220

			  l_TxnUpdatedByTab(lrec)  := t_TxnUpdatedByTab(indx) ;
Line: 1256

	           write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'Flag_no_eiIDTab.COUNT:'||Flag_no_eiIDTab.COUNT) ;
Line: 1259

			  UPDATE pa_cost_distribution_lines
			     SET si_assets_addition_flag = 'N',
				 program_update_date     = SYSDATE,
				 program_application_id  = FND_GLOBAL.prog_appl_id,
				 program_id              = FND_GLOBAL.conc_program_id,
				 request_id              = p_request_id
			   WHERE si_assets_addition_flag in ('T', 'O')
			     AND expenditure_item_id =  Flag_no_eiIDTab(i)
			     AND line_num            =  Flag_no_lineNumTab(i);
Line: 1271

	         write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'eiIDTab.COUNT:'||l_eiIDTab.COUNT) ;
Line: 1274

		      INSERT INTO FA_MASS_ADDITIONS_GT(
				    mass_addition_id,
				    description,
				    asset_category_id,
				    manufacturer_name,
				    serial_number,
				    model_number,
				    book_type_code,
				    transaction_date,
				    fixed_assets_cost,
				    payables_units,
				    fixed_assets_units,
				    payables_cost,
				    payables_code_combination_id,
				    assigned_to,
				    feeder_system_name,
				    create_batch_date,
				    create_batch_id,
				    last_update_date,
				    last_updated_by,
				    invoice_date,
				    invoice_created_by,
				    invoice_updated_by,
				    invoice_id,
				    invoice_number,
				    invoice_distribution_id,
				    invoice_line_number,
				    ap_distribution_line_number,
				    merge_invoice_number,
				    merge_vendor_number,
				    vendor_number,
				    po_vendor_id,
				    po_number,
				    payables_batch_name,
				    accounting_date,
				    created_by,
				    creation_date,
				    last_update_login,
				    parent_invoice_dist_id,
				    ledger_id,
				    ledger_category_code,
				    warranty_number,
				    line_type_lookup_code,
				    po_distribution_id,
				    expenditure_item_id,
				    line_num,
				    line_status ,
				    posting_status,
				    queue_name,
				    inventorial,
				    asset_number,
				    tag_number,
				    depreciate_flag,
				    parent_mass_addition_id,
				    parent_asset_id,
				    split_merged_code,
				    date_placed_in_service,
				    transaction_type_code,
				    expense_code_combination_id,
				    location_id,
				    reviewer_comments,
				    post_batch_id,
				    add_to_asset_id,
				    amortize_flag,
				    new_master_flag,
				    asset_key_ccid,
				    asset_type,
				    deprn_reserve,
				    ytd_deprn,
				    beginning_nbv,
				    salvage_value
				    )
		      SELECT  fa_mass_additions_s.nextval,
			      l_descriptionTab(i),
			      l_assetsCatIDTab(i),
			      l_ManufacturerTab(i),
			      l_SerialNumberTab(i),
			      l_ModelNumberTab(i),
			      l_BookTypCdTab(i) ,
			      l_eiDateTab(i),
			      l_payCostTab(i),
			      l_PayUnitTab(i),
			      l_FAUnitTab(i),
			      l_payCostTab(i),
			      l_payCCIDTab(i),
			      l_assignedToTab(i) ,
			      'ORACLE PROJECTS',
			      trunc(SYSDATE)	Create_batch_date,
			      P_request_id   	create_batch_id,
			      trunc(SYSDATE)    last_update_date,
			      p_user_id		last_update_by,
			      l_TxnDateTab(i) ,
			      l_TxnCreatedByTab(i),
			      l_TxnUpdatedByTab(i),
			      l_invoiceIdTab(i) ,
			      l_InvoiceNumberTab(i),
			      l_invDistIdtab(i)  ,
			      l_InvLineNumberTab(i),
			      l_DistLineNumberTab(i),
			      l_InvoiceNumberTab(i),
			      l_vendorNumberTab(i),
			      l_vendorNumberTab(i),
			      l_vendorIdTab(i),
			      l_PoNumberTab(i),
			      l_payBatchNameTab(i), --	Payables Batch Name,
			      l_GlDateTab(i) ,
			      p_user_id,	-- Created by
			      trunc(SYSDATE),	-- creation date
			      p_user_id, 	-- lst update login
			      l_parentInvDstIdTab(i),
			      l_ledgerIdTab(i) ,
			      l_ledgercatcdTab(i) ,
			      l_warrantyNumberTab(i),
			      'DISCOUNT' ,                    --l_linetypeLcdtab(i),
			      l_poDistIdTab(i),
			      l_eiIDtab(i),
			      l_lineNumTab(lrec) ,
			      'NEW',
			      'NEW',
			      'NEW',
			      'Yes',    --inventorial,
			      NULL, 	-- assets_number
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL -- Salvage Value
			from DUAL ;
Line: 1427

	   write_to_log(FND_LOG.LEVEL_STATEMENT, '40:INSERT_DISCOUNTS', 'EXCEPTION:'||SQLERRM) ;
Line: 1430

    END Insert_Discounts;
Line: 1444

    PROCEDURE update_mass (p_api_version      IN number,
                           p_init_msg_list    IN varchar2 default FND_API.G_FALSE,
                           p_commit           IN varchar2 default FND_API.G_FALSE,
                           p_validation_level IN number   default FND_API.G_VALID_LEVEL_FULL,
                           x_return_status    OUT NOCOPY  varchar2,
                           x_msg_count        OUT NOCOPY  number,
                           x_msg_data         OUT NOCOPY  varchar2,
                           p_request_id       IN number  ) is

     l_msg_count       number ;
Line: 1465

    					    'UPDATE_MASS',
    					    G_pkg_name) THEN

    	    RAISE FND_API.G_EXC_UNEXPECTED_ERROR ;
Line: 1484

	    write_to_log(FND_LOG.LEVEL_STATEMENT,'50:UPDATE_MASS','UPDATE MASS Processing begins.') ;
Line: 1489

        UPDATE pa_cost_distribution_lines
         SET si_assets_addition_flag = 'Y',
             program_update_date     = SYSDATE,
             program_application_id  = FND_GLOBAL.prog_appl_id,
             program_id              = FND_GLOBAL.conc_program_id,
             request_id              = p_request_id
         where si_assets_addition_flag = ('T')
           AND (expenditure_item_id, line_num ) in
                    (SELECT expenditure_item_id, line_num
                       FROM fa_mass_additions_gt
                      WHERE line_status  = 'PROCESSED') ;
Line: 1502

	    write_to_log(FND_LOG.LEVEL_STATEMENT,'50:UPDATE_MASS','UPDATE MASS Record processed:'||SQL%ROWCOUNT );
Line: 1510

        UPDATE pa_cost_distribution_lines
         SET si_assets_addition_flag = 'N',
             program_update_date     = SYSDATE,
             program_application_id  = FND_GLOBAL.prog_appl_id,
             program_id              = FND_GLOBAL.conc_program_id,
             request_id              = p_request_id
         where si_assets_addition_flag = ('T')
           AND (expenditure_item_id, line_num ) in
                    (SELECT expenditure_item_id, line_num
                       FROM fa_mass_additions_gt
                      WHERE line_status  = 'REJECTED') ;
Line: 1523

	    write_to_log(FND_LOG.LEVEL_STATEMENT,'50:UPDATE_MASS', 'UPDATE MASS Record processed with N-status:'||SQL%ROWCOUNT);
Line: 1529

   END update_mass ;
Line: 1533

   PROCEDURE  Insert_Receipts(
                           P_acctg_date                IN    DATE,
                           P_ledger_id                 IN    number,
                           P_user_id                   IN    number,
                           P_request_id                IN    number,
                           P_bt_code                   IN    varchar2,
                           P_primary_accounting_method IN    varchar2,
                           P_calling_sequence          IN    varchar2 DEFAULT NULL) IS
    --
    l_current_calling_sequence   varchar2(2000);
Line: 1546

    l_api_name         CONSTANT  varchar2(100) := 'INSERT_MASS';
Line: 1560

    select ei.expenditure_item_id,
    	   ei.expenditure_item_date ,
           cdl.line_num,
           ei.document_header_id,
           ei.document_distribution_id,
           ei.document_payment_id,
           ei.document_line_number,
           ei.document_type,
           ei.document_distribution_type,
           ei.transaction_source,
           RTRIM(SUBSTRB(eic.expenditure_comment,1,80)) description,
	   (NVL(XDL.unrounded_accounted_dr,0) - NVL(XDL.unrounded_accounted_cr,0)) acct_raw_cost,
           --cdl.acct_raw_cost				acct_raw_cost,
	   cdl.gl_date,
	   cdl.acct_event_id,
           cdl.quantity,
           ei.net_zero_adjustment_flag,
           ei.adjusted_expenditure_item_id,
           ei.transferred_from_exp_item_id,
           ei.vendor_id,
           rtrim(POV.segment1)  vendor_number,
           NULL, --Batch_name
           rcvtxn.transaction_date,
           rcvtxn.created_by       txn_created_by,
           rcvtxn.last_updated_by  txn_updated_by,
           NULL	                invoice_id,
           NULL,                --api.source,
           NULL,                --rtrim(api.invoice_num) invoice_num,
           NULL,                --warranty_number,
           NULL,                --manufacturer,
           NULL,                --serial_number,
           NULL,                --model_number,
           'ACCRUAL',           --line_type_lookup_code,
           rcvtxn.po_distribution_id,
           NULL,                --apd.related_id,
           NULL,                --distribution_line_number,
           NULL,                --apd.invoice_distribution_id,
           NULL,                --dist_code_combination_id,
           NULL,                --apd.invoice_line_number
           decode(cdl.reversed_flag, NULL, NULL,
                      ( select cdl2.si_assets_addition_flag
                        from pa_cost_distribution_lines_all cdl2
                       where cdl2.expenditure_item_id = cdl.expenditure_item_id
                         and cdl2.line_num_reversed   = cdl.line_num ) ) reversed_assets_flag,
           decode(cdl.line_num_reversed, NULL, NULL,
                      ( select cdl2.si_assets_addition_flag
                        from pa_cost_distribution_lines_all cdl2
                       where cdl2.expenditure_item_id = cdl.expenditure_item_id
                         and cdl2.line_num            = cdl.line_num_reversed ) ) source_assets_flag,
            NULL parent_invoice_dist_id,
            'Y'  txn_assets_addition_flag,
            glcc.account_type ,
            xal.code_combination_id,
	    algt.ledger_category_code,
	    algt.ledger_id,
	    fsp.inventory_organization_id
     from  pa_cost_distribution_lines 	cdl,
           xla_ae_headers               xah,
	   xla_ae_lines                 xal,
	   xla_distribution_links       xdl,
           pa_expenditure_items 	ei,
           pa_expenditure_comments  	eic,
           rcv_transactions             rcvtxn ,
	   po_distributions             pod,
	   financials_system_params_all fsp,
           po_vendors                 	pov,
           ap_alc_ledger_gt             algt,
           ap_acct_class_code_gt        aagt,
           gl_code_combinations         glcc,
	   pa_projects_all              p,
	   pa_project_types_all         pt
    where  ei.expenditure_item_id       = cdl.expenditure_item_id
      and  cdl.expenditure_item_id      = eic.expenditure_item_id (+)
      and  cdl.line_num                 = eic.line_number (+)
      and  ei.transaction_source in ('PO RECEIPT',
                                     'PO RECEIPT NRTAX',
				     'PO RECEIPT NRTAX PRICE ADJ',
                                     'PO RECEIPT PRICE ADJ')
      and  cdl.gl_date                  <= P_acctg_date
      and  cdl.line_type                = 'R'
      and  cdl.transfer_status_code     = 'A'
      and  cdl.si_assets_addition_flag  = 'T'
      and  cdl.project_id               = p.project_id
      and  p.project_type               = pt.project_type
      -- Bug : 5368600
      and  p.org_id                     = pt.org_id
      and  pt.project_type_class_code   <> 'CAPITAL'
      and  ei.document_distribution_id  = rcvtxn.transaction_id
      and  pod.po_distribution_id       = rcvtxn.po_distribution_id
      and  pod.org_id                   = fsp.org_id
      and  ei.vendor_id                 = pov.vendor_id
      -- 5911379: Modified the join
      and  xdl.application_id 	        = xah.application_id
      AND  xah.application_id 	        = 275
      and  xah.event_id       	        = cdl.acct_event_id
      AND  xah.balance_type_code        = 'A'
      and  xah.accounting_entry_status_code = 'F'
      and  xal.application_id 	        = xah.application_id
      AND  xal.ae_header_id             = xah.ae_header_id
      and  xal.accounting_class_code    = aagt.accounting_class_code
      and  xdl.event_id       	        = xah.event_id
      AND  xdl.ae_header_id             = xal.ae_header_id
      AND  xdl.ae_line_num              = xal.ae_line_num
      and  xdl.application_id 	        = xal.application_id
      and  xdl.source_distribution_id_num_1 = ei.expenditure_item_id
      and  xdl.source_distribution_id_num_2 = cdl.line_num
      and  pod.set_of_books_id          = p_ledger_id
      AND  xah.ledger_id                = algt.ledger_id
      and  decode(algt.org_id, -99, algt.org_id, cdl.org_id) =
           decode(algt.org_id, -99, -99, algt.org_id)
      -- 5911379: ends
      and  glcc.code_combination_id     = xal.code_combination_id
     order by ei.document_distribution_id, ei.expenditure_item_id, cdl.line_num  ;
Line: 1676

                    'Insert_Mass';
Line: 1678

      write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
                                            'Inside Insert Receipt procedure.') ;
Line: 1683

            write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
                                            'Main Loop Begins here.') ;
Line: 1711

		     t_TxnUpdatedByTab,
		     t_invoiceIdTab,
		     t_sourceTab,
		     t_InvoiceNumberTab,
		     t_warrantyNumberTab,
		     t_ManufacturerTab,
		     t_SerialNumberTab,
		     t_ModelNumberTab,
		     t_linetypeLcdTab,
		     t_poDistIdTab,
		     t_RelatedIdTab,
		     t_DistLineNumberTab,
		     t_invDistIdTab,
		     t_DistCcidTab,
		     t_InvLineNumberTab,
		     t_RvrAssetsFlagTab,
		     t_SrcAssetsFlagTab,
		     t_parentInvDstIdTab,
		     t_apAssetsFlagTab,
		     --t_DstMatchTypeTab,
		     t_accTypeTab,
		     t_XalccidTab,
		     t_ledgercatcdTab,
		     t_ledgerIdTab,
		     t_invOrgIDTab
	    limit l_count ;
Line: 1740

               write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
	                                             'Exiting Main Loop.') ;
Line: 1750

		    write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
							  'Exp Item ID:'|| t_eiIDTab(indx) ) ;
Line: 1752

		    write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
							  'line Number:'|| t_lineNumTab(indx) ) ;
Line: 1754

		    write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
							  'Account Type:'|| t_accTypeTab(indx) ) ;
Line: 1771

			      write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
									  'PO Dist ID  :'|| t_poDistIdTab(indx) ) ;
Line: 1774

			      SELECT mtlsi.asset_category_id,
				     polt.order_type_lookup_code,
				     decode(pod.accrue_on_receipt_flag, 'Y', pod.code_combination_id, NULL ),
				     pod.deliver_to_person_id,
				     rtrim(upper(poh.segment1))
				INTO l_assets_category_id,
				     l_po_order_type_lcd,
				     l_po_ccid,
				     l_assigned_to,
				     l_po_number
				FROM po_distributions_all         pod,
				     po_headers_all               poh,
				     po_lines_all                 pol,
				     po_line_types_b              polt,
				     mtl_system_items             mtlsi
			       WHERE pod.po_distribution_id   = t_PoDistIdTab(indx)
				 AND pod.po_header_id         = poh.po_header_id
				 AND pod.po_line_id           = pol.po_line_id
				 AND pol.line_type_id         = polt.line_type_id
				 AND pol.item_id              = mtlsi.inventory_item_id(+)
				 AND t_InvOrgIDTab(indx)      = mtlsi.organization_id (+) ;
Line: 1796

	                       write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
		                      'Asset_category_id for po distribution:'||l_assets_category_id);
Line: 1825

			   l_TxnUpdatedByTab(lrec)  := t_TxnUpdatedByTab(indx) ;
Line: 1845

                           write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
			                                         'Payable CCID:'||l_payCCIDTab(lrec) ) ;
Line: 1859

	      write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
	                                            'Flag_no_eiIDTab.COUNT:'||Flag_no_eiIDTab.COUNT ) ;
Line: 1863

		  UPDATE pa_cost_distribution_lines
		     SET si_assets_addition_flag = 'N',
			 program_update_date     = SYSDATE,
			 program_application_id  = FND_GLOBAL.prog_appl_id,
			 program_id              = FND_GLOBAL.conc_program_id,
			 request_id              = p_request_id
		   WHERE si_assets_addition_flag in ('T')
		     AND expenditure_item_id =  Flag_no_eiIDTab(i)
		     AND line_num            = Flag_no_lineNumTab(i);
Line: 1875

	      write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
	                                            'l_eiIDtab.count:'||l_eiIDtab.count) ;
Line: 1878

		      INSERT INTO FA_MASS_ADDITIONS_GT(
				    mass_addition_id,
				    description,
				    asset_category_id,
				    manufacturer_name,
				    serial_number,
				    model_number,
				    book_type_code,
				    transaction_date,
				    fixed_assets_cost,
				    payables_units,
				    fixed_assets_units,
				    payables_cost,
				    payables_code_combination_id,
				    assigned_to,
				    feeder_system_name,
				    create_batch_date,
				    create_batch_id,
				    last_update_date,
				    last_updated_by,
				    invoice_date,
				    invoice_created_by,
				    invoice_updated_by,
				    invoice_id,
				    invoice_number,
				    invoice_distribution_id,
				    invoice_line_number,
				    ap_distribution_line_number,
				    merge_invoice_number,
				    merge_vendor_number,
				    vendor_number,
				    po_vendor_id,
				    po_number,
				    payables_batch_name,
				    accounting_date,
				    created_by,
				    creation_date,
				    last_update_login,
				    parent_invoice_dist_id,
				    ledger_id,
				    ledger_category_code,
				    warranty_number,
				    line_type_lookup_code,
				    po_distribution_id,
				    expenditure_item_id,
				    line_num,
				    line_status ,
				    posting_status,
				    queue_name,
				    asset_number,
				    tag_number,
				    depreciate_flag,
				    parent_mass_addition_id,
				    parent_asset_id,
				    split_merged_code,
				    inventorial,
				    date_placed_in_service,
				    transaction_type_code,
				    expense_code_combination_id,
				    location_id,
				    reviewer_comments,
				    post_batch_id,
				    add_to_asset_id,
				    amortize_flag,
				    new_master_flag,
				    asset_key_ccid,
				    asset_type,
				    deprn_reserve,
				    ytd_deprn,
				    beginning_nbv,
				    salvage_value)
		      SELECT  fa_mass_additions_s.nextval,
			      l_descriptionTab(i),
			      l_assetsCatIDTab(i) ,
			      l_ManufacturerTab(i),
			      l_SerialNumberTab(i),
			      l_ModelNumberTab(i),
			      l_BookTypCdTab(i) ,
			      l_eiDateTab(i),
			      l_payCostTab(i),
			      l_PayUnitTab(i),
			      l_FAUnitTab(i),
			      l_payCostTab(i),
			      l_payCCIDTab(i),
			      l_assignedToTab(i) ,
			      'ORACLE PROJECTS',
			      trunc(SYSDATE)	Create_batch_date,
			      P_request_id   	create_batch_id,
			      trunc(SYSDATE)    last_update_date,
			      p_user_id		last_update_by,
			      l_TxnDateTab(i) ,
			      l_TxnCreatedByTab(i),
			      l_TxnUpdatedByTab(i),
			      l_invoiceIdTab(i) ,
			      l_InvoiceNumberTab(i),
			      l_invDistIdtab(i)  ,
			      l_InvLineNumberTab(i),
			      l_DistLineNumberTab(i),
			      l_InvoiceNumberTab(i),
			      l_vendorNumberTab(i),
			      l_vendorNumberTab(i),
			      l_vendorIdTab(i),
			      l_PoNumberTab(i),
			      l_payBatchNameTab(i), --Payables Batch Name,
			      l_GlDateTab(i) ,
			      p_user_id,	-- Created by
			      trunc(SYSDATE),	-- creation date
			      p_user_id, 	-- lst update login
			      l_parentInvDstIdTab(i),
			      l_ledgeridTab(i) ,
			      l_ledgerCatcdTab(i),
			      l_warrantyNumberTab(i),
			      l_linetypeLcdtab(i),
			      l_poDistIdTab(i),
			      l_eiIDtab(i),
			      l_lineNumTab(lrec) ,
			      'NEW',
			      'NEW',
			      'NEW',
			      NULL, 	-- assets_number
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL,
			      NULL -- Salvage Value
			from DUAL ;
Line: 2020

		      write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
		                                            'Inserting MRC Records...') ;
Line: 2024

      write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT',
                                          'End of Receipt Insert') ;
Line: 2029

      write_to_log(FND_LOG.LEVEL_STATEMENT, '50:PA INSERT_RECEIPT', SQLERRM) ;
Line: 2032

    END Insert_Receipts;
Line: 2042

	t_eiIDtab.DELETE ;
Line: 2043

	t_eiDatetab.DELETE ;
Line: 2044

	t_lineNumtab.DELETE ;
Line: 2045

	t_DocHeaderIdtab.DELETE ;
Line: 2046

        t_DocDistIdtab.DELETE ;
Line: 2047

	t_DocPaymentIdtab.DELETE ;
Line: 2048

	t_DocLineNumbertab.DELETE ;
Line: 2049

	t_DocTypetab.DELETE ;
Line: 2050

	t_DocDistTypetab.DELETE ;
Line: 2051

	t_transSourcetab.DELETE ;
Line: 2052

	t_descriptiontab.DELETE ;
Line: 2053

	t_acctRawCosttab.DELETE ;
Line: 2054

	t_NZAdjFlagtab.DELETE ;
Line: 2055

	t_adjEiIdtab.DELETE ;
Line: 2056

        t_trFmEiIdtab.DELETE ;
Line: 2057

	t_vendorIdtab.DELETE ;
Line: 2058

	t_vendorNumbertab.DELETE ;
Line: 2059

	t_TxnDatetab.DELETE ;
Line: 2060

	t_TxnCreatedByTab.DELETE ;
Line: 2061

	t_TxnUpdatedByTab.DELETE ;
Line: 2062

	t_invoiceIdtab.DELETE ;
Line: 2063

	t_sourcetab.DELETE ;
Line: 2064

	t_InvoiceNumbertab.DELETE ;
Line: 2065

	t_warrantyNumberTab.DELETE ;
Line: 2066

	t_Manufacturertab.DELETE ;
Line: 2067

	t_SerialNumbertab.DELETE ;
Line: 2068

	t_ModelNumbertab.DELETE ;
Line: 2069

	t_linetypeLcdtab.DELETE ;
Line: 2070

	t_poDistIdtab.DELETE ;
Line: 2071

	t_RelatedIdtab.DELETE ;
Line: 2072

	t_DistLineNumbertab.DELETE ;
Line: 2073

	t_invDistIdtab.DELETE ;
Line: 2074

	t_DistCcidtab.DELETE ;
Line: 2075

	t_InvLineNumbertab.DELETE ;
Line: 2076

	t_RvrAssetsFlagtab.DELETE ;
Line: 2077

	t_SrcAssetsFlagtab.DELETE ;
Line: 2078

	t_parentInvDstIdtab.DELETE ;
Line: 2079

	t_apAssetsFlagTab.DELETE ;
Line: 2080

	t_DstMatchTypetab.DELETE ;
Line: 2081

        t_GlDateTab.DELETE ;
Line: 2082

        t_cdlEventIDTab.Delete ;
Line: 2083

        t_cdlQtyTab.DELETE ;
Line: 2084

        t_SiAssetsFlagTab.delete ;
Line: 2088

	t_ATrackFlagTab.delete ;
Line: 2089

        t_payBatchNameTab.delete ;
Line: 2090

        Flag_no_eiIDTab.DELETE ;
Line: 2091

        Flag_no_lineNumTab.DELETE ;
Line: 2093

	t_invOrgIDTab.DELETE ;
Line: 2098

        l_SiAssetsFlagTab.delete ;
Line: 2099

	l_descriptionTab.Delete ;
Line: 2100

	l_poDistIdTab.Delete ;
Line: 2101

	l_assetsCatIDTab.Delete ;
Line: 2102

	l_ManufacturerTab.Delete ;
Line: 2103

	l_SerialNumberTab.Delete ;
Line: 2104

	l_ModelNumberTab.Delete ;
Line: 2105

	l_BookTypCdTab.Delete ;
Line: 2106

	l_eiDateTab.Delete ;
Line: 2107

	l_FACostTab.Delete ;
Line: 2108

	l_PayUnitTab.Delete ;
Line: 2109

	l_FAUnitTab.Delete ;
Line: 2110

	l_assignedToTab.Delete ;
Line: 2111

	l_payCostTab.Delete ;
Line: 2112

	l_vendorNumberTab.Delete ;
Line: 2113

	l_vendorIdTab.Delete ;
Line: 2114

	l_PoNumberTab.Delete ;
Line: 2115

	l_TxnDateTab.Delete ;
Line: 2116

	l_TxnCreatedByTab.Delete ;
Line: 2117

	l_TxnUpdatedByTab.Delete ;
Line: 2118

	l_invoiceIdTab.Delete ;
Line: 2119

	l_payBatchNameTab.Delete ;
Line: 2120

	l_DistLineNumberTab.Delete ;
Line: 2121

	l_GlDateTab.Delete ;
Line: 2122

	l_invDistIdTab.Delete ;
Line: 2123

	l_parentInvDstIdTab.Delete ;
Line: 2124

	l_linetypeLcdTab.Delete ;
Line: 2125

	l_eiIDTab.Delete ;
Line: 2126

	l_warrantyNumberTab.Delete ;
Line: 2127

	l_InvLineNumberTab.Delete ;
Line: 2128

	l_PayCcidTab.Delete ;
Line: 2129

        l_cdlEventIDTab.Delete ;
Line: 2130

        l_cdlQtyTab.DELETE ;
Line: 2131

        l_payBatchNameTab.delete ;
Line: 2133

        l_XalccidTab.DELETE ;
Line: 2134

        l_accTypeTab.DELETE ;
Line: 2135

        t_XalccidTab.DELETE ;
Line: 2136

        t_accTypeTab.DELETE ;
Line: 2138

	l_ledgeridtab.delete ;
Line: 2139

	l_ledgercatcdTab.delete ;
Line: 2140

	l_ATrackFlagTab.delete ;
Line: 2142

	t_ledgeridtab.delete ;
Line: 2143

	t_ledgercatcdTab.delete ;