DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_BOOK_CONTROLS_PKG

Source


1 PACKAGE BODY FA_BOOK_CONTROLS_PKG as
2 /* $Header: faxibcb.pls 120.9.12020000.4 2013/03/08 05:03:25 rmandali ship $ */
3 
4 
5   PROCEDURE Insert_Row(X_Rowid            IN OUT NOCOPY VARCHAR2,
6                        X_Book_Type_Code   IN OUT NOCOPY VARCHAR2,
7                        X_Book_Type_Name                 VARCHAR2,
8                        X_Set_Of_Books_Id                NUMBER,
9                        X_Initial_Date                   DATE,
10                        X_Last_Deprn_Run_Date            DATE,
11                        X_Amortize_Flag                  VARCHAR2,
12                        X_Fully_Reserved_Flag            VARCHAR2,
13                        X_Deprn_Calendar                 VARCHAR2,
14                        X_Book_Class                     VARCHAR2,
15                        X_GL_Posting_Allowed_Flag        VARCHAR2,
16                        X_Current_Fiscal_Year            NUMBER,
17                        X_Allow_Mass_Changes             VARCHAR2,
18                        X_Allow_Deprn_Adjustments        VARCHAR2,
19                        X_Accounting_Flex_Structure      NUMBER,
20                        X_Last_Update_Date               DATE,
21                        X_Last_Updated_By                NUMBER,
22                        X_Prorate_Calendar               VARCHAR2,
23                        X_Date_Ineffective               DATE     DEFAULT NULL,
24                        X_JE_Retirement_Category         VARCHAR2 DEFAULT NULL,
25                        X_JE_Depreciation_Category       VARCHAR2 DEFAULT NULL,
26                        X_JE_Reclass_Category            VARCHAR2 DEFAULT NULL,
27                        X_GL_JE_Source                   VARCHAR2 DEFAULT NULL,
28                        X_JE_Addition_Category           VARCHAR2 DEFAULT NULL,
29                        X_JE_Adjustment_Category         VARCHAR2 DEFAULT NULL,
30                        X_Distribution_Source_Book       VARCHAR2 DEFAULT NULL,
31                        X_JE_Transfer_Category           VARCHAR2 DEFAULT NULL,
32                        X_Copy_Retirements_Flag          VARCHAR2,
33                        X_Copy_Adjustments_Flag          VARCHAR2,
34                        X_Deprn_Request_ID               NUMBER   DEFAULT NULL,
35                        X_Allow_Cost_Ceiling             VARCHAR2,
36                        X_Allow_Deprn_Exp_Ceiling        VARCHAR2,
37                        X_Calculate_NBV                  VARCHAR2,
38                        X_Run_Year_End_Program           VARCHAR2,
39                        X_JE_Deferred_Deprn_Category     VARCHAR2 DEFAULT NULL,
40                        X_ITC_Allowed_Flag               VARCHAR2,
41                        X_Created_By                     NUMBER   DEFAULT NULL,
42                        X_Creation_Date                  DATE     DEFAULT NULL,
43                        X_Last_Update_Login              NUMBER   DEFAULT NULL,
44                        X_Allow_Mass_Copy                VARCHAR2,
45                        X_Allow_Purge_Flag               VARCHAR2 DEFAULT NULL,
46                        X_Allow_Reval_Flag               VARCHAR2,
47                        X_Amortize_Reval_Reserve_Flag    VARCHAR2 DEFAULT NULL,
48                        X_AP_Intercompany_Acct           VARCHAR2,
49                        X_AR_Intercompany_Acct           VARCHAR2,
50                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
51                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
52                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
53                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
54                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
55                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
56                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
57                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
58                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
59                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
60                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
61                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
62                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
63                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
64                        X_Attribute15                    VARCHAR2 DEFAULT NULL,
65                        X_Attribute_Category_Code        VARCHAR2 DEFAULT NULL,
66                        X_Capital_Gain_Threshold         NUMBER   DEFAULT NULL,
67                        X_Copy_Salvage_Value_Flag        VARCHAR2,
68                        X_Cost_Of_Removal_ClearingAcct   VARCHAR2,
69                        X_Cost_Of_Removal_Gain_Acct      VARCHAR2,
70                        X_Cost_Of_Removal_Loss_Acct      VARCHAR2,
71                        X_Default_Life_Ext_Ceiling       NUMBER   DEFAULT NULL,
72                        X_Default_Life_Ext_Factor        NUMBER   DEFAULT NULL,
73                        X_Default_Max_Fully_Rsvd_Reval   NUMBER   DEFAULT NULL,
74                        X_Default_Rev_Fully_Rsvd_Flag    VARCHAR2 DEFAULT NULL,
75                        X_Deferred_Deprn_Expense_Acct    VARCHAR2,
76                        X_Deferred_Deprn_Reserve_Acct    VARCHAR2,
77                        X_Deprn_Allocation_Code          VARCHAR2,
78                        X_Deprn_Status                   VARCHAR2 DEFAULT NULL,
79                        X_Fiscal_Year_Name               VARCHAR2 DEFAULT NULL,
80                        X_Initial_Period_Counter         VARCHAR2,
81                        X_JE_CIP_Adjustment_Category     VARCHAR2 DEFAULT NULL,
82                        X_JE_CIP_Addition_Category       VARCHAR2 DEFAULT NULL,
83                        X_JE_CIP_Reclass_Category        VARCHAR2 DEFAULT NULL,
84                        X_JE_CIP_Retirement_Category     VARCHAR2 DEFAULT NULL,
85                        X_JE_CIP_Reval_Category          VARCHAR2 DEFAULT NULL,
86                        X_JE_CIP_Transfer_Category       VARCHAR2 DEFAULT NULL,
87                        X_JE_Reval_Category              VARCHAR2 DEFAULT NULL,
88                        X_Last_Mass_Copy_Period_Ctr      NUMBER   DEFAULT NULL,
89                        X_Last_Period_Counter            NUMBER,
90                        X_Last_Purge_Period_Counter      NUMBER   DEFAULT NULL,
91                        X_Mass_Copy_Source_Book          VARCHAR2 DEFAULT NULL,
92                        X_Mass_Request_ID                NUMBER   DEFAULT NULL,
93                        X_NBV_Amount_Threshold           NUMBER   DEFAULT NULL,
94                        X_NBV_Fraction_Threshold         NUMBER   DEFAULT NULL,
95                        X_NBV_Retired_Gain_Acct          VARCHAR2,
96                        X_NBV_Retired_Loss_Acct          VARCHAR2,
97                        X_Proceeds_Of_Sale_Clear_Acct    VARCHAR2,
98                        X_Proceeds_Of_Sale_Gain_Acct     VARCHAR2,
99                        X_Proceeds_Of_Sale_Loss_Acct     VARCHAR2,
100                        X_Revalue_On_Retirement_Flag     VARCHAR2 DEFAULT NULL,
101                        X_Reval_Deprn_Reserve_Flag       VARCHAR2 DEFAULT NULL,
102                        X_Reval_Rsv_Retired_Gain_Acct    VARCHAR2,
103                        X_Reval_Rsv_Retired_Loss_Acct    VARCHAR2,
104                        X_Deprn_Adjustment_Acct          VARCHAR2,
105                        X_Immediate_Copy_Flag            VARCHAR2 DEFAULT NULL,
106                        X_JE_Deprn_Adjustment_Category   VARCHAR2 DEFAULT NULL,
107                        X_Depr_First_Year_Ret_Flag       VARCHAR2,
108                        X_Flexbuilder_Defaults_CCID      NUMBER,
109                        X_Retire_Reval_Reserve_Flag      VARCHAR2 DEFAULT NULL,
110                        X_Use_Current_NBV_For_Deprn      VARCHAR2,
111                        X_Copy_Additions_Flag            VARCHAR2,
112                        X_Percent_Salvage_Value_Flag     VARCHAR2 DEFAULT NULL,
113                        X_Reval_Posting_Flag             VARCHAR2 DEFAULT NULL,
114                        X_Global_Attribute1              VARCHAR2 DEFAULT NULL,
115                        X_Global_Attribute2              VARCHAR2 DEFAULT NULL,
116                        X_Global_Attribute3              VARCHAR2 DEFAULT NULL,
117                        X_Global_Attribute4              VARCHAR2 DEFAULT NULL,
118                        X_Global_Attribute5              VARCHAR2 DEFAULT NULL,
119                        X_Global_Attribute6              VARCHAR2 DEFAULT NULL,
120                        X_Global_Attribute7              VARCHAR2 DEFAULT NULL,
121                        X_Global_Attribute8              VARCHAR2 DEFAULT NULL,
122                        X_Global_Attribute9              VARCHAR2 DEFAULT NULL,
123                        X_Global_Attribute10             VARCHAR2 DEFAULT NULL,
124                        X_Global_Attribute11             VARCHAR2 DEFAULT NULL,
125                        X_Global_Attribute12             VARCHAR2 DEFAULT NULL,
126                        X_Global_Attribute13             VARCHAR2 DEFAULT NULL,
127                        X_Global_Attribute14             VARCHAR2 DEFAULT NULL,
128                        X_Global_Attribute15             VARCHAR2 DEFAULT NULL,
129                        X_Global_Attribute16             VARCHAR2 DEFAULT NULL,
130                        X_Global_Attribute17             VARCHAR2 DEFAULT NULL,
131                        X_Global_Attribute18             VARCHAR2 DEFAULT NULL,
132                        X_Global_Attribute19             VARCHAR2 DEFAULT NULL,
133                        X_Global_Attribute20             VARCHAR2 DEFAULT NULL,
134                        X_Global_Attribute_Category      VARCHAR2 DEFAULT NULL,
135                        X_MC_Source_Flag                 VARCHAR2 DEFAULT NULL,
136                        X_Reval_YTD_Deprn_Flag           VARCHAR2 DEFAULT NULL,
137                        X_Allow_CIP_Assets_Flag          VARCHAR2 DEFAULT NULL,
138                        X_Org_ID                         NUMBER   DEFAULT NULL,
139                        X_Allow_Group_Deprn_Flag         VARCHAR2 DEFAULT NULL,
140                        X_Allow_CIP_Dep_Group_Flag       VARCHAR2 DEFAULT NULL,
141                        X_Allow_Interco_Group_Flag       VARCHAR2 DEFAULT NULL,
142                        X_Copy_Group_Assignment_Flag     VARCHAR2 DEFAULT NULL,
143                        X_Copy_Group_Additon_Flag        VARCHAR2 DEFAULT NULL,
144                        X_Allow_CIP_Member_Flag          VARCHAR2 DEFAULT NULL,
145                        X_Allow_Member_Tracking_Flag     VARCHAR2 DEFAULT NULL,
146                        X_Intercompany_Posting_Flag      VARCHAR2 DEFAULT NULL,
147                        X_Backdated_Transfers_Flag       VARCHAR2 DEFAULT NULL,
148                        X_allow_cost_sign_change_flag    VARCHAR2 DEFAULT NULL,
149                        X_Sorp_Enabled_Flag              VARCHAR2 DEFAULT NULL, -- Bug 6666666 : Added for SORP Compliance Project
150                        X_copy_amort_adaj_exp_flag       VARCHAR2 DEFAULT NULL,
151                        X_copy_group_change_flag         VARCHAR2 DEFAULT NULL,
152                        X_prevent_prior_prd_txns_flag    VARCHAR2 DEFAULT NULL,
153                        X_allow_unallocated_lines_flag   VARCHAR2 DEFAULT NULL,
154                        X_MRC_SOB_Type_Code              VARCHAR2 DEFAULT 'P',
155                        X_DEFAULT_PERIOD_END_REVAL_FLG   VARCHAR2 DEFAULT NULL,
156                        X_IMPORT_ALLOC_INV_LINES_NEW     VARCHAR2 DEFAULT NULL,
157                        X_Return_Status       OUT NOCOPY BOOLEAN,
158                        X_Calling_Fn                     VARCHAR2
159   , p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) AS
160 
161     CURSOR C_bc IS SELECT rowid FROM fa_book_controls
162                  WHERE book_type_code = X_Book_Type_Code;
163 
164     CURSOR C_bc_mc IS SELECT rowid FROM fa_mc_book_controls
165                  WHERE book_type_code = X_Book_Type_Code
166                  AND set_of_books_id = X_Set_Of_books_Id;
167 
168   BEGIN
169 
170 
171   if (nvl(X_mrc_sob_type_code, 'P') = 'P') then
172 
173      insert into fa_book_controls (
174             book_type_code,
175             book_type_name,
176             set_of_books_id,
177             initial_date,
178             last_deprn_run_date,
179             amortize_flag,
180             fully_reserved_flag,
181             deprn_calendar,
182             book_class,
183             gl_posting_allowed_flag,
184             current_fiscal_year,
185             allow_mass_changes,
186             allow_deprn_adjustments,
187             accounting_flex_structure,
188             last_update_date,
189             last_updated_by,
190             prorate_calendar,
191             date_ineffective,
192             je_retirement_category,
193             je_depreciation_category,
194             je_reclass_category,
195             gl_je_source,
196             je_addition_category,
197             je_adjustment_category,
198             distribution_source_book,
199             je_transfer_category,
200             copy_retirements_flag,
201             copy_adjustments_flag,
202             deprn_request_id,
203             allow_cost_ceiling,
204             allow_deprn_exp_ceiling,
205             calculate_nbv,
206             run_year_end_program,
207             je_deferred_deprn_category,
208             itc_allowed_flag,
209             created_by,
210             creation_date,
211             last_update_login,
212             allow_mass_copy,
213             allow_purge_flag,
214             allow_reval_flag,
215             amortize_reval_reserve_flag,
216             ap_intercompany_acct,
217             ar_intercompany_acct,
218             attribute1,
219             attribute2,
220             attribute3,
221             attribute4,
222             attribute5,
223             attribute6,
224             attribute7,
225             attribute8,
226             attribute9,
227             attribute10,
228             attribute11,
229             attribute12,
230             attribute13,
231             attribute14,
232             attribute15,
233             attribute_category_code,
234             capital_gain_threshold,
235             copy_salvage_value_flag,
236             cost_of_removal_clearing_acct,
237             cost_of_removal_gain_acct,
238             cost_of_removal_loss_acct,
239             default_life_extension_ceiling,
240             default_life_extension_factor,
241             default_max_fully_rsvd_revals,
242             default_reval_fully_rsvd_flag,
243             deferred_deprn_expense_acct,
244             deferred_deprn_reserve_acct,
245             deprn_allocation_code,
246             deprn_status,
247             fiscal_year_name,
248             initial_period_counter,
249             je_cip_adjustment_category,
250             je_cip_addition_category,
251             je_cip_reclass_category,
252             je_cip_retirement_category,
253             je_cip_reval_category,
254             je_cip_transfer_category,
255             je_reval_category,
256             last_mass_copy_period_counter,
257             last_period_counter,
258             last_purge_period_counter,
259             mass_copy_source_book,
260             mass_request_id,
261             nbv_amount_threshold,
262             nbv_fraction_threshold,
263             nbv_retired_gain_acct,
264             nbv_retired_loss_acct,
265             proceeds_of_sale_clearing_acct,
266             proceeds_of_sale_gain_acct,
267             proceeds_of_sale_loss_acct,
268             revalue_on_retirement_flag,
269             reval_deprn_reserve_flag,
270             reval_rsv_retired_gain_acct,
271             reval_rsv_retired_loss_acct,
272             deprn_adjustment_acct,
273             immediate_copy_flag,
274             je_deprn_adjustment_category,
275             depr_first_year_ret_flag,
276             flexbuilder_defaults_ccid,
277             retire_reval_reserve_flag,
278             use_current_nbv_for_deprn,
279             copy_additions_flag,
280             use_percent_salvage_value_flag,
281             reval_posting_flag,
282             global_attribute1,
283             global_attribute2,
284             global_attribute3,
285             global_attribute4,
286             global_attribute5,
287             global_attribute6,
288             global_attribute7,
289             global_attribute8,
290             global_attribute9,
291             global_attribute10,
292             global_attribute11,
293             global_attribute12,
294             global_attribute13,
295             global_attribute14,
296             global_attribute15,
297             global_attribute16,
298             global_attribute17,
299             global_attribute18,
300             global_attribute19,
301             global_attribute20,
302             global_attribute_category,
303             mc_source_flag,
304             reval_ytd_deprn_flag,
305             allow_cip_assets_flag,
306             org_id,
307             allow_group_deprn_flag,
308             allow_cip_dep_group_flag,
309             allow_interco_group_flag,
313             allow_member_tracking_flag,
310             copy_group_assignment_flag,
311             copy_group_addition_flag,
312             allow_cip_member_flag,
314             intercompany_posting_flag,
315             allow_backdated_transfers_flag,
316             allow_cost_sign_change_flag,
317             sorp_enabled_flag,  -- Bug 6666666 : Added for SORP Compliance Project
318             copy_amort_adaj_exp_flag,
319             copy_group_change_flag,
320             prevent_prior_period_txns_flag,
321             allow_unallocated_lines_flag,
322             DEFAULT_PERIOD_END_REVAL_FLAG,
323             IMPORT_ALLOC_INV_LINES_AS_NEW
324      ) values (
325             X_Book_Type_Code,
326             X_Book_Type_Name,
327             X_Set_Of_Books_Id,
328             X_Initial_Date,
329             X_Last_Deprn_Run_Date,
330             X_Amortize_Flag,
331             X_Fully_Reserved_Flag,
332             X_Deprn_Calendar,
333             X_Book_Class,
334             X_GL_Posting_Allowed_Flag,
335             X_Current_Fiscal_Year,
336             X_Allow_Mass_Changes,
337             X_Allow_Deprn_Adjustments,
338             X_Accounting_Flex_Structure,
339             X_Last_Update_Date,
340             X_Last_Updated_By,
341             X_Prorate_Calendar,
342             X_Date_Ineffective,
343             X_JE_Retirement_Category,
344             X_JE_Depreciation_Category,
345             X_JE_Reclass_Category,
346             X_GL_JE_Source,
347             X_JE_Addition_Category,
348             X_JE_Adjustment_Category,
349             X_Distribution_Source_Book,
350             X_JE_Transfer_Category,
351             X_Copy_Retirements_Flag,
352             X_Copy_Adjustments_Flag,
353             X_Deprn_Request_ID,
354             X_Allow_Cost_Ceiling,
355             X_Allow_Deprn_Exp_Ceiling,
356             X_Calculate_NBV,
357             X_Run_Year_End_Program,
358             X_JE_Deferred_Deprn_Category,
359             X_ITC_Allowed_Flag,
360             X_Created_By,
361             X_Creation_Date,
362             X_Last_Update_Login,
363             X_Allow_Mass_Copy,
364             X_Allow_Purge_Flag,
365             X_Allow_Reval_Flag,
366             X_Amortize_Reval_Reserve_Flag,
367             X_AP_Intercompany_Acct,
368             X_AR_Intercompany_Acct,
369             X_Attribute1,
370             X_Attribute2,
371             X_Attribute3,
372             X_Attribute4,
373             X_Attribute5,
374             X_Attribute6,
375             X_Attribute7,
376             X_Attribute8,
377             X_Attribute9,
378             X_Attribute10,
379             X_Attribute11,
380             X_Attribute12,
381             X_Attribute13,
382             X_Attribute14,
383             X_Attribute15,
384             X_Attribute_Category_Code,
385             X_Capital_Gain_Threshold,
386             X_Copy_Salvage_Value_Flag,
387             X_Cost_Of_Removal_ClearingAcct,
388             X_Cost_Of_Removal_Gain_Acct,
389             X_Cost_Of_Removal_Loss_Acct,
390             X_Default_Life_Ext_Ceiling,
391             X_Default_Life_Ext_Factor,
392             X_Default_Max_Fully_Rsvd_Reval,
393             X_Default_Rev_Fully_Rsvd_Flag,
394             X_Deferred_Deprn_Expense_Acct,
395             X_Deferred_Deprn_Reserve_Acct,
396             X_Deprn_Allocation_Code,
397             X_Deprn_Status,
398             X_Fiscal_Year_Name,
399             X_Initial_Period_Counter,
400             X_JE_CIP_Adjustment_Category,
401             X_JE_CIP_Addition_Category,
402             X_JE_CIP_Reclass_Category,
403             X_JE_CIP_Retirement_Category,
404             X_JE_CIP_Reval_Category,
405             X_JE_CIP_Transfer_Category,
406             X_JE_Reval_Category,
407             X_Last_Mass_Copy_Period_Ctr,
408             X_Last_Period_Counter,
409             X_Last_Purge_Period_Counter,
410             X_Mass_Copy_Source_Book,
411             X_Mass_Request_ID,
412             X_NBV_Amount_Threshold,
413             X_NBV_Fraction_Threshold,
414             X_NBV_Retired_Gain_Acct,
415             X_NBV_Retired_Loss_Acct,
416             X_Proceeds_Of_Sale_Clear_Acct,
417             X_Proceeds_Of_Sale_Gain_Acct,
418             X_Proceeds_Of_Sale_Loss_Acct,
419             X_Revalue_On_Retirement_Flag,
420             X_Reval_Deprn_Reserve_Flag,
421             X_Reval_Rsv_Retired_Gain_Acct,
422             X_Reval_Rsv_Retired_Loss_Acct,
423             X_Deprn_Adjustment_Acct,
424             X_Immediate_Copy_Flag,
425             X_JE_Deprn_Adjustment_Category,
426             X_Depr_First_Year_Ret_Flag,
427             X_Flexbuilder_Defaults_CCID,
428             X_Retire_Reval_Reserve_Flag,
429             X_Use_Current_NBV_For_Deprn,
430             X_Copy_Additions_Flag,
431             X_Percent_Salvage_Value_Flag,
432             X_Reval_Posting_Flag,
433             X_Global_Attribute1,
434             X_Global_Attribute2,
435             X_Global_Attribute3,
436             X_Global_Attribute4,
437             X_Global_Attribute5,
438             X_Global_Attribute6,
439             X_Global_Attribute7,
440             X_Global_Attribute8,
441             X_Global_Attribute9,
442             X_Global_Attribute10,
443             X_Global_Attribute11,
444             X_Global_Attribute12,
445             X_Global_Attribute13,
446             X_Global_Attribute14,
447             X_Global_Attribute15,
448             X_Global_Attribute16,
449             X_Global_Attribute17,
450             X_Global_Attribute18,
451             X_Global_Attribute19,
452             X_Global_Attribute20,
456             X_Allow_CIP_Assets_Flag,
453             X_Global_Attribute_Category,
454             X_MC_Source_Flag,
455             X_Reval_YTD_Deprn_Flag,
457             X_Org_ID,
458             X_Allow_Group_Deprn_Flag,
459             X_Allow_CIP_Dep_Group_Flag,
460             X_Allow_Interco_Group_Flag,
461             X_Copy_Group_Assignment_Flag,
462             X_Copy_Group_Additon_Flag,
463             X_Allow_CIP_Member_Flag,
464             X_Allow_Member_Tracking_Flag,
465             X_Intercompany_Posting_Flag,
466             X_Backdated_Transfers_Flag,
467             X_allow_cost_sign_change_flag,
468             X_Sorp_Enabled_Flag,  -- Bug 6666666 : Added for SORP Compliance Project,
469             X_copy_amort_adaj_exp_flag,
470             X_copy_group_change_flag,
471             X_prevent_prior_prd_txns_flag,
472             X_allow_unallocated_lines_flag,
473             X_DEFAULT_PERIOD_END_REVAL_FLG,
474             X_IMPORT_ALLOC_INV_LINES_NEW
475      );
476 
477      OPEN C_bc;
478      FETCH C_bc INTO X_Rowid;
479      if (C_bc%NOTFOUND) then
480         CLOSE C_bc;
481         Raise NO_DATA_FOUND;
482      end if;
483      CLOSE C_bc;
484 
485      insert into fa_book_controls_history (
486             book_type_code,
487             date_active,
488             date_inactive,
489             book_type_name,
490             set_of_books_id,
491             --initial_date,
492             --last_deprn_run_date,
493             amortize_flag,
494             --fully_reserved_flag,
495             --deprn_calendar,
496             --book_class,
497             gl_posting_allowed_flag,
498             --current_fiscal_year,
499             allow_mass_changes,
500             allow_deprn_adjustments,
501             --accounting_flex_structure,
502             last_update_date,
503             last_updated_by,
504             --prorate_calendar,
505             date_ineffective,
506             je_retirement_category,
507             je_depreciation_category,
508             je_reclass_category,
509             gl_je_source,
510             je_addition_category,
511             je_adjustment_category,
512             --distribution_source_book,
513             je_transfer_category,
514             copy_retirements_flag,
515             copy_adjustments_flag,
516             --deprn_request_id,
517             allow_cost_ceiling,
518             allow_deprn_exp_ceiling,
519             --calculate_nbv,
520             --run_year_end_program,
521             je_deferred_deprn_category,
522             itc_allowed_flag,
523             created_by,
524             creation_date,
525             last_update_login,
526             allow_mass_copy,
527             allow_purge_flag,
528             allow_reval_flag,
529             amortize_reval_reserve_flag,
530             ap_intercompany_acct,
531             ar_intercompany_acct,
532             attribute1,
533             attribute2,
534             attribute3,
535             attribute4,
536             attribute5,
537             attribute6,
538             attribute7,
539             attribute8,
540             attribute9,
541             attribute10,
542             attribute11,
543             attribute12,
544             attribute13,
545             attribute14,
546             attribute15,
547             attribute_category_code,
548             capital_gain_threshold,
549             copy_salvage_value_flag,
550             cost_of_removal_clearing_acct,
551             cost_of_removal_gain_acct,
552             cost_of_removal_loss_acct,
553             default_life_extension_ceiling,
554             default_life_extension_factor,
555             default_max_fully_rsvd_revals,
556             default_reval_fully_rsvd_flag,
557             deferred_deprn_expense_acct,
558             deferred_deprn_reserve_acct,
559             deprn_allocation_code,
560             --deprn_status,
561             --fiscal_year_name,
562             --initial_period_counter,
563             je_cip_adjustment_category,
564             je_cip_addition_category,
565             je_cip_reclass_category,
566             je_cip_retirement_category,
567             je_cip_reval_category,
568             je_cip_transfer_category,
569             je_reval_category,
570             --last_mass_copy_period_counter,
571             --last_period_counter,
572             --last_purge_period_counter,
573             --mass_copy_source_book,
574             --mass_request_id,
575             nbv_amount_threshold,
576             nbv_fraction_threshold,
577             nbv_retired_gain_acct,
578             nbv_retired_loss_acct,
579             proceeds_of_sale_clearing_acct,
580             proceeds_of_sale_gain_acct,
581             proceeds_of_sale_loss_acct,
582             revalue_on_retirement_flag,
583             reval_deprn_reserve_flag,
584             reval_rsv_retired_gain_acct,
585             reval_rsv_retired_loss_acct,
586             deprn_adjustment_acct,
587             immediate_copy_flag,
588             je_deprn_adjustment_category,
589             depr_first_year_ret_flag,
590             flexbuilder_defaults_ccid,
591             retire_reval_reserve_flag,
592             --use_current_nbv_for_deprn,
593             copy_additions_flag,
594             use_percent_salvage_value_flag,
595             reval_posting_flag,
596             global_attribute1,
597             global_attribute2,
598             global_attribute3,
599             global_attribute4,
600             global_attribute5,
601             global_attribute6,
605             global_attribute10,
602             global_attribute7,
603             global_attribute8,
604             global_attribute9,
606             global_attribute11,
607             global_attribute12,
608             global_attribute13,
609             global_attribute14,
610             global_attribute15,
611             global_attribute16,
612             global_attribute17,
613             global_attribute18,
614             global_attribute19,
615             global_attribute20,
616             global_attribute_category,
617             mc_source_flag,
618             reval_ytd_deprn_flag,
619             allow_cip_assets_flag,
620             org_id,
621             allow_group_deprn_flag,
622             allow_cip_dep_group_flag,
623             allow_interco_group_flag,
624             copy_group_assignment_flag,
625             copy_group_addition_flag,
626             allow_cip_member_flag,
627             allow_member_tracking_flag,
628             intercompany_posting_flag,
629             allow_backdated_transfers_flag,
630             allow_cost_sign_change_flag,
631             sorp_enabled_flag,  -- Bug 6666666 : Added for SORP Compliance Project
632             copy_amort_adaj_exp_flag,
633             copy_group_change_flag,
634             prevent_prior_period_txns_flag,
635             allow_unallocated_lines_flag,
636             DEFAULT_PERIOD_END_REVAL_FLAG,
637             IMPORT_ALLOC_INV_LINES_AS_NEW
638      ) values (
639             X_Book_Type_Code,
640             sysdate,                -- date_active
641             null,                   -- date_inactive
642             X_Book_Type_Name,
643             X_Set_Of_Books_Id,
644             --X_Initial_Date,
645             --X_Last_Deprn_Run_Date,
646             X_Amortize_Flag,
647             --X_Fully_Reserved_Flag,
648             --X_Deprn_Calendar,
649             --X_Book_Class,
650             X_GL_Posting_Allowed_Flag,
651             --X_Current_Fiscal_Year,
652             X_Allow_Mass_Changes,
653             X_Allow_Deprn_Adjustments,
654             --X_Accounting_Flex_Structure,
655             X_Last_Update_Date,
656             X_Last_Updated_By,
657             --X_Prorate_Calendar,
658             X_Date_Ineffective,
659             X_JE_Retirement_Category,
660             X_JE_Depreciation_Category,
661             X_JE_Reclass_Category,
662             X_GL_JE_Source,
663             X_JE_Addition_Category,
664             X_JE_Adjustment_Category,
665             --X_Distribution_Source_Book,
666             X_JE_Transfer_Category,
667             X_Copy_Retirements_Flag,
668             X_Copy_Adjustments_Flag,
669             --X_Deprn_Request_ID,
670             X_Allow_Cost_Ceiling,
671             X_Allow_Deprn_Exp_Ceiling,
672             --X_Calculate_NBV,
673             --X_Run_Year_End_Program,
674             X_JE_Deferred_Deprn_Category,
675             X_ITC_Allowed_Flag,
676             X_Created_By,
677             X_Creation_Date,
678             X_Last_Update_Login,
679             X_Allow_Mass_Copy,
680             X_Allow_Purge_Flag,
681             X_Allow_Reval_Flag,
682             X_Amortize_Reval_Reserve_Flag,
683             X_AP_Intercompany_Acct,
684             X_AR_Intercompany_Acct,
685             X_Attribute1,
686             X_Attribute2,
687             X_Attribute3,
688             X_Attribute4,
689             X_Attribute5,
690             X_Attribute6,
691             X_Attribute7,
692             X_Attribute8,
693             X_Attribute9,
694             X_Attribute10,
695             X_Attribute11,
696             X_Attribute12,
697             X_Attribute13,
698             X_Attribute14,
699             X_Attribute15,
700             X_Attribute_Category_Code,
701             X_Capital_Gain_Threshold,
702             X_Copy_Salvage_Value_Flag,
703             X_Cost_Of_Removal_ClearingAcct,
704             X_Cost_Of_Removal_Gain_Acct,
705             X_Cost_Of_Removal_Loss_Acct,
706             X_Default_Life_Ext_Ceiling,
707             X_Default_Life_Ext_Factor,
708             X_Default_Max_Fully_Rsvd_Reval,
709             X_Default_Rev_Fully_Rsvd_Flag,
710             X_Deferred_Deprn_Expense_Acct,
711             X_Deferred_Deprn_Reserve_Acct,
712             X_Deprn_Allocation_Code,
713             --X_Deprn_Status,
714             --X_Fiscal_Year_Name,
715             --X_Initial_Period_Counter,
716             X_JE_CIP_Adjustment_Category,
717             X_JE_CIP_Addition_Category,
718             X_JE_CIP_Reclass_Category,
719             X_JE_CIP_Retirement_Category,
720             X_JE_CIP_Reval_Category,
721             X_JE_CIP_Transfer_Category,
722             X_JE_Reval_Category,
723             --X_Last_Mass_Copy_Period_Ctr,
724             --X_Last_Period_Counter,
725             --X_Last_Purge_Period_Counter,
726             --X_Mass_Copy_Source_Book,
727             --X_Mass_Request_ID,
728             X_NBV_Amount_Threshold,
729             X_NBV_Fraction_Threshold,
730             X_NBV_Retired_Gain_Acct,
734             X_Proceeds_Of_Sale_Loss_Acct,
731             X_NBV_Retired_Loss_Acct,
732             X_Proceeds_Of_Sale_Clear_Acct,
733             X_Proceeds_Of_Sale_Gain_Acct,
735             X_Revalue_On_Retirement_Flag,
736             X_Reval_Deprn_Reserve_Flag,
737             X_Reval_Rsv_Retired_Gain_Acct,
738             X_Reval_Rsv_Retired_Loss_Acct,
739             X_Deprn_Adjustment_Acct,
740             X_Immediate_Copy_Flag,
741             X_JE_Deprn_Adjustment_Category,
742             X_Depr_First_Year_Ret_Flag,
743             X_Flexbuilder_Defaults_CCID,
744             X_Retire_Reval_Reserve_Flag,
745             --X_Use_Current_NBV_For_Deprn,
746             X_Copy_Additions_Flag,
747             X_Percent_Salvage_Value_Flag,
748             X_Reval_Posting_Flag,
749             X_Global_Attribute1,
750             X_Global_Attribute2,
751             X_Global_Attribute3,
752             X_Global_Attribute4,
753             X_Global_Attribute5,
754             X_Global_Attribute6,
755             X_Global_Attribute7,
756             X_Global_Attribute8,
757             X_Global_Attribute9,
758             X_Global_Attribute10,
759             X_Global_Attribute11,
760             X_Global_Attribute12,
761             X_Global_Attribute13,
762             X_Global_Attribute14,
763             X_Global_Attribute15,
764             X_Global_Attribute16,
765             X_Global_Attribute17,
766             X_Global_Attribute18,
767             X_Global_Attribute19,
768             X_Global_Attribute20,
769             X_Global_Attribute_Category,
770             X_MC_Source_Flag,
771             X_Reval_YTD_Deprn_Flag,
772             X_Allow_CIP_Assets_Flag,
773             X_Org_ID,
774             X_Allow_Group_Deprn_Flag,
775             X_Allow_CIP_Dep_Group_Flag,
776             X_Allow_Interco_Group_Flag,
777             X_Copy_Group_Assignment_Flag,
778             X_Copy_Group_Additon_Flag,
779             X_Allow_CIP_Member_Flag,
780             X_Allow_Member_Tracking_Flag,
781             X_Intercompany_Posting_Flag,
782             X_Backdated_Transfers_Flag,
783             X_allow_cost_sign_change_flag,
784             X_Sorp_Enabled_Flag,  -- Bug 6666666 : Added for SORP Compliance Project
785             X_copy_amort_adaj_exp_flag,
786             X_copy_group_change_flag,
787             X_prevent_prior_prd_txns_flag,
788             X_allow_unallocated_lines_flag,
789             X_DEFAULT_PERIOD_END_REVAL_FLG,
790             X_IMPORT_ALLOC_INV_LINES_NEW
791      );
792 
793   end if;
794 
795   X_Return_Status := TRUE;
796 
797   EXCEPTION
798      WHEN OTHERS THEN
799         fa_srvr_msg.add_sql_error(
800              calling_fn => 'fa_book_controls_pkg.insert_row', p_log_level_rec => p_log_level_rec);
801          X_Return_Status := FALSE;
802          raise;
803   END Insert_Row;
804 
805   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2
806   , p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) AS
807 
808   BEGIN
809 
810      null;
811   END Lock_Row;
812 
813   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
814                        X_Book_Type_Code                 VARCHAR2,
815                        X_Book_Type_Name                 VARCHAR2,
816                        X_Set_Of_Books_Id                NUMBER,
817                        X_Initial_Date                   DATE,
818                        X_Last_Deprn_Run_Date            DATE,
819                        X_Amortize_Flag                  VARCHAR2,
820                        X_Fully_Reserved_Flag            VARCHAR2,
821                        X_Deprn_Calendar                 VARCHAR2,
822                        X_Book_Class                     VARCHAR2,
823                        X_GL_Posting_Allowed_Flag        VARCHAR2,
824                        X_Current_Fiscal_Year            NUMBER,
825                        X_Allow_Mass_Changes             VARCHAR2,
826                        X_Allow_Deprn_Adjustments        VARCHAR2,
827                        X_Accounting_Flex_Structure      NUMBER,
828                        X_Last_Update_Date               DATE,
829                        X_Last_Updated_By                NUMBER,
830                        X_Prorate_Calendar               VARCHAR2,
831                        X_Date_Ineffective               DATE,
832                        X_JE_Retirement_Category         VARCHAR2,
833                        X_JE_Depreciation_Category       VARCHAR2,
834                        X_JE_Reclass_Category            VARCHAR2,
835                        X_GL_JE_Source                   VARCHAR2,
836                        X_JE_Addition_Category           VARCHAR2,
837                        X_JE_Adjustment_Category         VARCHAR2,
838                        X_Distribution_Source_Book       VARCHAR2,
839                        X_JE_Transfer_Category           VARCHAR2,
840                        X_Copy_Retirements_Flag          VARCHAR2,
841                        X_Copy_Adjustments_Flag          VARCHAR2,
842                        X_Deprn_Request_ID               NUMBER,
843                        X_Allow_Cost_Ceiling             VARCHAR2,
844                        X_Allow_Deprn_Exp_Ceiling        VARCHAR2,
845                        X_Calculate_NBV                  VARCHAR2,
849                        X_Created_By                     NUMBER,
846                        X_Run_Year_End_Program           VARCHAR2,
847                        X_JE_Deferred_Deprn_Category     VARCHAR2,
848                        X_ITC_Allowed_Flag               VARCHAR2,
850                        X_Creation_Date                  DATE,
851                        X_Last_Update_Login              NUMBER,
852                        X_Allow_Mass_Copy                VARCHAR2,
853                        X_Allow_Purge_Flag               VARCHAR2,
854                        X_Allow_Reval_Flag               VARCHAR2,
855                        X_Amortize_Reval_Reserve_Flag    VARCHAR2,
856                        X_AP_Intercompany_Acct           VARCHAR2,
857                        X_AR_Intercompany_Acct           VARCHAR2,
858                        X_Attribute1                     VARCHAR2,
859                        X_Attribute2                     VARCHAR2,
860                        X_Attribute3                     VARCHAR2,
861                        X_Attribute4                     VARCHAR2,
862                        X_Attribute5                     VARCHAR2,
863                        X_Attribute6                     VARCHAR2,
864                        X_Attribute7                     VARCHAR2,
865                        X_Attribute8                     VARCHAR2,
866                        X_Attribute9                     VARCHAR2,
867                        X_Attribute10                    VARCHAR2,
868                        X_Attribute11                    VARCHAR2,
869                        X_Attribute12                    VARCHAR2,
870                        X_Attribute13                    VARCHAR2,
871                        X_Attribute14                    VARCHAR2,
872                        X_Attribute15                    VARCHAR2,
873                        X_Attribute_Category_Code        VARCHAR2,
874                        X_Capital_Gain_Threshold         NUMBER,
875                        X_Copy_Salvage_Value_Flag        VARCHAR2,
876                        X_Cost_Of_Removal_ClearingAcct   VARCHAR2,
877                        X_Cost_Of_Removal_Gain_Acct      VARCHAR2,
878                        X_Cost_Of_Removal_Loss_Acct      VARCHAR2,
879                        X_Default_Life_Ext_Ceiling       NUMBER,
880                        X_Default_Life_Ext_Factor        NUMBER,
881                        X_Default_Max_Fully_Rsvd_Reval   NUMBER,
882                        X_Default_Rev_Fully_Rsvd_Flag    VARCHAR2,
883                        X_Deferred_Deprn_Expense_Acct    VARCHAR2,
884                        X_Deferred_Deprn_Reserve_Acct    VARCHAR2,
885                        X_Deprn_Allocation_Code          VARCHAR2,
886                        X_Deprn_Status                   VARCHAR2,
887                        X_Fiscal_Year_Name               VARCHAR2,
888                        X_Initial_Period_Counter         VARCHAR2,
889                        X_JE_CIP_Adjustment_Category     VARCHAR2,
890                        X_JE_CIP_Addition_Category       VARCHAR2,
891                        X_JE_CIP_Reclass_Category        VARCHAR2,
892                        X_JE_CIP_Retirement_Category     VARCHAR2,
893                        X_JE_CIP_Reval_Category          VARCHAR2,
894                        X_JE_CIP_Transfer_Category       VARCHAR2,
895                        X_JE_Reval_Category              VARCHAR2,
896                        X_Last_Mass_Copy_Period_Ctr      NUMBER,
897                        X_Last_Period_Counter            NUMBER,
898                        X_Last_Purge_Period_Counter      NUMBER,
899                        X_Mass_Copy_Source_Book          VARCHAR2,
900                        X_Mass_Request_ID                NUMBER,
901                        X_NBV_Amount_Threshold           NUMBER,
902                        X_NBV_Fraction_Threshold         NUMBER,
903                        X_NBV_Retired_Gain_Acct          VARCHAR2,
904                        X_NBV_Retired_Loss_Acct          VARCHAR2,
905                        X_Proceeds_Of_Sale_Clear_Acct    VARCHAR2,
906                        X_Proceeds_Of_Sale_Gain_Acct     VARCHAR2,
907                        X_Proceeds_Of_Sale_Loss_Acct     VARCHAR2,
908                        X_Revalue_On_Retirement_Flag     VARCHAR2,
909                        X_Reval_Deprn_Reserve_Flag       VARCHAR2,
910                        X_Reval_Rsv_Retired_Gain_Acct    VARCHAR2,
911                        X_Reval_Rsv_Retired_Loss_Acct    VARCHAR2,
912                        X_Deprn_Adjustment_Acct          VARCHAR2,
913                        X_Immediate_Copy_Flag            VARCHAR2,
914                        X_JE_Deprn_Adjustment_Category   VARCHAR2,
915                        X_Depr_First_Year_Ret_Flag       VARCHAR2,
916                        X_Flexbuilder_Defaults_CCID      NUMBER,
917                        X_Retire_Reval_Reserve_Flag      VARCHAR2,
918                        X_Use_Current_NBV_For_Deprn      VARCHAR2,
919                        X_Copy_Additions_Flag            VARCHAR2,
920                        X_Percent_Salvage_Value_Flag     VARCHAR2,
921                        X_Reval_Posting_Flag             VARCHAR2,
922                        X_Global_Attribute1              VARCHAR2,
923                        X_Global_Attribute2              VARCHAR2,
924                        X_Global_Attribute3              VARCHAR2,
925                        X_Global_Attribute4              VARCHAR2,
926                        X_Global_Attribute5              VARCHAR2,
927                        X_Global_Attribute6              VARCHAR2,
928                        X_Global_Attribute7              VARCHAR2,
929                        X_Global_Attribute8              VARCHAR2,
930                        X_Global_Attribute9              VARCHAR2,
931                        X_Global_Attribute10             VARCHAR2,
932                        X_Global_Attribute11             VARCHAR2,
933                        X_Global_Attribute12             VARCHAR2,
934                        X_Global_Attribute13             VARCHAR2,
935                        X_Global_Attribute14             VARCHAR2,
939                        X_Global_Attribute18             VARCHAR2,
936                        X_Global_Attribute15             VARCHAR2,
937                        X_Global_Attribute16             VARCHAR2,
938                        X_Global_Attribute17             VARCHAR2,
940                        X_Global_Attribute19             VARCHAR2,
941                        X_Global_Attribute20             VARCHAR2,
942                        X_Global_Attribute_Category      VARCHAR2,
943                        X_MC_Source_Flag                 VARCHAR2,
944                        X_Reval_YTD_Deprn_Flag           VARCHAR2,
945                        X_Allow_CIP_Assets_Flag          VARCHAR2,
946                        X_Org_ID                         NUMBER,
947                        X_Allow_Group_Deprn_Flag         VARCHAR2,
948                        X_Allow_CIP_Dep_Group_Flag       VARCHAR2,
949                        X_Allow_Interco_Group_Flag       VARCHAR2,
950                        X_Copy_Group_Assignment_Flag     VARCHAR2,
951                        X_Copy_Group_Additon_Flag        VARCHAR2,
952                        X_Allow_CIP_Member_Flag          VARCHAR2,
953                        X_Allow_Member_Tracking_Flag     VARCHAR2,
954                        X_Intercompany_Posting_Flag      VARCHAR2,
955                        X_Backdated_Transfers_Flag       VARCHAR2,
956                        X_allow_cost_sign_change_flag    VARCHAR2,
957                        X_Sorp_Enabled_Flag              VARCHAR2, -- Bug 6666666 : Added for SORP Compliance Project
958                        X_copy_amort_adaj_exp_flag       VARCHAR2,
959                        X_copy_group_change_flag         VARCHAR2,
960                        X_prevent_prior_prd_txns_flag    VARCHAR2,
961                        X_allow_unallocated_lines_flag   VARCHAR2,
962                        X_MRC_SOB_Type_Code              VARCHAR2 DEFAULT 'P',
963                        X_DEFAULT_PERIOD_END_REVAL_FLG   VARCHAR2 DEFAULT NULL,
964                        X_IMPORT_ALLOC_INV_LINES_NEW     VARCHAR2,
965                        X_Return_Status       OUT NOCOPY BOOLEAN,
966                        X_Calling_Fn                     VARCHAR2
967   , p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) AS
968 
969      l_sysdate    date;
970 
971   BEGIN
972 
973      if (nvl(X_mrc_sob_type_code, 'P') = 'P') then
974 
975         UPDATE fa_book_controls
976         SET
977         book_type_name                 = X_Book_Type_Name,
978         set_of_books_id                = X_Set_Of_Books_Id,
979         initial_date                   = X_Initial_Date,
980         last_deprn_run_date            = X_Last_Deprn_Run_Date,
981         amortize_flag                  = X_Amortize_Flag,
982         fully_reserved_flag            = X_Fully_Reserved_Flag,
983         deprn_calendar                 = X_Deprn_Calendar,
984         book_class                     = X_Book_Class,
985         gl_posting_allowed_flag        = X_GL_Posting_Allowed_Flag,
986         current_fiscal_year            = X_Current_Fiscal_Year,
987         allow_mass_changes             = X_Allow_Mass_Changes,
988         allow_deprn_adjustments        = X_Allow_Deprn_Adjustments,
989         accounting_flex_structure      = X_Accounting_Flex_Structure,
990         last_update_date               = X_Last_Update_Date,
991         last_updated_by                = X_Last_Updated_By,
992         prorate_calendar               = X_Prorate_Calendar,
993         date_ineffective               = X_Date_Ineffective,
994         je_retirement_category         = X_JE_Retirement_Category,
995         je_depreciation_category       = X_JE_Depreciation_Category,
996         je_reclass_category            = X_JE_Reclass_Category,
997         gl_je_source                   = X_GL_JE_Source,
998         je_addition_category           = X_JE_Addition_Category,
999         je_adjustment_category         = X_JE_Adjustment_Category,
1000         distribution_source_book       = X_Distribution_Source_Book,
1001         je_transfer_category           = X_JE_Transfer_Category,
1002         copy_retirements_flag          = X_Copy_Retirements_Flag,
1003         copy_adjustments_flag          = X_Copy_Adjustments_Flag,
1004         deprn_request_id               = X_Deprn_Request_ID,
1005         allow_cost_ceiling             = X_Allow_Cost_Ceiling,
1006         allow_deprn_exp_ceiling        = X_Allow_Deprn_Exp_Ceiling,
1007         calculate_nbv                  = X_Calculate_NBV,
1008         run_year_end_program           = X_Run_Year_End_Program,
1009         je_deferred_deprn_category     = X_JE_Deferred_Deprn_Category,
1010         itc_allowed_flag               = X_ITC_Allowed_Flag,
1011         created_by                     = X_Created_By,
1012         creation_date                  = X_Creation_Date,
1013         last_update_login              = X_Last_Update_Login,
1014         allow_mass_copy                = X_Allow_Mass_Copy,
1015         allow_purge_flag               = X_Allow_Purge_Flag,
1016         allow_reval_flag               = X_Allow_Reval_Flag,
1017         amortize_reval_reserve_flag    = X_Amortize_Reval_Reserve_Flag,
1018         ap_intercompany_acct           = X_AP_Intercompany_Acct,
1019         ar_intercompany_acct           = X_AR_Intercompany_Acct,
1020         attribute1                     = X_Attribute1,
1021         attribute2                     = X_Attribute2,
1022         attribute3                     = X_Attribute3,
1023         attribute4                     = X_Attribute4,
1024         attribute5                     = X_Attribute5,
1025         attribute6                     = X_Attribute6,
1026         attribute7                     = X_Attribute7,
1027         attribute8                     = X_Attribute8,
1028         attribute9                     = X_Attribute9,
1029         attribute10                    = X_Attribute10,
1030         attribute11                    = X_Attribute11,
1031         attribute12                    = X_Attribute12,
1032         attribute13                    = X_Attribute13,
1033         attribute14                    = X_Attribute14,
1037         copy_salvage_value_flag        = X_Copy_Salvage_Value_Flag,
1034         attribute15                    = X_Attribute15,
1035         attribute_category_code        = X_Attribute_Category_Code,
1036         capital_gain_threshold         = X_Capital_Gain_Threshold,
1038         cost_of_removal_clearing_acct  = X_Cost_Of_Removal_ClearingAcct,
1039         cost_of_removal_gain_acct      = X_Cost_Of_Removal_Gain_Acct,
1040         cost_of_removal_loss_acct      = X_Cost_Of_Removal_Loss_Acct,
1041         default_life_extension_ceiling = X_Default_Life_Ext_Ceiling,
1042         default_life_extension_factor  = X_Default_Life_Ext_Factor,
1043         default_max_fully_rsvd_revals  = X_Default_Max_Fully_Rsvd_Reval,
1044         default_reval_fully_rsvd_flag  = X_Default_Rev_Fully_Rsvd_Flag,
1045         deferred_deprn_expense_acct    = X_Deferred_Deprn_Expense_Acct,
1046         deferred_deprn_reserve_acct    = X_Deferred_Deprn_Reserve_Acct,
1047         deprn_allocation_code          = X_Deprn_Allocation_Code,
1048         deprn_status                   = X_Deprn_Status,
1049         fiscal_year_name               = X_Fiscal_Year_Name,
1050         initial_period_counter         = X_Initial_Period_Counter,
1051         je_cip_adjustment_category     = X_JE_CIP_Adjustment_Category,
1052         je_cip_addition_category       = X_JE_CIP_Addition_Category,
1053         je_cip_reclass_category        = X_JE_CIP_Reclass_Category,
1054         je_cip_retirement_category     = X_JE_CIP_Retirement_Category,
1055         je_cip_reval_category          = X_JE_CIP_Reval_Category,
1056         je_cip_transfer_category       = X_JE_CIP_Transfer_Category,
1057         je_reval_category              = X_JE_Reval_Category,
1058         last_mass_copy_period_counter  = X_Last_Mass_Copy_Period_Ctr,
1059         last_period_counter            = X_Last_Period_Counter,
1060         last_purge_period_counter      = X_Last_Purge_Period_Counter,
1061         mass_copy_source_book          = X_Mass_Copy_Source_Book,
1062         mass_request_id                = X_Mass_Request_ID,
1063         nbv_amount_threshold           = X_NBV_Amount_Threshold,
1064         nbv_fraction_threshold         = X_NBV_Fraction_Threshold,
1065         nbv_retired_gain_acct          = X_NBV_Retired_Gain_Acct,
1066         nbv_retired_loss_acct          = X_NBV_Retired_Loss_Acct,
1067         proceeds_of_sale_clearing_acct = X_Proceeds_Of_Sale_Clear_Acct,
1068         proceeds_of_sale_gain_acct     = X_Proceeds_Of_Sale_Gain_Acct,
1069         proceeds_of_sale_loss_acct     = X_Proceeds_Of_Sale_Loss_Acct,
1070         revalue_on_retirement_flag     = X_Revalue_On_Retirement_Flag,
1071         reval_deprn_reserve_flag       = X_Reval_Deprn_Reserve_Flag,
1072         reval_rsv_retired_gain_acct    = X_Reval_Rsv_Retired_Gain_Acct,
1073         reval_rsv_retired_loss_acct    = X_Reval_Rsv_Retired_Loss_Acct,
1074         deprn_adjustment_acct          = X_Deprn_Adjustment_Acct,
1075         immediate_copy_flag            = X_Immediate_Copy_Flag,
1076         je_deprn_adjustment_category   = X_JE_Deprn_Adjustment_Category,
1077         depr_first_year_ret_flag       = X_Depr_First_Year_Ret_Flag,
1078         flexbuilder_defaults_ccid      = X_Flexbuilder_Defaults_CCID,
1079         retire_reval_reserve_flag      = X_Retire_Reval_Reserve_Flag,
1080         use_current_nbv_for_deprn      = X_Use_Current_NBV_For_Deprn,
1084         global_attribute1              = X_Global_Attribute1,
1081         copy_additions_flag            = X_Copy_Additions_Flag,
1082         use_percent_salvage_value_flag = X_Percent_Salvage_Value_Flag,
1083         reval_posting_flag             = X_Reval_Posting_Flag,
1085         global_attribute2              = X_Global_Attribute2,
1086         global_attribute3              = X_Global_Attribute3,
1087         global_attribute4              = X_Global_Attribute4,
1088         global_attribute5              = X_Global_Attribute5,
1089         global_attribute6              = X_Global_Attribute6,
1090         global_attribute7              = X_Global_Attribute7,
1091         global_attribute8              = X_Global_Attribute8,
1092         global_attribute9              = X_Global_Attribute9,
1093         global_attribute10             = X_Global_Attribute10,
1094         global_attribute11             = X_Global_Attribute11,
1095         global_attribute12             = X_Global_Attribute12,
1096         global_attribute13             = X_Global_Attribute13,
1097         global_attribute14             = X_Global_Attribute14,
1098         global_attribute15             = X_Global_Attribute15,
1099         global_attribute16             = X_Global_Attribute16,
1100         global_attribute17             = X_Global_Attribute17,
1101         global_attribute18             = X_Global_Attribute18,
1102         global_attribute19             = X_Global_Attribute19,
1103         global_attribute20             = X_Global_Attribute20,
1104         global_attribute_category      = X_Global_Attribute_Category,
1105         mc_source_flag                 = X_MC_Source_Flag,
1106         reval_ytd_deprn_flag           = X_Reval_YTD_Deprn_Flag,
1107         allow_cip_assets_flag          = X_Allow_CIP_Assets_Flag,
1111         allow_interco_group_flag       = X_Allow_Interco_Group_Flag,
1108         org_id                         = X_Org_ID,
1109         allow_group_deprn_flag         = X_Allow_Group_Deprn_Flag,
1110         allow_cip_dep_group_flag       = X_Allow_CIP_Dep_Group_Flag,
1112         copy_group_assignment_flag     = X_Copy_Group_Assignment_Flag,
1113         copy_group_addition_flag       = X_Copy_Group_Additon_Flag,
1114         allow_cip_member_flag          = X_Allow_CIP_Member_Flag,
1115         allow_member_tracking_flag     = X_Allow_Member_Tracking_Flag,
1116         intercompany_posting_flag      = X_Intercompany_Posting_Flag,
1117         allow_backdated_transfers_flag = X_Backdated_Transfers_Flag,
1118         allow_cost_sign_change_flag    = X_allow_cost_sign_change_flag,
1119         sorp_enabled_flag              = X_Sorp_Enabled_Flag, -- Bug 6666666 : Added for SORP Compliance Project
1120         copy_amort_adaj_exp_flag       = X_copy_amort_adaj_exp_flag,
1121         copy_group_change_flag         = X_copy_group_change_flag,
1122         prevent_prior_period_txns_flag = X_prevent_prior_prd_txns_flag,
1123         allow_unallocated_lines_flag   = X_allow_unallocated_lines_flag,
1124         DEFAULT_PERIOD_END_REVAL_FLAG  = X_DEFAULT_PERIOD_END_REVAL_FLG,
1125         IMPORT_ALLOC_INV_LINES_AS_NEW  = X_IMPORT_ALLOC_INV_LINES_NEW
1126         WHERE book_type_code = X_Book_Type_Code;
1127 
1128         if (SQL%NOTFOUND) then
1129            Raise NO_DATA_FOUND;
1130         end if;
1131 
1132         select sysdate into l_sysdate from dual;
1133 
1134         UPDATE fa_book_controls_history
1135         SET    date_inactive = l_sysdate
1136         WHERE  book_type_code = X_Book_Type_Code
1137         AND    date_inactive is null;
1138 
1139         insert into fa_book_controls_history (
1140             book_type_code,
1141             date_active,
1142             date_inactive,
1143             book_type_name,
1144             set_of_books_id,
1145             --initial_date,
1146             --last_deprn_run_date,
1147             amortize_flag,
1148             --fully_reserved_flag,
1149             --deprn_calendar,
1150             --book_class,
1151             gl_posting_allowed_flag,
1152             --current_fiscal_year,
1153             allow_mass_changes,
1154             allow_deprn_adjustments,
1155             --accounting_flex_structure,
1156             last_update_date,
1157             last_updated_by,
1158             --prorate_calendar,
1159             date_ineffective,
1160             je_retirement_category,
1161             je_depreciation_category,
1162             je_reclass_category,
1163             gl_je_source,
1164             je_addition_category,
1165             je_adjustment_category,
1166             --distribution_source_book,
1167             je_transfer_category,
1168             copy_retirements_flag,
1169             copy_adjustments_flag,
1170             --deprn_request_id,
1171             allow_cost_ceiling,
1172             allow_deprn_exp_ceiling,
1173             --calculate_nbv,
1174             --run_year_end_program,
1175             je_deferred_deprn_category,
1176             itc_allowed_flag,
1177             created_by,
1178             creation_date,
1179             last_update_login,
1180             allow_mass_copy,
1181             allow_purge_flag,
1182             allow_reval_flag,
1183             amortize_reval_reserve_flag,
1184             ap_intercompany_acct,
1185             ar_intercompany_acct,
1186             attribute1,
1187             attribute2,
1188             attribute3,
1189             attribute4,
1190             attribute5,
1191             attribute6,
1192             attribute7,
1193             attribute8,
1194             attribute9,
1195             attribute10,
1196             attribute11,
1197             attribute12,
1198             attribute13,
1199             attribute14,
1200             attribute15,
1201             attribute_category_code,
1202             capital_gain_threshold,
1203             copy_salvage_value_flag,
1204             cost_of_removal_clearing_acct,
1205             cost_of_removal_gain_acct,
1206             cost_of_removal_loss_acct,
1207             default_life_extension_ceiling,
1208             default_life_extension_factor,
1209             default_max_fully_rsvd_revals,
1210             default_reval_fully_rsvd_flag,
1211             deferred_deprn_expense_acct,
1212             deferred_deprn_reserve_acct,
1213             deprn_allocation_code,
1214             --deprn_status,
1215             --fiscal_year_name,
1216             --initial_period_counter,
1217             je_cip_adjustment_category,
1218             je_cip_addition_category,
1219             je_cip_reclass_category,
1220             je_cip_retirement_category,
1221             je_cip_reval_category,
1222             je_cip_transfer_category,
1223             je_reval_category,
1224             --last_mass_copy_period_counter,
1225             --last_period_counter,
1226             --last_purge_period_counter,
1230             nbv_fraction_threshold,
1227             --mass_copy_source_book,
1228             --mass_request_id,
1229             nbv_amount_threshold,
1231             nbv_retired_gain_acct,
1232             nbv_retired_loss_acct,
1233             proceeds_of_sale_clearing_acct,
1234             proceeds_of_sale_gain_acct,
1235             proceeds_of_sale_loss_acct,
1236             revalue_on_retirement_flag,
1237             reval_deprn_reserve_flag,
1238             reval_rsv_retired_gain_acct,
1239             reval_rsv_retired_loss_acct,
1240             deprn_adjustment_acct,
1241             immediate_copy_flag,
1242             je_deprn_adjustment_category,
1243             depr_first_year_ret_flag,
1244             flexbuilder_defaults_ccid,
1245             retire_reval_reserve_flag,
1246             --use_current_nbv_for_deprn,
1247             copy_additions_flag,
1248             use_percent_salvage_value_flag,
1249             reval_posting_flag,
1250             global_attribute1,
1251             global_attribute2,
1252             global_attribute3,
1253             global_attribute4,
1254             global_attribute5,
1255             global_attribute6,
1256             global_attribute7,
1257             global_attribute8,
1258             global_attribute9,
1259             global_attribute10,
1260             global_attribute11,
1261             global_attribute12,
1262             global_attribute13,
1263             global_attribute14,
1264             global_attribute15,
1265             global_attribute16,
1266             global_attribute17,
1267             global_attribute18,
1268             global_attribute19,
1269             global_attribute20,
1270             global_attribute_category,
1271             mc_source_flag,
1272             reval_ytd_deprn_flag,
1273             allow_cip_assets_flag,
1274             org_id,
1275             allow_group_deprn_flag,
1276             allow_cip_dep_group_flag,
1277             allow_interco_group_flag,
1278             copy_group_assignment_flag,
1279             copy_group_addition_flag,
1280             allow_cip_member_flag,
1281             allow_member_tracking_flag,
1282             intercompany_posting_flag,
1283             allow_backdated_transfers_flag,
1284             allow_cost_sign_change_flag,
1285             sorp_enabled_flag,  -- Bug 6666666 : Added for SORP Compliance Project
1286             copy_amort_adaj_exp_flag,
1287             copy_group_change_flag,
1288             prevent_prior_period_txns_flag,
1289             allow_unallocated_lines_flag,
1290             DEFAULT_PERIOD_END_REVAL_FLAG,
1291             IMPORT_ALLOC_INV_LINES_AS_NEW
1292         ) values (
1293             X_Book_Type_Code,
1294             l_sysdate,              -- date_active
1295             null,                   -- date_inactive
1296             X_Book_Type_Name,
1297             X_Set_Of_Books_Id,
1298             --X_Initial_Date,
1299             --X_Last_Deprn_Run_Date,
1300             X_Amortize_Flag,
1301             --X_Fully_Reserved_Flag,
1302             --X_Deprn_Calendar,
1303             --X_Book_Class,
1304             X_GL_Posting_Allowed_Flag,
1305             --X_Current_Fiscal_Year,
1306             X_Allow_Mass_Changes,
1307             X_Allow_Deprn_Adjustments,
1308             --X_Accounting_Flex_Structure,
1309             X_Last_Update_Date,
1310             X_Last_Updated_By,
1311             --X_Prorate_Calendar,
1312             X_Date_Ineffective,
1313             X_JE_Retirement_Category,
1314             X_JE_Depreciation_Category,
1315             X_JE_Reclass_Category,
1316             X_GL_JE_Source,
1317             X_JE_Addition_Category,
1318             X_JE_Adjustment_Category,
1319             --X_Distribution_Source_Book,
1320             X_JE_Transfer_Category,
1321             X_Copy_Retirements_Flag,
1322             X_Copy_Adjustments_Flag,
1323             --X_Deprn_Request_ID,
1324             X_Allow_Cost_Ceiling,
1325             X_Allow_Deprn_Exp_Ceiling,
1326             --X_Calculate_NBV,
1327             --X_Run_Year_End_Program,
1328             X_JE_Deferred_Deprn_Category,
1329             X_ITC_Allowed_Flag,
1330             X_Created_By,
1331             X_Creation_Date,
1332             X_Last_Update_Login,
1333             X_Allow_Mass_Copy,
1334             X_Allow_Purge_Flag,
1335             X_Allow_Reval_Flag,
1336             X_Amortize_Reval_Reserve_Flag,
1337             X_AP_Intercompany_Acct,
1338             X_AR_Intercompany_Acct,
1339             X_Attribute1,
1340             X_Attribute2,
1341             X_Attribute3,
1342             X_Attribute4,
1343             X_Attribute5,
1344             X_Attribute6,
1345             X_Attribute7,
1346             X_Attribute8,
1347             X_Attribute9,
1348             X_Attribute10,
1349             X_Attribute11,
1350             X_Attribute12,
1351             X_Attribute13,
1352             X_Attribute14,
1353             X_Attribute15,
1354             X_Attribute_Category_Code,
1355             X_Capital_Gain_Threshold,
1356             X_Copy_Salvage_Value_Flag,
1357             X_Cost_Of_Removal_ClearingAcct,
1358             X_Cost_Of_Removal_Gain_Acct,
1359             X_Cost_Of_Removal_Loss_Acct,
1360             X_Default_Life_Ext_Ceiling,
1361             X_Default_Life_Ext_Factor,
1362             X_Default_Max_Fully_Rsvd_Reval,
1363             X_Default_Rev_Fully_Rsvd_Flag,
1364             X_Deferred_Deprn_Expense_Acct,
1365             X_Deferred_Deprn_Reserve_Acct,
1369             --X_Initial_Period_Counter,
1366             X_Deprn_Allocation_Code,
1367             --X_Deprn_Status,
1368             --X_Fiscal_Year_Name,
1370             X_JE_CIP_Adjustment_Category,
1371             X_JE_CIP_Addition_Category,
1372             X_JE_CIP_Reclass_Category,
1373             X_JE_CIP_Retirement_Category,
1374             X_JE_CIP_Reval_Category,
1375             X_JE_CIP_Transfer_Category,
1376             X_JE_Reval_Category,
1377             --X_Last_Mass_Copy_Period_Ctr,
1378             --X_Last_Period_Counter,
1379             --X_Last_Purge_Period_Counter,
1380             --X_Mass_Copy_Source_Book,
1381             --X_Mass_Request_ID,
1382             X_NBV_Amount_Threshold,
1383             X_NBV_Fraction_Threshold,
1384             X_NBV_Retired_Gain_Acct,
1385             X_NBV_Retired_Loss_Acct,
1386             X_Proceeds_Of_Sale_Clear_Acct,
1387             X_Proceeds_Of_Sale_Gain_Acct,
1388             X_Proceeds_Of_Sale_Loss_Acct,
1389             X_Revalue_On_Retirement_Flag,
1390             X_Reval_Deprn_Reserve_Flag,
1391             X_Reval_Rsv_Retired_Gain_Acct,
1392             X_Reval_Rsv_Retired_Loss_Acct,
1393             X_Deprn_Adjustment_Acct,
1397             X_Flexbuilder_Defaults_CCID,
1394             X_Immediate_Copy_Flag,
1395             X_JE_Deprn_Adjustment_Category,
1396             X_Depr_First_Year_Ret_Flag,
1398             X_Retire_Reval_Reserve_Flag,
1399             --X_Use_Current_NBV_For_Deprn,
1400             X_Copy_Additions_Flag,
1401             X_Percent_Salvage_Value_Flag,
1402             X_Reval_Posting_Flag,
1403             X_Global_Attribute1,
1404             X_Global_Attribute2,
1405             X_Global_Attribute3,
1406             X_Global_Attribute4,
1407             X_Global_Attribute5,
1408             X_Global_Attribute6,
1409             X_Global_Attribute7,
1410             X_Global_Attribute8,
1411             X_Global_Attribute9,
1412             X_Global_Attribute10,
1413             X_Global_Attribute11,
1414             X_Global_Attribute12,
1415             X_Global_Attribute13,
1416             X_Global_Attribute14,
1417             X_Global_Attribute15,
1418             X_Global_Attribute16,
1419             X_Global_Attribute17,
1420             X_Global_Attribute18,
1421             X_Global_Attribute19,
1422             X_Global_Attribute20,
1423             X_Global_Attribute_Category,
1424             X_MC_Source_Flag,
1425             X_Reval_YTD_Deprn_Flag,
1426             X_Allow_CIP_Assets_Flag,
1427             X_Org_ID,
1428             X_Allow_Group_Deprn_Flag,
1429             X_Allow_CIP_Dep_Group_Flag,
1430             X_Allow_Interco_Group_Flag,
1431             X_Copy_Group_Assignment_Flag,
1432             X_Copy_Group_Additon_Flag,
1433             X_Allow_CIP_Member_Flag,
1434             X_Allow_Member_Tracking_Flag,
1435             X_Intercompany_Posting_Flag,
1436             X_Backdated_Transfers_Flag,
1437             X_allow_cost_sign_change_flag,
1438             X_Sorp_Enabled_Flag,  -- Bug 6666666 : Added for SORP Compliance Project
1439             X_copy_amort_adaj_exp_flag,
1440             X_copy_group_change_flag,
1441             X_prevent_prior_prd_txns_flag,
1442             X_allow_unallocated_lines_flag,
1443             X_DEFAULT_PERIOD_END_REVAL_FLG,
1444             X_IMPORT_ALLOC_INV_LINES_NEW
1445         );
1446      end if;
1447 
1448      X_Return_Status := TRUE;
1449 
1450   EXCEPTION
1451     when others then
1452         fa_srvr_msg.add_sql_error(
1453                 calling_fn => 'FA_BOOK_CONTROLS_PKG.Update_Row', p_log_level_rec => p_log_level_rec);
1454 
1455         X_Return_Status := FALSE;
1456 
1457         raise;
1458 
1459   END Update_Row;
1460 
1461   PROCEDURE Delete_Row(X_Rowid                          VARCHAR2 DEFAULT NULL,
1462                        X_Book_Type_Code                 VARCHAR2 DEFAULT NULL,
1463                        X_MRC_SOB_Type_Code              VARCHAR2 DEFAULT 'P',
1464                        X_Calling_Fn                     VARCHAR2
1465   , p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type) AS
1466 
1467      l_book_type_code   varchar2(30);
1468      l_exists           number;
1469 
1470      del_error          exception;
1471      validation_error   exception;
1472 
1473   BEGIN
1474 
1475     if (X_Book_Type_Code is null) then
1476        if (X_Rowid is not null) then
1477           if (X_mrc_sob_type_code = 'R') then
1478              select book_type_code
1479              into   l_book_type_code
1480              from   fa_mc_book_controls
1481              where  rowid = X_Rowid;
1482           else
1483              select book_type_code
1484              into   l_book_type_code
1485              from   fa_book_controls
1486              where  rowid = X_Rowid;
1487           end if;
1488        else
1489           raise del_error;
1490        end if;
1491     else
1492         l_book_type_code := X_Book_Type_Code;
1493     end if;
1494 
1495     if (X_mrc_sob_type_code = 'R') then
1496        begin
1497           select 1
1498           into   l_exists
1499           from   fa_mc_books
1500           where  book_type_code = l_book_type_code;
1501        exception
1502           when no_data_found then
1503              l_exists := 0;
1504        end;
1505 
1506     else
1507        begin
1508           select 1
1509           into   l_exists
1510           from   fa_mc_books
1511           where  book_type_code = l_book_type_code;
1512        exception
1513           when no_data_found then
1514              l_exists := 0;
1515        end;
1516     end if;
1517 
1518     if (l_exists <> 0) then
1519        raise validation_error;
1520     end if;
1521 
1522     if (X_mrc_sob_type_code = 'R') then
1523        DELETE FROM fa_mc_deprn_periods
1524        WHERE  book_type_code = l_book_type_code;
1525 
1526        DELETE FROM fa_mc_book_controls
1527        WHERE  book_type_code = l_book_type_code;
1528 
1529     else
1530        DELETE FROM fa_deprn_periods
1531        WHERE  book_type_code = l_book_type_code;
1532 
1533        DELETE FROM fa_book_controls
1534        WHERE  book_type_code = l_book_type_code;
1535 
1539     end if;
1536        DELETE FROM fa_book_controls_history
1537        WHERE  book_type_code = l_book_type_code;
1538 
1540 
1541   exception
1542     when validation_error then
1543       fa_srvr_msg.add_message (
1544           calling_fn => 'fa_book_controls_pkg.delete_row',
1545           name       => 'FA_SHARED_CANT_DEL_USED', p_log_level_rec => p_log_level_rec);
1546       FA_STANDARD_PKG.RAISE_ERROR(
1547           CALLED_FN => 'fa_book_controls_pkg.delete_row',
1548           CALLING_FN => X_Calling_Fn, p_log_level_rec => p_log_level_rec);
1549     when del_error then
1550       FA_STANDARD_PKG.RAISE_ERROR(
1551           CALLED_FN => 'fa_book_controls_pkg.delete_row',
1552           CALLING_FN => X_Calling_Fn, p_log_level_rec => p_log_level_rec);
1553     when others then
1554       FA_STANDARD_PKG.RAISE_ERROR(
1555           CALLED_FN => 'fa_book_controls_pkg.delete_row',
1556           CALLING_FN => X_Calling_Fn, p_log_level_rec => p_log_level_rec);
1557   END Delete_Row;
1558 
1559 END FA_BOOK_CONTROLS_PKG;