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.3 2005/10/20 16:00:24 hhafid noship $ */
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_MRC_SOB_Type_Code              VARCHAR2 DEFAULT 'P',
150                        X_Return_Status       OUT NOCOPY BOOLEAN,
151                        X_Calling_Fn                     VARCHAR2,
152                        p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) AS
153 
154     CURSOR C_bc IS SELECT rowid FROM fa_book_controls
155                  WHERE book_type_code = X_Book_Type_Code;
156 
157     CURSOR C_bc_mc IS SELECT rowid FROM fa_book_controls_mrc_v
158                  WHERE book_type_code = X_Book_Type_Code;
159 
160   BEGIN
161 
162   if (X_mrc_sob_type_code = 'R') then
163 
164      insert into fa_book_controls_mrc_v (
165             book_type_code,
166             book_type_name,
167             set_of_books_id,
168             initial_date,
169             last_deprn_run_date,
170             amortize_flag,
171             fully_reserved_flag,
172             deprn_calendar,
173             book_class,
174             gl_posting_allowed_flag,
175             current_fiscal_year,
176             allow_mass_changes,
177             allow_deprn_adjustments,
178             accounting_flex_structure,
179             last_update_date,
180             last_updated_by,
181             prorate_calendar,
182             date_ineffective,
183             je_retirement_category,
184             je_depreciation_category,
185             je_reclass_category,
186             gl_je_source,
187             je_addition_category,
188             je_adjustment_category,
189             distribution_source_book,
190             je_transfer_category,
191             copy_retirements_flag,
192             copy_adjustments_flag,
193             deprn_request_id,
194             allow_cost_ceiling,
195             allow_deprn_exp_ceiling,
196             calculate_nbv,
197             run_year_end_program,
198             je_deferred_deprn_category,
199             itc_allowed_flag,
200             created_by,
201             creation_date,
202             last_update_login,
203             allow_mass_copy,
204             allow_purge_flag,
205             allow_reval_flag,
206             amortize_reval_reserve_flag,
207             ap_intercompany_acct,
208             ar_intercompany_acct,
209             attribute1,
210             attribute2,
211             attribute3,
212             attribute4,
213             attribute5,
214             attribute6,
215             attribute7,
216             attribute8,
217             attribute9,
218             attribute10,
219             attribute11,
220             attribute12,
221             attribute13,
222             attribute14,
223             attribute15,
224             attribute_category_code,
225             capital_gain_threshold,
226             copy_salvage_value_flag,
227             cost_of_removal_clearing_acct,
228             cost_of_removal_gain_acct,
229             cost_of_removal_loss_acct,
230             default_life_extension_ceiling,
231             default_life_extension_factor,
232             default_max_fully_rsvd_revals,
233             default_reval_fully_rsvd_flag,
234             deferred_deprn_expense_acct,
235             deferred_deprn_reserve_acct,
236             deprn_allocation_code,
237             deprn_status,
238             fiscal_year_name,
239             initial_period_counter,
240             je_cip_adjustment_category,
241             je_cip_addition_category,
242             je_cip_reclass_category,
243             je_cip_retirement_category,
244             je_cip_reval_category,
245             je_cip_transfer_category,
246             je_reval_category,
247             last_mass_copy_period_counter,
248             last_period_counter,
249             last_purge_period_counter,
250             mass_copy_source_book,
251             mass_request_id,
252             nbv_amount_threshold,
253             nbv_fraction_threshold,
254             nbv_retired_gain_acct,
255             nbv_retired_loss_acct,
256             proceeds_of_sale_clearing_acct,
257             proceeds_of_sale_gain_acct,
258             proceeds_of_sale_loss_acct,
259             revalue_on_retirement_flag,
260             reval_deprn_reserve_flag,
261             reval_rsv_retired_gain_acct,
262             reval_rsv_retired_loss_acct,
263             deprn_adjustment_acct,
264             immediate_copy_flag,
265             je_deprn_adjustment_category,
266             depr_first_year_ret_flag,
267             flexbuilder_defaults_ccid,
268             retire_reval_reserve_flag,
269             use_current_nbv_for_deprn,
270             copy_additions_flag,
271             use_percent_salvage_value_flag,
272             reval_posting_flag,
273             global_attribute1,
274             global_attribute2,
275             global_attribute3,
276             global_attribute4,
277             global_attribute5,
278             global_attribute6,
279             global_attribute7,
280             global_attribute8,
281             global_attribute9,
282             global_attribute10,
283             global_attribute11,
284             global_attribute12,
285             global_attribute13,
286             global_attribute14,
287             global_attribute15,
288             global_attribute16,
289             global_attribute17,
290             global_attribute18,
291             global_attribute19,
292             global_attribute20,
293             global_attribute_category,
294             mc_source_flag,
295             reval_ytd_deprn_flag,
296             allow_cip_assets_flag,
297             org_id,
298             allow_group_deprn_flag,
299             allow_cip_dep_group_flag,
300             allow_interco_group_flag,
301             copy_group_assignment_flag,
302             copy_group_addition_flag,
303             intercompany_posting_flag,
304             allow_cost_sign_change_flag
305      ) values (
306             X_Book_Type_Code,
307             X_Book_Type_Name,
308             X_Set_Of_Books_Id,
309             X_Initial_Date,
310             X_Last_Deprn_Run_Date,
311             X_Amortize_Flag,
312             X_Fully_Reserved_Flag,
313             X_Deprn_Calendar,
314             X_Book_Class,
315             X_GL_Posting_Allowed_Flag,
316             X_Current_Fiscal_Year,
317             X_Allow_Mass_Changes,
318             X_Allow_Deprn_Adjustments,
322             X_Prorate_Calendar,
319             X_Accounting_Flex_Structure,
320             X_Last_Update_Date,
321             X_Last_Updated_By,
323             X_Date_Ineffective,
324             X_JE_Retirement_Category,
325             X_JE_Depreciation_Category,
326             X_JE_Reclass_Category,
327             X_GL_JE_Source,
328             X_JE_Addition_Category,
329             X_JE_Adjustment_Category,
330             X_Distribution_Source_Book,
331             X_JE_Transfer_Category,
332             X_Copy_Retirements_Flag,
333             X_Copy_Adjustments_Flag,
334             X_Deprn_Request_ID,
335             X_Allow_Cost_Ceiling,
336             X_Allow_Deprn_Exp_Ceiling,
337             X_Calculate_NBV,
338             X_Run_Year_End_Program,
339             X_JE_Deferred_Deprn_Category,
340             X_ITC_Allowed_Flag,
341             X_Created_By,
342             X_Creation_Date,
343             X_Last_Update_Login,
344             X_Allow_Mass_Copy,
345             X_Allow_Purge_Flag,
346             X_Allow_Reval_Flag,
347             X_Amortize_Reval_Reserve_Flag,
348             X_AP_Intercompany_Acct,
349             X_AR_Intercompany_Acct,
350             X_Attribute1,
351             X_Attribute2,
352             X_Attribute3,
353             X_Attribute4,
354             X_Attribute5,
355             X_Attribute6,
356             X_Attribute7,
357             X_Attribute8,
358             X_Attribute9,
359             X_Attribute10,
360             X_Attribute11,
361             X_Attribute12,
362             X_Attribute13,
363             X_Attribute14,
364             X_Attribute15,
365             X_Attribute_Category_Code,
366             X_Capital_Gain_Threshold,
367             X_Copy_Salvage_Value_Flag,
368             X_Cost_Of_Removal_ClearingAcct,
369             X_Cost_Of_Removal_Gain_Acct,
370             X_Cost_Of_Removal_Loss_Acct,
371             X_Default_Life_Ext_Ceiling,
372             X_Default_Life_Ext_Factor,
373             X_Default_Max_Fully_Rsvd_Reval,
374             X_Default_Rev_Fully_Rsvd_Flag,
375             X_Deferred_Deprn_Expense_Acct,
376             X_Deferred_Deprn_Reserve_Acct,
377             X_Deprn_Allocation_Code,
378             X_Deprn_Status,
379             X_Fiscal_Year_Name,
380             X_Initial_Period_Counter,
381             X_JE_CIP_Adjustment_Category,
382             X_JE_CIP_Addition_Category,
383             X_JE_CIP_Reclass_Category,
384             X_JE_CIP_Retirement_Category,
385             X_JE_CIP_Reval_Category,
386             X_JE_CIP_Transfer_Category,
387             X_JE_Reval_Category,
388             X_Last_Mass_Copy_Period_Ctr,
389             X_Last_Period_Counter,
390             X_Last_Purge_Period_Counter,
391             X_Mass_Copy_Source_Book,
392             X_Mass_Request_ID,
393             X_NBV_Amount_Threshold,
394             X_NBV_Fraction_Threshold,
395             X_NBV_Retired_Gain_Acct,
396             X_NBV_Retired_Loss_Acct,
397             X_Proceeds_Of_Sale_Clear_Acct,
398             X_Proceeds_Of_Sale_Gain_Acct,
399             X_Proceeds_Of_Sale_Loss_Acct,
400             X_Revalue_On_Retirement_Flag,
401             X_Reval_Deprn_Reserve_Flag,
402             X_Reval_Rsv_Retired_Gain_Acct,
403             X_Reval_Rsv_Retired_Loss_Acct,
404             X_Deprn_Adjustment_Acct,
405             X_Immediate_Copy_Flag,
406             X_JE_Deprn_Adjustment_Category,
407             X_Depr_First_Year_Ret_Flag,
408             X_Flexbuilder_Defaults_CCID,
409             X_Retire_Reval_Reserve_Flag,
410             X_Use_Current_NBV_For_Deprn,
411             X_Copy_Additions_Flag,
412             X_Percent_Salvage_Value_Flag,
413             X_Reval_Posting_Flag,
414             X_Global_Attribute1,
415             X_Global_Attribute2,
416             X_Global_Attribute3,
417             X_Global_Attribute4,
418             X_Global_Attribute5,
419             X_Global_Attribute6,
420             X_Global_Attribute7,
421             X_Global_Attribute8,
422             X_Global_Attribute9,
423             X_Global_Attribute10,
424             X_Global_Attribute11,
425             X_Global_Attribute12,
426             X_Global_Attribute13,
427             X_Global_Attribute14,
428             X_Global_Attribute15,
429             X_Global_Attribute16,
430             X_Global_Attribute17,
431             X_Global_Attribute18,
432             X_Global_Attribute19,
433             X_Global_Attribute20,
434             X_Global_Attribute_Category,
435             X_MC_Source_Flag,
436             X_Reval_YTD_Deprn_Flag,
437             X_Allow_CIP_Assets_Flag,
438             X_Org_ID,
439             X_Allow_Group_Deprn_Flag,
440             X_Allow_CIP_Dep_Group_Flag,
441             X_Allow_Interco_Group_Flag,
442             X_Copy_Group_Assignment_Flag,
443             X_Copy_Group_Additon_Flag,
444             X_Intercompany_Posting_Flag,
445             X_allow_cost_sign_change_flag
446      );
447 
448      OPEN C_bc_mc;
449      FETCH C_bc_mc INTO X_Rowid;
450      if (C_bc_mc%NOTFOUND) then
451         CLOSE C_bc_mc;
452         Raise NO_DATA_FOUND;
453      end if;
454      CLOSE C_bc_mc;
455 
456   else
457 
458      insert into fa_book_controls (
459             book_type_code,
460             book_type_name,
461             set_of_books_id,
462             initial_date,
463             last_deprn_run_date,
464             amortize_flag,
465             fully_reserved_flag,
466             deprn_calendar,
467             book_class,
468             gl_posting_allowed_flag,
472             accounting_flex_structure,
469             current_fiscal_year,
470             allow_mass_changes,
471             allow_deprn_adjustments,
473             last_update_date,
474             last_updated_by,
475             prorate_calendar,
476             date_ineffective,
477             je_retirement_category,
478             je_depreciation_category,
479             je_reclass_category,
480             gl_je_source,
481             je_addition_category,
482             je_adjustment_category,
483             distribution_source_book,
484             je_transfer_category,
485             copy_retirements_flag,
486             copy_adjustments_flag,
487             deprn_request_id,
488             allow_cost_ceiling,
489             allow_deprn_exp_ceiling,
490             calculate_nbv,
491             run_year_end_program,
492             je_deferred_deprn_category,
493             itc_allowed_flag,
494             created_by,
495             creation_date,
496             last_update_login,
497             allow_mass_copy,
498             allow_purge_flag,
499             allow_reval_flag,
500             amortize_reval_reserve_flag,
501             ap_intercompany_acct,
502             ar_intercompany_acct,
503             attribute1,
504             attribute2,
505             attribute3,
506             attribute4,
507             attribute5,
508             attribute6,
509             attribute7,
510             attribute8,
511             attribute9,
512             attribute10,
513             attribute11,
514             attribute12,
515             attribute13,
516             attribute14,
517             attribute15,
518             attribute_category_code,
519             capital_gain_threshold,
520             copy_salvage_value_flag,
521             cost_of_removal_clearing_acct,
522             cost_of_removal_gain_acct,
523             cost_of_removal_loss_acct,
524             default_life_extension_ceiling,
525             default_life_extension_factor,
526             default_max_fully_rsvd_revals,
527             default_reval_fully_rsvd_flag,
528             deferred_deprn_expense_acct,
529             deferred_deprn_reserve_acct,
530             deprn_allocation_code,
531             deprn_status,
532             fiscal_year_name,
533             initial_period_counter,
534             je_cip_adjustment_category,
535             je_cip_addition_category,
536             je_cip_reclass_category,
537             je_cip_retirement_category,
538             je_cip_reval_category,
539             je_cip_transfer_category,
540             je_reval_category,
541             last_mass_copy_period_counter,
542             last_period_counter,
543             last_purge_period_counter,
544             mass_copy_source_book,
545             mass_request_id,
546             nbv_amount_threshold,
547             nbv_fraction_threshold,
548             nbv_retired_gain_acct,
549             nbv_retired_loss_acct,
550             proceeds_of_sale_clearing_acct,
551             proceeds_of_sale_gain_acct,
552             proceeds_of_sale_loss_acct,
553             revalue_on_retirement_flag,
554             reval_deprn_reserve_flag,
555             reval_rsv_retired_gain_acct,
556             reval_rsv_retired_loss_acct,
557             deprn_adjustment_acct,
558             immediate_copy_flag,
559             je_deprn_adjustment_category,
560             depr_first_year_ret_flag,
561             flexbuilder_defaults_ccid,
562             retire_reval_reserve_flag,
563             use_current_nbv_for_deprn,
564             copy_additions_flag,
565             use_percent_salvage_value_flag,
566             reval_posting_flag,
567             global_attribute1,
568             global_attribute2,
569             global_attribute3,
570             global_attribute4,
571             global_attribute5,
572             global_attribute6,
573             global_attribute7,
574             global_attribute8,
575             global_attribute9,
576             global_attribute10,
577             global_attribute11,
578             global_attribute12,
579             global_attribute13,
580             global_attribute14,
581             global_attribute15,
582             global_attribute16,
583             global_attribute17,
584             global_attribute18,
585             global_attribute19,
586             global_attribute20,
587             global_attribute_category,
588             mc_source_flag,
589             reval_ytd_deprn_flag,
590             allow_cip_assets_flag,
591             org_id,
592             allow_group_deprn_flag,
593             allow_cip_dep_group_flag,
594             allow_interco_group_flag,
595             copy_group_assignment_flag,
596             copy_group_addition_flag,
597             allow_cip_member_flag,
598             allow_member_tracking_flag,
599             intercompany_posting_flag,
600             allow_backdated_transfers_flag,
601             allow_cost_sign_change_flag
602      ) values (
603             X_Book_Type_Code,
604             X_Book_Type_Name,
605             X_Set_Of_Books_Id,
606             X_Initial_Date,
607             X_Last_Deprn_Run_Date,
608             X_Amortize_Flag,
609             X_Fully_Reserved_Flag,
610             X_Deprn_Calendar,
611             X_Book_Class,
612             X_GL_Posting_Allowed_Flag,
613             X_Current_Fiscal_Year,
614             X_Allow_Mass_Changes,
615             X_Allow_Deprn_Adjustments,
616             X_Accounting_Flex_Structure,
617             X_Last_Update_Date,
621             X_JE_Retirement_Category,
618             X_Last_Updated_By,
619             X_Prorate_Calendar,
620             X_Date_Ineffective,
622             X_JE_Depreciation_Category,
623             X_JE_Reclass_Category,
624             X_GL_JE_Source,
625             X_JE_Addition_Category,
626             X_JE_Adjustment_Category,
627             X_Distribution_Source_Book,
628             X_JE_Transfer_Category,
629             X_Copy_Retirements_Flag,
630             X_Copy_Adjustments_Flag,
631             X_Deprn_Request_ID,
632             X_Allow_Cost_Ceiling,
633             X_Allow_Deprn_Exp_Ceiling,
634             X_Calculate_NBV,
635             X_Run_Year_End_Program,
636             X_JE_Deferred_Deprn_Category,
637             X_ITC_Allowed_Flag,
638             X_Created_By,
639             X_Creation_Date,
640             X_Last_Update_Login,
641             X_Allow_Mass_Copy,
642             X_Allow_Purge_Flag,
643             X_Allow_Reval_Flag,
644             X_Amortize_Reval_Reserve_Flag,
645             X_AP_Intercompany_Acct,
646             X_AR_Intercompany_Acct,
647             X_Attribute1,
648             X_Attribute2,
649             X_Attribute3,
650             X_Attribute4,
651             X_Attribute5,
652             X_Attribute6,
653             X_Attribute7,
654             X_Attribute8,
655             X_Attribute9,
656             X_Attribute10,
657             X_Attribute11,
658             X_Attribute12,
659             X_Attribute13,
660             X_Attribute14,
661             X_Attribute15,
662             X_Attribute_Category_Code,
663             X_Capital_Gain_Threshold,
664             X_Copy_Salvage_Value_Flag,
665             X_Cost_Of_Removal_ClearingAcct,
666             X_Cost_Of_Removal_Gain_Acct,
667             X_Cost_Of_Removal_Loss_Acct,
668             X_Default_Life_Ext_Ceiling,
669             X_Default_Life_Ext_Factor,
670             X_Default_Max_Fully_Rsvd_Reval,
671             X_Default_Rev_Fully_Rsvd_Flag,
672             X_Deferred_Deprn_Expense_Acct,
673             X_Deferred_Deprn_Reserve_Acct,
674             X_Deprn_Allocation_Code,
675             X_Deprn_Status,
676             X_Fiscal_Year_Name,
677             X_Initial_Period_Counter,
678             X_JE_CIP_Adjustment_Category,
679             X_JE_CIP_Addition_Category,
680             X_JE_CIP_Reclass_Category,
681             X_JE_CIP_Retirement_Category,
682             X_JE_CIP_Reval_Category,
683             X_JE_CIP_Transfer_Category,
684             X_JE_Reval_Category,
685             X_Last_Mass_Copy_Period_Ctr,
686             X_Last_Period_Counter,
687             X_Last_Purge_Period_Counter,
688             X_Mass_Copy_Source_Book,
689             X_Mass_Request_ID,
690             X_NBV_Amount_Threshold,
691             X_NBV_Fraction_Threshold,
692             X_NBV_Retired_Gain_Acct,
693             X_NBV_Retired_Loss_Acct,
694             X_Proceeds_Of_Sale_Clear_Acct,
695             X_Proceeds_Of_Sale_Gain_Acct,
696             X_Proceeds_Of_Sale_Loss_Acct,
697             X_Revalue_On_Retirement_Flag,
698             X_Reval_Deprn_Reserve_Flag,
699             X_Reval_Rsv_Retired_Gain_Acct,
700             X_Reval_Rsv_Retired_Loss_Acct,
701             X_Deprn_Adjustment_Acct,
702             X_Immediate_Copy_Flag,
703             X_JE_Deprn_Adjustment_Category,
704             X_Depr_First_Year_Ret_Flag,
705             X_Flexbuilder_Defaults_CCID,
706             X_Retire_Reval_Reserve_Flag,
707             X_Use_Current_NBV_For_Deprn,
708             X_Copy_Additions_Flag,
709             X_Percent_Salvage_Value_Flag,
710             X_Reval_Posting_Flag,
711             X_Global_Attribute1,
712             X_Global_Attribute2,
713             X_Global_Attribute3,
714             X_Global_Attribute4,
715             X_Global_Attribute5,
716             X_Global_Attribute6,
717             X_Global_Attribute7,
718             X_Global_Attribute8,
719             X_Global_Attribute9,
720             X_Global_Attribute10,
721             X_Global_Attribute11,
722             X_Global_Attribute12,
723             X_Global_Attribute13,
724             X_Global_Attribute14,
725             X_Global_Attribute15,
726             X_Global_Attribute16,
727             X_Global_Attribute17,
728             X_Global_Attribute18,
729             X_Global_Attribute19,
730             X_Global_Attribute20,
731             X_Global_Attribute_Category,
732             X_MC_Source_Flag,
733             X_Reval_YTD_Deprn_Flag,
734             X_Allow_CIP_Assets_Flag,
735             X_Org_ID,
736             X_Allow_Group_Deprn_Flag,
737             X_Allow_CIP_Dep_Group_Flag,
738             X_Allow_Interco_Group_Flag,
739             X_Copy_Group_Assignment_Flag,
740             X_Copy_Group_Additon_Flag,
741             X_Allow_CIP_Member_Flag,
742             X_Allow_Member_Tracking_Flag,
743             X_Intercompany_Posting_Flag,
744             X_Backdated_Transfers_Flag,
745             X_allow_cost_sign_change_flag
746      );
747 
748      OPEN C_bc;
749      FETCH C_bc INTO X_Rowid;
750      if (C_bc%NOTFOUND) then
751         CLOSE C_bc;
752         Raise NO_DATA_FOUND;
753      end if;
754      CLOSE C_bc;
755 
756      insert into fa_book_controls_history (
757             book_type_code,
758             date_active,
759             date_inactive,
760             book_type_name,
761             set_of_books_id,
762             --initial_date,
763             --last_deprn_run_date,
764             amortize_flag,
765             --fully_reserved_flag,
766             --deprn_calendar,
770             allow_mass_changes,
767             --book_class,
768             gl_posting_allowed_flag,
769             --current_fiscal_year,
771             allow_deprn_adjustments,
772             --accounting_flex_structure,
773             last_update_date,
774             last_updated_by,
775             --prorate_calendar,
776             date_ineffective,
777             je_retirement_category,
778             je_depreciation_category,
779             je_reclass_category,
780             gl_je_source,
781             je_addition_category,
782             je_adjustment_category,
783             --distribution_source_book,
784             je_transfer_category,
785             copy_retirements_flag,
786             copy_adjustments_flag,
787             --deprn_request_id,
788             allow_cost_ceiling,
789             allow_deprn_exp_ceiling,
790             --calculate_nbv,
791             --run_year_end_program,
792             je_deferred_deprn_category,
793             itc_allowed_flag,
794             created_by,
795             creation_date,
796             last_update_login,
797             allow_mass_copy,
798             allow_purge_flag,
799             allow_reval_flag,
800             amortize_reval_reserve_flag,
801             ap_intercompany_acct,
802             ar_intercompany_acct,
803             attribute1,
804             attribute2,
805             attribute3,
806             attribute4,
807             attribute5,
808             attribute6,
809             attribute7,
810             attribute8,
811             attribute9,
812             attribute10,
813             attribute11,
814             attribute12,
815             attribute13,
816             attribute14,
817             attribute15,
818             attribute_category_code,
819             capital_gain_threshold,
820             copy_salvage_value_flag,
821             cost_of_removal_clearing_acct,
822             cost_of_removal_gain_acct,
823             cost_of_removal_loss_acct,
824             default_life_extension_ceiling,
825             default_life_extension_factor,
826             default_max_fully_rsvd_revals,
827             default_reval_fully_rsvd_flag,
828             deferred_deprn_expense_acct,
829             deferred_deprn_reserve_acct,
830             deprn_allocation_code,
831             --deprn_status,
832             --fiscal_year_name,
833             --initial_period_counter,
834             je_cip_adjustment_category,
835             je_cip_addition_category,
836             je_cip_reclass_category,
837             je_cip_retirement_category,
838             je_cip_reval_category,
839             je_cip_transfer_category,
840             je_reval_category,
841             --last_mass_copy_period_counter,
842             --last_period_counter,
843             --last_purge_period_counter,
844             --mass_copy_source_book,
845             --mass_request_id,
846             nbv_amount_threshold,
847             nbv_fraction_threshold,
848             nbv_retired_gain_acct,
849             nbv_retired_loss_acct,
850             proceeds_of_sale_clearing_acct,
851             proceeds_of_sale_gain_acct,
852             proceeds_of_sale_loss_acct,
853             revalue_on_retirement_flag,
854             reval_deprn_reserve_flag,
855             reval_rsv_retired_gain_acct,
856             reval_rsv_retired_loss_acct,
857             deprn_adjustment_acct,
858             immediate_copy_flag,
859             je_deprn_adjustment_category,
860             depr_first_year_ret_flag,
861             flexbuilder_defaults_ccid,
862             retire_reval_reserve_flag,
863             --use_current_nbv_for_deprn,
864             copy_additions_flag,
865             use_percent_salvage_value_flag,
866             reval_posting_flag,
867             global_attribute1,
868             global_attribute2,
869             global_attribute3,
870             global_attribute4,
871             global_attribute5,
872             global_attribute6,
873             global_attribute7,
874             global_attribute8,
875             global_attribute9,
876             global_attribute10,
877             global_attribute11,
878             global_attribute12,
879             global_attribute13,
880             global_attribute14,
881             global_attribute15,
882             global_attribute16,
883             global_attribute17,
884             global_attribute18,
885             global_attribute19,
886             global_attribute20,
887             global_attribute_category,
888             mc_source_flag,
889             reval_ytd_deprn_flag,
890             allow_cip_assets_flag,
891             org_id,
892             allow_group_deprn_flag,
893             allow_cip_dep_group_flag,
894             allow_interco_group_flag,
895             copy_group_assignment_flag,
896             copy_group_addition_flag,
897             allow_cip_member_flag,
898             allow_member_tracking_flag,
899             intercompany_posting_flag,
900             allow_backdated_transfers_flag,
901             allow_cost_sign_change_flag
902      ) values (
903             X_Book_Type_Code,
904             sysdate,                -- date_active
905             null,                   -- date_inactive
906             X_Book_Type_Name,
907             X_Set_Of_Books_Id,
908             --X_Initial_Date,
909             --X_Last_Deprn_Run_Date,
910             X_Amortize_Flag,
911             --X_Fully_Reserved_Flag,
912             --X_Deprn_Calendar,
913             --X_Book_Class,
914             X_GL_Posting_Allowed_Flag,
918             --X_Accounting_Flex_Structure,
915             --X_Current_Fiscal_Year,
916             X_Allow_Mass_Changes,
917             X_Allow_Deprn_Adjustments,
919             X_Last_Update_Date,
920             X_Last_Updated_By,
921             --X_Prorate_Calendar,
922             X_Date_Ineffective,
923             X_JE_Retirement_Category,
924             X_JE_Depreciation_Category,
925             X_JE_Reclass_Category,
926             X_GL_JE_Source,
927             X_JE_Addition_Category,
928             X_JE_Adjustment_Category,
929             --X_Distribution_Source_Book,
930             X_JE_Transfer_Category,
931             X_Copy_Retirements_Flag,
932             X_Copy_Adjustments_Flag,
933             --X_Deprn_Request_ID,
934             X_Allow_Cost_Ceiling,
935             X_Allow_Deprn_Exp_Ceiling,
936             --X_Calculate_NBV,
937             --X_Run_Year_End_Program,
938             X_JE_Deferred_Deprn_Category,
939             X_ITC_Allowed_Flag,
940             X_Created_By,
941             X_Creation_Date,
942             X_Last_Update_Login,
943             X_Allow_Mass_Copy,
944             X_Allow_Purge_Flag,
945             X_Allow_Reval_Flag,
946             X_Amortize_Reval_Reserve_Flag,
947             X_AP_Intercompany_Acct,
948             X_AR_Intercompany_Acct,
949             X_Attribute1,
950             X_Attribute2,
951             X_Attribute3,
952             X_Attribute4,
953             X_Attribute5,
954             X_Attribute6,
955             X_Attribute7,
956             X_Attribute8,
957             X_Attribute9,
958             X_Attribute10,
959             X_Attribute11,
960             X_Attribute12,
961             X_Attribute13,
962             X_Attribute14,
963             X_Attribute15,
964             X_Attribute_Category_Code,
965             X_Capital_Gain_Threshold,
966             X_Copy_Salvage_Value_Flag,
967             X_Cost_Of_Removal_ClearingAcct,
968             X_Cost_Of_Removal_Gain_Acct,
969             X_Cost_Of_Removal_Loss_Acct,
970             X_Default_Life_Ext_Ceiling,
971             X_Default_Life_Ext_Factor,
972             X_Default_Max_Fully_Rsvd_Reval,
973             X_Default_Rev_Fully_Rsvd_Flag,
974             X_Deferred_Deprn_Expense_Acct,
975             X_Deferred_Deprn_Reserve_Acct,
976             X_Deprn_Allocation_Code,
977             --X_Deprn_Status,
978             --X_Fiscal_Year_Name,
979             --X_Initial_Period_Counter,
980             X_JE_CIP_Adjustment_Category,
981             X_JE_CIP_Addition_Category,
982             X_JE_CIP_Reclass_Category,
983             X_JE_CIP_Retirement_Category,
984             X_JE_CIP_Reval_Category,
985             X_JE_CIP_Transfer_Category,
986             X_JE_Reval_Category,
987             --X_Last_Mass_Copy_Period_Ctr,
988             --X_Last_Period_Counter,
989             --X_Last_Purge_Period_Counter,
990             --X_Mass_Copy_Source_Book,
991             --X_Mass_Request_ID,
992             X_NBV_Amount_Threshold,
993             X_NBV_Fraction_Threshold,
994             X_NBV_Retired_Gain_Acct,
995             X_NBV_Retired_Loss_Acct,
996             X_Proceeds_Of_Sale_Clear_Acct,
997             X_Proceeds_Of_Sale_Gain_Acct,
998             X_Proceeds_Of_Sale_Loss_Acct,
999             X_Revalue_On_Retirement_Flag,
1000             X_Reval_Deprn_Reserve_Flag,
1001             X_Reval_Rsv_Retired_Gain_Acct,
1002             X_Reval_Rsv_Retired_Loss_Acct,
1003             X_Deprn_Adjustment_Acct,
1004             X_Immediate_Copy_Flag,
1005             X_JE_Deprn_Adjustment_Category,
1006             X_Depr_First_Year_Ret_Flag,
1007             X_Flexbuilder_Defaults_CCID,
1008             X_Retire_Reval_Reserve_Flag,
1009             --X_Use_Current_NBV_For_Deprn,
1010             X_Copy_Additions_Flag,
1011             X_Percent_Salvage_Value_Flag,
1012             X_Reval_Posting_Flag,
1013             X_Global_Attribute1,
1014             X_Global_Attribute2,
1015             X_Global_Attribute3,
1016             X_Global_Attribute4,
1017             X_Global_Attribute5,
1018             X_Global_Attribute6,
1019             X_Global_Attribute7,
1020             X_Global_Attribute8,
1021             X_Global_Attribute9,
1022             X_Global_Attribute10,
1023             X_Global_Attribute11,
1024             X_Global_Attribute12,
1025             X_Global_Attribute13,
1026             X_Global_Attribute14,
1027             X_Global_Attribute15,
1028             X_Global_Attribute16,
1029             X_Global_Attribute17,
1030             X_Global_Attribute18,
1031             X_Global_Attribute19,
1032             X_Global_Attribute20,
1033             X_Global_Attribute_Category,
1034             X_MC_Source_Flag,
1035             X_Reval_YTD_Deprn_Flag,
1036             X_Allow_CIP_Assets_Flag,
1037             X_Org_ID,
1038             X_Allow_Group_Deprn_Flag,
1039             X_Allow_CIP_Dep_Group_Flag,
1040             X_Allow_Interco_Group_Flag,
1041             X_Copy_Group_Assignment_Flag,
1042             X_Copy_Group_Additon_Flag,
1043             X_Allow_CIP_Member_Flag,
1044             X_Allow_Member_Tracking_Flag,
1045             X_Intercompany_Posting_Flag,
1046             X_Backdated_Transfers_Flag,
1047             X_allow_cost_sign_change_flag
1048      );
1049 
1050   end if;
1051 
1052   X_Return_Status := TRUE;
1053 
1054   EXCEPTION
1055      WHEN OTHERS THEN
1056         fa_srvr_msg.add_sql_error(
1057              calling_fn => 'fa_book_controls_pkg.insert_row'
1058              ,p_log_level_rec => p_log_level_rec);
1059          X_Return_Status := FALSE;
1060          raise;
1061   END Insert_Row;
1062 
1066   BEGIN
1063   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2
1064  ,p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) AS
1065 
1067 
1068      null;
1069   END Lock_Row;
1070 
1071   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
1072                        X_Book_Type_Code                 VARCHAR2,
1073                        X_Book_Type_Name                 VARCHAR2,
1074                        X_Set_Of_Books_Id                NUMBER,
1075                        X_Initial_Date                   DATE,
1076                        X_Last_Deprn_Run_Date            DATE,
1077                        X_Amortize_Flag                  VARCHAR2,
1078                        X_Fully_Reserved_Flag            VARCHAR2,
1079                        X_Deprn_Calendar                 VARCHAR2,
1080                        X_Book_Class                     VARCHAR2,
1081                        X_GL_Posting_Allowed_Flag        VARCHAR2,
1082                        X_Current_Fiscal_Year            NUMBER,
1083                        X_Allow_Mass_Changes             VARCHAR2,
1084                        X_Allow_Deprn_Adjustments        VARCHAR2,
1085                        X_Accounting_Flex_Structure      NUMBER,
1086                        X_Last_Update_Date               DATE,
1087                        X_Last_Updated_By                NUMBER,
1088                        X_Prorate_Calendar               VARCHAR2,
1089                        X_Date_Ineffective               DATE,
1090                        X_JE_Retirement_Category         VARCHAR2,
1091                        X_JE_Depreciation_Category       VARCHAR2,
1092                        X_JE_Reclass_Category            VARCHAR2,
1093                        X_GL_JE_Source                   VARCHAR2,
1094                        X_JE_Addition_Category           VARCHAR2,
1095                        X_JE_Adjustment_Category         VARCHAR2,
1096                        X_Distribution_Source_Book       VARCHAR2,
1097                        X_JE_Transfer_Category           VARCHAR2,
1098                        X_Copy_Retirements_Flag          VARCHAR2,
1099                        X_Copy_Adjustments_Flag          VARCHAR2,
1100                        X_Deprn_Request_ID               NUMBER,
1101                        X_Allow_Cost_Ceiling             VARCHAR2,
1102                        X_Allow_Deprn_Exp_Ceiling        VARCHAR2,
1103                        X_Calculate_NBV                  VARCHAR2,
1104                        X_Run_Year_End_Program           VARCHAR2,
1105                        X_JE_Deferred_Deprn_Category     VARCHAR2,
1106                        X_ITC_Allowed_Flag               VARCHAR2,
1107                        X_Created_By                     NUMBER,
1108                        X_Creation_Date                  DATE,
1109                        X_Last_Update_Login              NUMBER,
1110                        X_Allow_Mass_Copy                VARCHAR2,
1111                        X_Allow_Purge_Flag               VARCHAR2,
1112                        X_Allow_Reval_Flag               VARCHAR2,
1113                        X_Amortize_Reval_Reserve_Flag    VARCHAR2,
1114                        X_AP_Intercompany_Acct           VARCHAR2,
1115                        X_AR_Intercompany_Acct           VARCHAR2,
1116                        X_Attribute1                     VARCHAR2,
1117                        X_Attribute2                     VARCHAR2,
1118                        X_Attribute3                     VARCHAR2,
1119                        X_Attribute4                     VARCHAR2,
1120                        X_Attribute5                     VARCHAR2,
1121                        X_Attribute6                     VARCHAR2,
1122                        X_Attribute7                     VARCHAR2,
1123                        X_Attribute8                     VARCHAR2,
1124                        X_Attribute9                     VARCHAR2,
1125                        X_Attribute10                    VARCHAR2,
1126                        X_Attribute11                    VARCHAR2,
1127                        X_Attribute12                    VARCHAR2,
1128                        X_Attribute13                    VARCHAR2,
1129                        X_Attribute14                    VARCHAR2,
1130                        X_Attribute15                    VARCHAR2,
1131                        X_Attribute_Category_Code        VARCHAR2,
1132                        X_Capital_Gain_Threshold         NUMBER,
1133                        X_Copy_Salvage_Value_Flag        VARCHAR2,
1134                        X_Cost_Of_Removal_ClearingAcct   VARCHAR2,
1135                        X_Cost_Of_Removal_Gain_Acct      VARCHAR2,
1136                        X_Cost_Of_Removal_Loss_Acct      VARCHAR2,
1137                        X_Default_Life_Ext_Ceiling       NUMBER,
1138                        X_Default_Life_Ext_Factor        NUMBER,
1139                        X_Default_Max_Fully_Rsvd_Reval   NUMBER,
1140                        X_Default_Rev_Fully_Rsvd_Flag    VARCHAR2,
1141                        X_Deferred_Deprn_Expense_Acct    VARCHAR2,
1142                        X_Deferred_Deprn_Reserve_Acct    VARCHAR2,
1143                        X_Deprn_Allocation_Code          VARCHAR2,
1144                        X_Deprn_Status                   VARCHAR2,
1145                        X_Fiscal_Year_Name               VARCHAR2,
1146                        X_Initial_Period_Counter         VARCHAR2,
1147                        X_JE_CIP_Adjustment_Category     VARCHAR2,
1148                        X_JE_CIP_Addition_Category       VARCHAR2,
1149                        X_JE_CIP_Reclass_Category        VARCHAR2,
1150                        X_JE_CIP_Retirement_Category     VARCHAR2,
1151                        X_JE_CIP_Reval_Category          VARCHAR2,
1152                        X_JE_CIP_Transfer_Category       VARCHAR2,
1153                        X_JE_Reval_Category              VARCHAR2,
1154                        X_Last_Mass_Copy_Period_Ctr      NUMBER,
1155                        X_Last_Period_Counter            NUMBER,
1156                        X_Last_Purge_Period_Counter      NUMBER,
1160                        X_NBV_Fraction_Threshold         NUMBER,
1157                        X_Mass_Copy_Source_Book          VARCHAR2,
1158                        X_Mass_Request_ID                NUMBER,
1159                        X_NBV_Amount_Threshold           NUMBER,
1161                        X_NBV_Retired_Gain_Acct          VARCHAR2,
1162                        X_NBV_Retired_Loss_Acct          VARCHAR2,
1163                        X_Proceeds_Of_Sale_Clear_Acct    VARCHAR2,
1164                        X_Proceeds_Of_Sale_Gain_Acct     VARCHAR2,
1165                        X_Proceeds_Of_Sale_Loss_Acct     VARCHAR2,
1166                        X_Revalue_On_Retirement_Flag     VARCHAR2,
1167                        X_Reval_Deprn_Reserve_Flag       VARCHAR2,
1168                        X_Reval_Rsv_Retired_Gain_Acct    VARCHAR2,
1169                        X_Reval_Rsv_Retired_Loss_Acct    VARCHAR2,
1170                        X_Deprn_Adjustment_Acct          VARCHAR2,
1171                        X_Immediate_Copy_Flag            VARCHAR2,
1172                        X_JE_Deprn_Adjustment_Category   VARCHAR2,
1173                        X_Depr_First_Year_Ret_Flag       VARCHAR2,
1174                        X_Flexbuilder_Defaults_CCID      NUMBER,
1175                        X_Retire_Reval_Reserve_Flag      VARCHAR2,
1176                        X_Use_Current_NBV_For_Deprn      VARCHAR2,
1177                        X_Copy_Additions_Flag            VARCHAR2,
1178                        X_Percent_Salvage_Value_Flag     VARCHAR2,
1179                        X_Reval_Posting_Flag             VARCHAR2,
1180                        X_Global_Attribute1              VARCHAR2,
1181                        X_Global_Attribute2              VARCHAR2,
1182                        X_Global_Attribute3              VARCHAR2,
1183                        X_Global_Attribute4              VARCHAR2,
1184                        X_Global_Attribute5              VARCHAR2,
1185                        X_Global_Attribute6              VARCHAR2,
1186                        X_Global_Attribute7              VARCHAR2,
1187                        X_Global_Attribute8              VARCHAR2,
1188                        X_Global_Attribute9              VARCHAR2,
1189                        X_Global_Attribute10             VARCHAR2,
1190                        X_Global_Attribute11             VARCHAR2,
1191                        X_Global_Attribute12             VARCHAR2,
1192                        X_Global_Attribute13             VARCHAR2,
1193                        X_Global_Attribute14             VARCHAR2,
1194                        X_Global_Attribute15             VARCHAR2,
1195                        X_Global_Attribute16             VARCHAR2,
1196                        X_Global_Attribute17             VARCHAR2,
1197                        X_Global_Attribute18             VARCHAR2,
1198                        X_Global_Attribute19             VARCHAR2,
1199                        X_Global_Attribute20             VARCHAR2,
1200                        X_Global_Attribute_Category      VARCHAR2,
1201                        X_MC_Source_Flag                 VARCHAR2,
1202                        X_Reval_YTD_Deprn_Flag           VARCHAR2,
1203                        X_Allow_CIP_Assets_Flag          VARCHAR2,
1204                        X_Org_ID                         NUMBER,
1205                        X_Allow_Group_Deprn_Flag         VARCHAR2,
1206                        X_Allow_CIP_Dep_Group_Flag       VARCHAR2,
1207                        X_Allow_Interco_Group_Flag       VARCHAR2,
1208                        X_Copy_Group_Assignment_Flag     VARCHAR2,
1209                        X_Copy_Group_Additon_Flag        VARCHAR2,
1210                        X_Allow_CIP_Member_Flag          VARCHAR2,
1211                        X_Allow_Member_Tracking_Flag     VARCHAR2,
1212                        X_Intercompany_Posting_Flag      VARCHAR2,
1213                        X_Backdated_Transfers_Flag       VARCHAR2,
1214                        X_allow_cost_sign_change_flag    VARCHAR2,
1215                        X_MRC_SOB_Type_Code              VARCHAR2 DEFAULT 'P',
1216                        X_Return_Status       OUT NOCOPY BOOLEAN,
1217                        X_Calling_Fn                     VARCHAR2,
1218                        p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) AS
1219 
1220      l_sysdate    date;
1221 
1222   BEGIN
1223 
1224      if (X_mrc_sob_type_code = 'R') then
1225 
1226         UPDATE fa_book_controls_mrc_v
1227         SET
1228         book_type_name                 = X_Book_Type_Name,
1229         set_of_books_id                = X_Set_Of_Books_Id,
1230         initial_date                   = X_Initial_Date,
1231         last_deprn_run_date            = X_Last_Deprn_Run_Date,
1232         amortize_flag                  = X_Amortize_Flag,
1233         fully_reserved_flag            = X_Fully_Reserved_Flag,
1234         deprn_calendar                 = X_Deprn_Calendar,
1235         book_class                     = X_Book_Class,
1236         gl_posting_allowed_flag        = X_GL_Posting_Allowed_Flag,
1237         current_fiscal_year            = X_Current_Fiscal_Year,
1238         allow_mass_changes             = X_Allow_Mass_Changes,
1239         allow_deprn_adjustments        = X_Allow_Deprn_Adjustments,
1240         accounting_flex_structure      = X_Accounting_Flex_Structure,
1241         last_update_date               = X_Last_Update_Date,
1242         last_updated_by                = X_Last_Updated_By,
1243         prorate_calendar               = X_Prorate_Calendar,
1244         date_ineffective               = X_Date_Ineffective,
1245         je_retirement_category         = X_JE_Retirement_Category,
1246         je_depreciation_category       = X_JE_Depreciation_Category,
1247         je_reclass_category            = X_JE_Reclass_Category,
1248         gl_je_source                   = X_GL_JE_Source,
1249         je_addition_category           = X_JE_Addition_Category,
1250         je_adjustment_category         = X_JE_Adjustment_Category,
1251         distribution_source_book       = X_Distribution_Source_Book,
1252         je_transfer_category           = X_JE_Transfer_Category,
1256         allow_cost_ceiling             = X_Allow_Cost_Ceiling,
1253         copy_retirements_flag          = X_Copy_Retirements_Flag,
1254         copy_adjustments_flag          = X_Copy_Adjustments_Flag,
1255         deprn_request_id               = X_Deprn_Request_ID,
1257         allow_deprn_exp_ceiling        = X_Allow_Deprn_Exp_Ceiling,
1258         calculate_nbv                  = X_Calculate_NBV,
1259         run_year_end_program           = X_Run_Year_End_Program,
1260         je_deferred_deprn_category     = X_JE_Deferred_Deprn_Category,
1261         itc_allowed_flag               = X_ITC_Allowed_Flag,
1262         created_by                     = X_Created_By,
1263         creation_date                  = X_Creation_Date,
1264         last_update_login              = X_Last_Update_Login,
1265         allow_mass_copy                = X_Allow_Mass_Copy,
1266         allow_purge_flag               = X_Allow_Purge_Flag,
1267         allow_reval_flag               = X_Allow_Reval_Flag,
1268         amortize_reval_reserve_flag    = X_Amortize_Reval_Reserve_Flag,
1269         ap_intercompany_acct           = X_AP_Intercompany_Acct,
1270         ar_intercompany_acct           = X_AR_Intercompany_Acct,
1271         attribute1                     = X_Attribute1,
1272         attribute2                     = X_Attribute2,
1273         attribute3                     = X_Attribute3,
1274         attribute4                     = X_Attribute4,
1275         attribute5                     = X_Attribute5,
1276         attribute6                     = X_Attribute6,
1277         attribute7                     = X_Attribute7,
1278         attribute8                     = X_Attribute8,
1279         attribute9                     = X_Attribute9,
1280         attribute10                    = X_Attribute10,
1281         attribute11                    = X_Attribute11,
1282         attribute12                    = X_Attribute12,
1283         attribute13                    = X_Attribute13,
1284         attribute14                    = X_Attribute14,
1285         attribute15                    = X_Attribute15,
1286         attribute_category_code        = X_Attribute_Category_Code,
1287         capital_gain_threshold         = X_Capital_Gain_Threshold,
1288         copy_salvage_value_flag        = X_Copy_Salvage_Value_Flag,
1289         cost_of_removal_clearing_acct  = X_Cost_Of_Removal_ClearingAcct,
1290         cost_of_removal_gain_acct      = X_Cost_Of_Removal_Gain_Acct,
1291         cost_of_removal_loss_acct      = X_Cost_Of_Removal_Loss_Acct,
1292         default_life_extension_ceiling = X_Default_Life_Ext_Ceiling,
1293         default_life_extension_factor  = X_Default_Life_Ext_Factor,
1294         default_max_fully_rsvd_revals  = X_Default_Max_Fully_Rsvd_Reval,
1295         default_reval_fully_rsvd_flag  = X_Default_Rev_Fully_Rsvd_Flag,
1296         deferred_deprn_expense_acct    = X_Deferred_Deprn_Expense_Acct,
1297         deferred_deprn_reserve_acct    = X_Deferred_Deprn_Reserve_Acct,
1298         deprn_allocation_code          = X_Deprn_Allocation_Code,
1299         deprn_status                   = X_Deprn_Status,
1300         fiscal_year_name               = X_Fiscal_Year_Name,
1301         initial_period_counter         = X_Initial_Period_Counter,
1302         je_cip_adjustment_category     = X_JE_CIP_Adjustment_Category,
1303         je_cip_addition_category       = X_JE_CIP_Addition_Category,
1304         je_cip_reclass_category        = X_JE_CIP_Reclass_Category,
1305         je_cip_retirement_category     = X_JE_CIP_Retirement_Category,
1306         je_cip_reval_category          = X_JE_CIP_Reval_Category,
1307         je_cip_transfer_category       = X_JE_CIP_Transfer_Category,
1308         je_reval_category              = X_JE_Reval_Category,
1309         last_mass_copy_period_counter  = X_Last_Mass_Copy_Period_Ctr,
1310         last_period_counter            = X_Last_Period_Counter,
1311         last_purge_period_counter      = X_Last_Purge_Period_Counter,
1312         mass_copy_source_book          = X_Mass_Copy_Source_Book,
1313         mass_request_id                = X_Mass_Request_ID,
1314         nbv_amount_threshold           = X_NBV_Amount_Threshold,
1315         nbv_fraction_threshold         = X_NBV_Fraction_Threshold,
1316         nbv_retired_gain_acct          = X_NBV_Retired_Gain_Acct,
1317         nbv_retired_loss_acct          = X_NBV_Retired_Loss_Acct,
1318         proceeds_of_sale_clearing_acct = X_Proceeds_Of_Sale_Clear_Acct,
1319         proceeds_of_sale_gain_acct     = X_Proceeds_Of_Sale_Gain_Acct,
1320         proceeds_of_sale_loss_acct     = X_Proceeds_Of_Sale_Loss_Acct,
1321         revalue_on_retirement_flag     = X_Revalue_On_Retirement_Flag,
1322         reval_deprn_reserve_flag       = X_Reval_Deprn_Reserve_Flag,
1323         reval_rsv_retired_gain_acct    = X_Reval_Rsv_Retired_Gain_Acct,
1324         reval_rsv_retired_loss_acct    = X_Reval_Rsv_Retired_Loss_Acct,
1325         deprn_adjustment_acct          = X_Deprn_Adjustment_Acct,
1326         immediate_copy_flag            = X_Immediate_Copy_Flag,
1327         je_deprn_adjustment_category   = X_JE_Deprn_Adjustment_Category,
1328         depr_first_year_ret_flag       = X_Depr_First_Year_Ret_Flag,
1329         flexbuilder_defaults_ccid      = X_Flexbuilder_Defaults_CCID,
1330         retire_reval_reserve_flag      = X_Retire_Reval_Reserve_Flag,
1331         use_current_nbv_for_deprn      = X_Use_Current_NBV_For_Deprn,
1332         copy_additions_flag            = X_Copy_Additions_Flag,
1333         use_percent_salvage_value_flag = X_Percent_Salvage_Value_Flag,
1334         reval_posting_flag             = X_Reval_Posting_Flag,
1335         global_attribute1              = X_Global_Attribute1,
1336         global_attribute2              = X_Global_Attribute2,
1337         global_attribute3              = X_Global_Attribute3,
1338         global_attribute4              = X_Global_Attribute4,
1339         global_attribute5              = X_Global_Attribute5,
1340         global_attribute6              = X_Global_Attribute6,
1341         global_attribute7              = X_Global_Attribute7,
1342         global_attribute8              = X_Global_Attribute8,
1343         global_attribute9              = X_Global_Attribute9,
1344         global_attribute10             = X_Global_Attribute10,
1345         global_attribute11             = X_Global_Attribute11,
1346         global_attribute12             = X_Global_Attribute12,
1347         global_attribute13             = X_Global_Attribute13,
1348         global_attribute14             = X_Global_Attribute14,
1349         global_attribute15             = X_Global_Attribute15,
1350         global_attribute16             = X_Global_Attribute16,
1351         global_attribute17             = X_Global_Attribute17,
1352         global_attribute18             = X_Global_Attribute18,
1353         global_attribute19             = X_Global_Attribute19,
1354         global_attribute20             = X_Global_Attribute20,
1355         global_attribute_category      = X_Global_Attribute_Category,
1356         mc_source_flag                 = X_MC_Source_Flag,
1357         reval_ytd_deprn_flag           = X_Reval_YTD_Deprn_Flag,
1358         allow_cip_assets_flag          = X_Allow_CIP_Assets_Flag,
1359         org_id                         = X_Org_ID,
1360         allow_group_deprn_flag         = X_Allow_Group_Deprn_Flag,
1361         allow_cip_dep_group_flag       = X_Allow_CIP_Dep_Group_Flag,
1362         allow_interco_group_flag       = X_Allow_Interco_Group_Flag,
1363         copy_group_assignment_flag     = X_Copy_Group_Assignment_Flag,
1364         copy_group_addition_flag       = X_Copy_Group_Additon_Flag,
1365         --allow_cip_member_flag          = X_Allow_CIP_Member_Flag,
1366         --allow_member_tracking_flag     = X_Allow_Member_Tracking_Flag,
1367         intercompany_posting_flag      = X_Intercompany_Posting_Flag,
1368         allow_cost_sign_change_flag    = X_allow_cost_sign_change_flag
1369         --allow_backdated_transfers_flag = X_Backdated_Transfers_Flag
1370         WHERE book_type_code = X_Book_Type_Code;
1371 
1372         if (SQL%NOTFOUND) then
1373            Raise NO_DATA_FOUND;
1374         end if;
1375 
1376      else
1377 
1378         UPDATE fa_book_controls
1379         SET
1380         book_type_name                 = X_Book_Type_Name,
1381         set_of_books_id                = X_Set_Of_Books_Id,
1382         initial_date                   = X_Initial_Date,
1383         last_deprn_run_date            = X_Last_Deprn_Run_Date,
1384         amortize_flag                  = X_Amortize_Flag,
1385         fully_reserved_flag            = X_Fully_Reserved_Flag,
1386         deprn_calendar                 = X_Deprn_Calendar,
1387         book_class                     = X_Book_Class,
1388         gl_posting_allowed_flag        = X_GL_Posting_Allowed_Flag,
1389         current_fiscal_year            = X_Current_Fiscal_Year,
1390         allow_mass_changes             = X_Allow_Mass_Changes,
1391         allow_deprn_adjustments        = X_Allow_Deprn_Adjustments,
1392         accounting_flex_structure      = X_Accounting_Flex_Structure,
1393         last_update_date               = X_Last_Update_Date,
1394         last_updated_by                = X_Last_Updated_By,
1395         prorate_calendar               = X_Prorate_Calendar,
1396         date_ineffective               = X_Date_Ineffective,
1397         je_retirement_category         = X_JE_Retirement_Category,
1398         je_depreciation_category       = X_JE_Depreciation_Category,
1399         je_reclass_category            = X_JE_Reclass_Category,
1400         gl_je_source                   = X_GL_JE_Source,
1401         je_addition_category           = X_JE_Addition_Category,
1402         je_adjustment_category         = X_JE_Adjustment_Category,
1403         distribution_source_book       = X_Distribution_Source_Book,
1404         je_transfer_category           = X_JE_Transfer_Category,
1405         copy_retirements_flag          = X_Copy_Retirements_Flag,
1406         copy_adjustments_flag          = X_Copy_Adjustments_Flag,
1407         deprn_request_id               = X_Deprn_Request_ID,
1408         allow_cost_ceiling             = X_Allow_Cost_Ceiling,
1409         allow_deprn_exp_ceiling        = X_Allow_Deprn_Exp_Ceiling,
1410         calculate_nbv                  = X_Calculate_NBV,
1411         run_year_end_program           = X_Run_Year_End_Program,
1412         je_deferred_deprn_category     = X_JE_Deferred_Deprn_Category,
1413         itc_allowed_flag               = X_ITC_Allowed_Flag,
1414         created_by                     = X_Created_By,
1415         creation_date                  = X_Creation_Date,
1416         last_update_login              = X_Last_Update_Login,
1417         allow_mass_copy                = X_Allow_Mass_Copy,
1418         allow_purge_flag               = X_Allow_Purge_Flag,
1419         allow_reval_flag               = X_Allow_Reval_Flag,
1420         amortize_reval_reserve_flag    = X_Amortize_Reval_Reserve_Flag,
1421         ap_intercompany_acct           = X_AP_Intercompany_Acct,
1422         ar_intercompany_acct           = X_AR_Intercompany_Acct,
1423         attribute1                     = X_Attribute1,
1424         attribute2                     = X_Attribute2,
1425         attribute3                     = X_Attribute3,
1426         attribute4                     = X_Attribute4,
1427         attribute5                     = X_Attribute5,
1428         attribute6                     = X_Attribute6,
1429         attribute7                     = X_Attribute7,
1430         attribute8                     = X_Attribute8,
1431         attribute9                     = X_Attribute9,
1432         attribute10                    = X_Attribute10,
1433         attribute11                    = X_Attribute11,
1434         attribute12                    = X_Attribute12,
1435         attribute13                    = X_Attribute13,
1436         attribute14                    = X_Attribute14,
1437         attribute15                    = X_Attribute15,
1438         attribute_category_code        = X_Attribute_Category_Code,
1439         capital_gain_threshold         = X_Capital_Gain_Threshold,
1440         copy_salvage_value_flag        = X_Copy_Salvage_Value_Flag,
1441         cost_of_removal_clearing_acct  = X_Cost_Of_Removal_ClearingAcct,
1442         cost_of_removal_gain_acct      = X_Cost_Of_Removal_Gain_Acct,
1443         cost_of_removal_loss_acct      = X_Cost_Of_Removal_Loss_Acct,
1444         default_life_extension_ceiling = X_Default_Life_Ext_Ceiling,
1445         default_life_extension_factor  = X_Default_Life_Ext_Factor,
1446         default_max_fully_rsvd_revals  = X_Default_Max_Fully_Rsvd_Reval,
1447         default_reval_fully_rsvd_flag  = X_Default_Rev_Fully_Rsvd_Flag,
1448         deferred_deprn_expense_acct    = X_Deferred_Deprn_Expense_Acct,
1449         deferred_deprn_reserve_acct    = X_Deferred_Deprn_Reserve_Acct,
1450         deprn_allocation_code          = X_Deprn_Allocation_Code,
1451         deprn_status                   = X_Deprn_Status,
1452         fiscal_year_name               = X_Fiscal_Year_Name,
1453         initial_period_counter         = X_Initial_Period_Counter,
1454         je_cip_adjustment_category     = X_JE_CIP_Adjustment_Category,
1455         je_cip_addition_category       = X_JE_CIP_Addition_Category,
1456         je_cip_reclass_category        = X_JE_CIP_Reclass_Category,
1457         je_cip_retirement_category     = X_JE_CIP_Retirement_Category,
1458         je_cip_reval_category          = X_JE_CIP_Reval_Category,
1459         je_cip_transfer_category       = X_JE_CIP_Transfer_Category,
1460         je_reval_category              = X_JE_Reval_Category,
1461         last_mass_copy_period_counter  = X_Last_Mass_Copy_Period_Ctr,
1462         last_period_counter            = X_Last_Period_Counter,
1463         last_purge_period_counter      = X_Last_Purge_Period_Counter,
1464         mass_copy_source_book          = X_Mass_Copy_Source_Book,
1465         mass_request_id                = X_Mass_Request_ID,
1466         nbv_amount_threshold           = X_NBV_Amount_Threshold,
1467         nbv_fraction_threshold         = X_NBV_Fraction_Threshold,
1468         nbv_retired_gain_acct          = X_NBV_Retired_Gain_Acct,
1469         nbv_retired_loss_acct          = X_NBV_Retired_Loss_Acct,
1470         proceeds_of_sale_clearing_acct = X_Proceeds_Of_Sale_Clear_Acct,
1471         proceeds_of_sale_gain_acct     = X_Proceeds_Of_Sale_Gain_Acct,
1472         proceeds_of_sale_loss_acct     = X_Proceeds_Of_Sale_Loss_Acct,
1473         revalue_on_retirement_flag     = X_Revalue_On_Retirement_Flag,
1474         reval_deprn_reserve_flag       = X_Reval_Deprn_Reserve_Flag,
1475         reval_rsv_retired_gain_acct    = X_Reval_Rsv_Retired_Gain_Acct,
1476         reval_rsv_retired_loss_acct    = X_Reval_Rsv_Retired_Loss_Acct,
1477         deprn_adjustment_acct          = X_Deprn_Adjustment_Acct,
1478         immediate_copy_flag            = X_Immediate_Copy_Flag,
1479         je_deprn_adjustment_category   = X_JE_Deprn_Adjustment_Category,
1480         depr_first_year_ret_flag       = X_Depr_First_Year_Ret_Flag,
1481         flexbuilder_defaults_ccid      = X_Flexbuilder_Defaults_CCID,
1482         retire_reval_reserve_flag      = X_Retire_Reval_Reserve_Flag,
1483         use_current_nbv_for_deprn      = X_Use_Current_NBV_For_Deprn,
1484         copy_additions_flag            = X_Copy_Additions_Flag,
1488         global_attribute2              = X_Global_Attribute2,
1485         use_percent_salvage_value_flag = X_Percent_Salvage_Value_Flag,
1486         reval_posting_flag             = X_Reval_Posting_Flag,
1487         global_attribute1              = X_Global_Attribute1,
1489         global_attribute3              = X_Global_Attribute3,
1490         global_attribute4              = X_Global_Attribute4,
1491         global_attribute5              = X_Global_Attribute5,
1492         global_attribute6              = X_Global_Attribute6,
1493         global_attribute7              = X_Global_Attribute7,
1494         global_attribute8              = X_Global_Attribute8,
1495         global_attribute9              = X_Global_Attribute9,
1496         global_attribute10             = X_Global_Attribute10,
1497         global_attribute11             = X_Global_Attribute11,
1498         global_attribute12             = X_Global_Attribute12,
1499         global_attribute13             = X_Global_Attribute13,
1500         global_attribute14             = X_Global_Attribute14,
1501         global_attribute15             = X_Global_Attribute15,
1502         global_attribute16             = X_Global_Attribute16,
1503         global_attribute17             = X_Global_Attribute17,
1504         global_attribute18             = X_Global_Attribute18,
1505         global_attribute19             = X_Global_Attribute19,
1506         global_attribute20             = X_Global_Attribute20,
1507         global_attribute_category      = X_Global_Attribute_Category,
1508         mc_source_flag                 = X_MC_Source_Flag,
1509         reval_ytd_deprn_flag           = X_Reval_YTD_Deprn_Flag,
1510         allow_cip_assets_flag          = X_Allow_CIP_Assets_Flag,
1511         org_id                         = X_Org_ID,
1512         allow_group_deprn_flag         = X_Allow_Group_Deprn_Flag,
1513         allow_cip_dep_group_flag       = X_Allow_CIP_Dep_Group_Flag,
1514         allow_interco_group_flag       = X_Allow_Interco_Group_Flag,
1515         copy_group_assignment_flag     = X_Copy_Group_Assignment_Flag,
1516         copy_group_addition_flag       = X_Copy_Group_Additon_Flag,
1517         allow_cip_member_flag          = X_Allow_CIP_Member_Flag,
1518         allow_member_tracking_flag     = X_Allow_Member_Tracking_Flag,
1519         intercompany_posting_flag      = X_Intercompany_Posting_Flag,
1520         allow_backdated_transfers_flag = X_Backdated_Transfers_Flag,
1521         allow_cost_sign_change_flag    = X_allow_cost_sign_change_flag
1522         WHERE book_type_code = X_Book_Type_Code;
1523 
1524         if (SQL%NOTFOUND) then
1525            Raise NO_DATA_FOUND;
1526         end if;
1527 
1528         select sysdate into l_sysdate from dual;
1529 
1530         UPDATE fa_book_controls_history
1531         SET    date_inactive = l_sysdate
1532         WHERE  book_type_code = X_Book_Type_Code
1533         AND    date_inactive is null;
1534 
1535         insert into fa_book_controls_history (
1536             book_type_code,
1537             date_active,
1538             date_inactive,
1539             book_type_name,
1540             set_of_books_id,
1541             --initial_date,
1542             --last_deprn_run_date,
1543             amortize_flag,
1544             --fully_reserved_flag,
1545             --deprn_calendar,
1546             --book_class,
1547             gl_posting_allowed_flag,
1548             --current_fiscal_year,
1549             allow_mass_changes,
1550             allow_deprn_adjustments,
1551             --accounting_flex_structure,
1552             last_update_date,
1553             last_updated_by,
1554             --prorate_calendar,
1555             date_ineffective,
1556             je_retirement_category,
1557             je_depreciation_category,
1558             je_reclass_category,
1559             gl_je_source,
1560             je_addition_category,
1561             je_adjustment_category,
1562             --distribution_source_book,
1563             je_transfer_category,
1564             copy_retirements_flag,
1565             copy_adjustments_flag,
1566             --deprn_request_id,
1567             allow_cost_ceiling,
1568             allow_deprn_exp_ceiling,
1569             --calculate_nbv,
1570             --run_year_end_program,
1571             je_deferred_deprn_category,
1572             itc_allowed_flag,
1573             created_by,
1574             creation_date,
1575             last_update_login,
1576             allow_mass_copy,
1577             allow_purge_flag,
1578             allow_reval_flag,
1579             amortize_reval_reserve_flag,
1580             ap_intercompany_acct,
1581             ar_intercompany_acct,
1582             attribute1,
1583             attribute2,
1584             attribute3,
1585             attribute4,
1586             attribute5,
1587             attribute6,
1588             attribute7,
1589             attribute8,
1590             attribute9,
1591             attribute10,
1592             attribute11,
1593             attribute12,
1594             attribute13,
1595             attribute14,
1596             attribute15,
1597             attribute_category_code,
1598             capital_gain_threshold,
1599             copy_salvage_value_flag,
1600             cost_of_removal_clearing_acct,
1601             cost_of_removal_gain_acct,
1602             cost_of_removal_loss_acct,
1603             default_life_extension_ceiling,
1604             default_life_extension_factor,
1605             default_max_fully_rsvd_revals,
1606             default_reval_fully_rsvd_flag,
1607             deferred_deprn_expense_acct,
1608             deferred_deprn_reserve_acct,
1609             deprn_allocation_code,
1610             --deprn_status,
1611             --fiscal_year_name,
1612             --initial_period_counter,
1613             je_cip_adjustment_category,
1614             je_cip_addition_category,
1618             je_cip_transfer_category,
1615             je_cip_reclass_category,
1616             je_cip_retirement_category,
1617             je_cip_reval_category,
1619             je_reval_category,
1620             --last_mass_copy_period_counter,
1621             --last_period_counter,
1622             --last_purge_period_counter,
1623             --mass_copy_source_book,
1624             --mass_request_id,
1625             nbv_amount_threshold,
1626             nbv_fraction_threshold,
1627             nbv_retired_gain_acct,
1628             nbv_retired_loss_acct,
1629             proceeds_of_sale_clearing_acct,
1630             proceeds_of_sale_gain_acct,
1631             proceeds_of_sale_loss_acct,
1632             revalue_on_retirement_flag,
1633             reval_deprn_reserve_flag,
1634             reval_rsv_retired_gain_acct,
1635             reval_rsv_retired_loss_acct,
1636             deprn_adjustment_acct,
1637             immediate_copy_flag,
1638             je_deprn_adjustment_category,
1639             depr_first_year_ret_flag,
1640             flexbuilder_defaults_ccid,
1641             retire_reval_reserve_flag,
1642             --use_current_nbv_for_deprn,
1643             copy_additions_flag,
1644             use_percent_salvage_value_flag,
1645             reval_posting_flag,
1646             global_attribute1,
1647             global_attribute2,
1648             global_attribute3,
1649             global_attribute4,
1650             global_attribute5,
1651             global_attribute6,
1652             global_attribute7,
1653             global_attribute8,
1654             global_attribute9,
1655             global_attribute10,
1656             global_attribute11,
1657             global_attribute12,
1658             global_attribute13,
1659             global_attribute14,
1660             global_attribute15,
1661             global_attribute16,
1662             global_attribute17,
1663             global_attribute18,
1664             global_attribute19,
1665             global_attribute20,
1666             global_attribute_category,
1667             mc_source_flag,
1668             reval_ytd_deprn_flag,
1669             allow_cip_assets_flag,
1670             org_id,
1671             allow_group_deprn_flag,
1672             allow_cip_dep_group_flag,
1673             allow_interco_group_flag,
1674             copy_group_assignment_flag,
1675             copy_group_addition_flag,
1676             allow_cip_member_flag,
1677             allow_member_tracking_flag,
1678             intercompany_posting_flag,
1679             allow_backdated_transfers_flag,
1680             allow_cost_sign_change_flag
1681         ) values (
1682             X_Book_Type_Code,
1683             l_sysdate,              -- date_active
1684             null,                   -- date_inactive
1685             X_Book_Type_Name,
1686             X_Set_Of_Books_Id,
1687             --X_Initial_Date,
1688             --X_Last_Deprn_Run_Date,
1689             X_Amortize_Flag,
1690             --X_Fully_Reserved_Flag,
1691             --X_Deprn_Calendar,
1692             --X_Book_Class,
1693             X_GL_Posting_Allowed_Flag,
1694             --X_Current_Fiscal_Year,
1695             X_Allow_Mass_Changes,
1696             X_Allow_Deprn_Adjustments,
1697             --X_Accounting_Flex_Structure,
1698             X_Last_Update_Date,
1699             X_Last_Updated_By,
1700             --X_Prorate_Calendar,
1701             X_Date_Ineffective,
1702             X_JE_Retirement_Category,
1703             X_JE_Depreciation_Category,
1704             X_JE_Reclass_Category,
1705             X_GL_JE_Source,
1706             X_JE_Addition_Category,
1707             X_JE_Adjustment_Category,
1708             --X_Distribution_Source_Book,
1709             X_JE_Transfer_Category,
1710             X_Copy_Retirements_Flag,
1711             X_Copy_Adjustments_Flag,
1712             --X_Deprn_Request_ID,
1713             X_Allow_Cost_Ceiling,
1714             X_Allow_Deprn_Exp_Ceiling,
1715             --X_Calculate_NBV,
1716             --X_Run_Year_End_Program,
1717             X_JE_Deferred_Deprn_Category,
1718             X_ITC_Allowed_Flag,
1719             X_Created_By,
1720             X_Creation_Date,
1721             X_Last_Update_Login,
1722             X_Allow_Mass_Copy,
1723             X_Allow_Purge_Flag,
1724             X_Allow_Reval_Flag,
1725             X_Amortize_Reval_Reserve_Flag,
1726             X_AP_Intercompany_Acct,
1727             X_AR_Intercompany_Acct,
1728             X_Attribute1,
1729             X_Attribute2,
1730             X_Attribute3,
1731             X_Attribute4,
1732             X_Attribute5,
1733             X_Attribute6,
1734             X_Attribute7,
1735             X_Attribute8,
1736             X_Attribute9,
1737             X_Attribute10,
1738             X_Attribute11,
1739             X_Attribute12,
1740             X_Attribute13,
1741             X_Attribute14,
1742             X_Attribute15,
1743             X_Attribute_Category_Code,
1744             X_Capital_Gain_Threshold,
1745             X_Copy_Salvage_Value_Flag,
1746             X_Cost_Of_Removal_ClearingAcct,
1747             X_Cost_Of_Removal_Gain_Acct,
1748             X_Cost_Of_Removal_Loss_Acct,
1749             X_Default_Life_Ext_Ceiling,
1750             X_Default_Life_Ext_Factor,
1751             X_Default_Max_Fully_Rsvd_Reval,
1752             X_Default_Rev_Fully_Rsvd_Flag,
1753             X_Deferred_Deprn_Expense_Acct,
1754             X_Deferred_Deprn_Reserve_Acct,
1755             X_Deprn_Allocation_Code,
1756             --X_Deprn_Status,
1757             --X_Fiscal_Year_Name,
1758             --X_Initial_Period_Counter,
1759             X_JE_CIP_Adjustment_Category,
1760             X_JE_CIP_Addition_Category,
1764             X_JE_CIP_Transfer_Category,
1761             X_JE_CIP_Reclass_Category,
1762             X_JE_CIP_Retirement_Category,
1763             X_JE_CIP_Reval_Category,
1765             X_JE_Reval_Category,
1766             --X_Last_Mass_Copy_Period_Ctr,
1767             --X_Last_Period_Counter,
1768             --X_Last_Purge_Period_Counter,
1769             --X_Mass_Copy_Source_Book,
1770             --X_Mass_Request_ID,
1771             X_NBV_Amount_Threshold,
1772             X_NBV_Fraction_Threshold,
1773             X_NBV_Retired_Gain_Acct,
1774             X_NBV_Retired_Loss_Acct,
1775             X_Proceeds_Of_Sale_Clear_Acct,
1776             X_Proceeds_Of_Sale_Gain_Acct,
1777             X_Proceeds_Of_Sale_Loss_Acct,
1778             X_Revalue_On_Retirement_Flag,
1779             X_Reval_Deprn_Reserve_Flag,
1780             X_Reval_Rsv_Retired_Gain_Acct,
1781             X_Reval_Rsv_Retired_Loss_Acct,
1782             X_Deprn_Adjustment_Acct,
1783             X_Immediate_Copy_Flag,
1784             X_JE_Deprn_Adjustment_Category,
1785             X_Depr_First_Year_Ret_Flag,
1786             X_Flexbuilder_Defaults_CCID,
1787             X_Retire_Reval_Reserve_Flag,
1788             --X_Use_Current_NBV_For_Deprn,
1789             X_Copy_Additions_Flag,
1790             X_Percent_Salvage_Value_Flag,
1791             X_Reval_Posting_Flag,
1792             X_Global_Attribute1,
1793             X_Global_Attribute2,
1794             X_Global_Attribute3,
1795             X_Global_Attribute4,
1796             X_Global_Attribute5,
1797             X_Global_Attribute6,
1798             X_Global_Attribute7,
1799             X_Global_Attribute8,
1800             X_Global_Attribute9,
1801             X_Global_Attribute10,
1802             X_Global_Attribute11,
1803             X_Global_Attribute12,
1804             X_Global_Attribute13,
1805             X_Global_Attribute14,
1806             X_Global_Attribute15,
1807             X_Global_Attribute16,
1808             X_Global_Attribute17,
1809             X_Global_Attribute18,
1810             X_Global_Attribute19,
1811             X_Global_Attribute20,
1812             X_Global_Attribute_Category,
1813             X_MC_Source_Flag,
1814             X_Reval_YTD_Deprn_Flag,
1815             X_Allow_CIP_Assets_Flag,
1816             X_Org_ID,
1817             X_Allow_Group_Deprn_Flag,
1818             X_Allow_CIP_Dep_Group_Flag,
1819             X_Allow_Interco_Group_Flag,
1820             X_Copy_Group_Assignment_Flag,
1821             X_Copy_Group_Additon_Flag,
1822             X_Allow_CIP_Member_Flag,
1823             X_Allow_Member_Tracking_Flag,
1824             X_Intercompany_Posting_Flag,
1825             X_Backdated_Transfers_Flag,
1826             X_allow_cost_sign_change_flag
1827         );
1828      end if;
1829 
1830      X_Return_Status := TRUE;
1831 
1832   EXCEPTION
1833     when others then
1834         fa_srvr_msg.add_sql_error(
1835                 calling_fn => 'FA_BOOK_CONTROLS_PKG.Update_Row'
1836                 ,p_log_level_rec => p_log_level_rec);
1837 
1838         X_Return_Status := FALSE;
1839 
1840         raise;
1841 
1842   END Update_Row;
1843 
1844   PROCEDURE Delete_Row(X_Rowid                          VARCHAR2 DEFAULT NULL,
1845                        X_Book_Type_Code                 VARCHAR2 DEFAULT NULL,
1846                        X_MRC_SOB_Type_Code              VARCHAR2 DEFAULT 'P',
1847                        X_Calling_Fn                     VARCHAR2,
1848                        p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) AS
1849 
1850      l_book_type_code   varchar2(15);
1851      l_exists           number;
1852 
1853      del_error          exception;
1854      validation_error   exception;
1855 
1856   BEGIN
1857 
1858     if (X_Book_Type_Code is null) then
1859        if (X_Rowid is not null) then
1860           if (X_mrc_sob_type_code = 'R') then
1861              select book_type_code
1862              into   l_book_type_code
1863              from   fa_book_controls_mrc_v
1864              where  rowid = X_Rowid;
1865           else
1866              select book_type_code
1867              into   l_book_type_code
1868              from   fa_book_controls
1869              where  rowid = X_Rowid;
1870           end if;
1871        else
1872           raise del_error;
1873        end if;
1874     else
1875         l_book_type_code := X_Book_Type_Code;
1876     end if;
1877 
1878     if (X_mrc_sob_type_code = 'R') then
1879        begin
1880           select 1
1881           into   l_exists
1882           from   fa_books_mrc_v
1883           where  book_type_code = l_book_type_code;
1884        exception
1885           when no_data_found then
1886              l_exists := 0;
1887        end;
1888 
1889     else
1890        begin
1891           select 1
1892           into   l_exists
1893           from   fa_books_mrc_v
1894           where  book_type_code = l_book_type_code;
1895        exception
1896           when no_data_found then
1897              l_exists := 0;
1898        end;
1899     end if;
1900 
1901     if (l_exists <> 0) then
1902        raise validation_error;
1903     end if;
1904 
1905     if (X_mrc_sob_type_code = 'R') then
1906        DELETE FROM fa_deprn_periods_mrc_v
1907        WHERE  book_type_code = l_book_type_code;
1908 
1909        DELETE FROM fa_book_controls_mrc_v
1910        WHERE  book_type_code = l_book_type_code;
1911 
1912     else
1913        DELETE FROM fa_deprn_periods
1914        WHERE  book_type_code = l_book_type_code;
1915 
1916        DELETE FROM fa_book_controls
1917        WHERE  book_type_code = l_book_type_code;
1918 
1919        DELETE FROM fa_book_controls_history
1920        WHERE  book_type_code = l_book_type_code;
1921 
1922     end if;
1923 
1924   exception
1925     when validation_error then
1926       fa_srvr_msg.add_message (
1927           calling_fn => 'fa_book_controls_pkg.delete_row',
1928           name       => 'FA_SHARED_CANT_DEL_USED'
1929           ,p_log_level_rec => p_log_level_rec);
1930       FA_STANDARD_PKG.RAISE_ERROR(
1931           CALLED_FN => 'fa_book_controls_pkg.delete_row',
1932           CALLING_FN => X_Calling_Fn
1933           ,p_log_level_rec => p_log_level_rec);
1934     when del_error then
1935       FA_STANDARD_PKG.RAISE_ERROR(
1936           CALLED_FN => 'fa_book_controls_pkg.delete_row',
1937           CALLING_FN => X_Calling_Fn
1938           ,p_log_level_rec => p_log_level_rec);
1939     when others then
1940       FA_STANDARD_PKG.RAISE_ERROR(
1941           CALLED_FN => 'fa_book_controls_pkg.delete_row',
1942           CALLING_FN => X_Calling_Fn
1943           ,p_log_level_rec => p_log_level_rec);
1944   END Delete_Row;
1945 
1946 END FA_BOOK_CONTROLS_PKG;