DBA Data[Home] [Help]

PACKAGE BODY: APPS.GL_CODE_COMBINATIONS_PKG

Source


1 PACKAGE BODY GL_CODE_COMBINATIONS_PKG AS
2 /* $Header: gliccidb.pls 120.9 2005/07/01 05:19:41 agovil ship $ */
3 
4 
5   --
6   -- PUBLIC FUNCTIONS
7   --
8 
9 
10 
11 PROCEDURE select_row( recinfo IN OUT NOCOPY gl_code_combinations%ROWTYPE ) IS
12 BEGIN
13   SELECT *
14   INTO   recinfo
15   FROM   gl_code_combinations
16   WHERE  code_combination_id = recinfo.code_combination_id;
17 END select_row;
18 
19 -- **********************************************************************
20 
21 PROCEDURE select_columns(
22             X_code_combination_id                 NUMBER,
23             X_account_type                IN OUT NOCOPY  VARCHAR2,
24             X_template_id                 IN OUT NOCOPY  NUMBER ) IS
25   recinfo gl_code_combinations%ROWTYPE;
26 BEGIN
27   recinfo.code_combination_id := X_code_combination_id;
28   select_row(recinfo);
29   X_account_type := recinfo.account_type;
30   X_template_id := recinfo.template_id;
31 END select_columns;
32 
33 -- **********************************************************************
34 
35   PROCEDURE check_unique( x_rowid VARCHAR2,
36                           x_ccid  NUMBER ) IS
37     CURSOR c_dup IS
38       SELECT 'Duplicate'
39       FROM   gl_code_combinations cc
40       WHERE  cc.code_combination_id = x_ccid
41       AND    ( x_rowid is NULL
42                OR
43                cc.rowid <> x_rowid );
44     dummy VARCHAR2(100);
45 
46   BEGIN
47     OPEN  c_dup;
48     FETCH c_dup INTO dummy;
49 
50     IF c_dup%FOUND THEN
51       CLOSE c_dup;
52       fnd_message.set_name( 'SQLGL', 'GL_DUPLICATE_CCID' );
53       app_exception.raise_exception;
54     END IF;
55 
56     CLOSE c_dup;
57 
58   EXCEPTION
59     WHEN app_exceptions.application_exception THEN
60       RAISE;
61     WHEN OTHERS THEN
62       fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
63       fnd_message.set_token('PROCEDURE',
64         'GL_CODE_COMBINATIONS_PKG.check_unique');
65       RAISE;
66 
67   END check_unique;
68 
69 -- **********************************************************************
70 
71 PROCEDURE get_valid_sob_summary(
72               x_ccid                        NUMBER,
73               x_template_id         IN OUT NOCOPY  NUMBER,
74               x_ledger_id                   NUMBER ) IS
75 
76    new_ledger_id NUMBER(15);
77 
78  BEGIN
79 
80    SELECT st.ledger_id,
81           st.template_id
82    INTO   new_ledger_id,
83           x_template_id
84    FROM  gl_code_combinations cc,
85          gl_summary_templates st
86    WHERE cc.code_combination_id = x_ccid
87    AND   st.template_id(+) = cc.template_id;
88 
89    IF (new_ledger_id <> x_ledger_id) THEN
90      fnd_message.set_name( 'SQLGL', 'GL_INVALID_SUMMARY_ACCOUNT' );
91      app_exception.raise_exception;
92    END IF;
93 
94   EXCEPTION
95     WHEN app_exceptions.application_exception THEN
96       RAISE;
97     WHEN OTHERS THEN
98       fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
99       fnd_message.set_token('PROCEDURE',
100         'GL_CODE_COMBINATIONS_PKG.get_valid_sob_summary');
101       RAISE;
102 
103   END get_valid_sob_summary;
104 
105 -- **********************************************************************
106 
107 PROCEDURE Insert_Row(X_Rowid                        IN OUT NOCOPY VARCHAR2,
108                      X_Code_Combination_Id                 NUMBER,
109                      X_Alt_Code_Combination_Id             NUMBER,
110                      X_Last_Update_Date                    DATE,
111                      X_Last_Updated_By                     NUMBER,
112                      X_Chart_Of_Accounts_Id                NUMBER,
113                      X_Detail_Posting_F                    VARCHAR2,
114                      X_Detail_Budgeting_F                  VARCHAR2,
115                      X_Balanced_budgetF                    VARCHAR2,
116                      X_Account_Type                        VARCHAR2,
117                      X_Enabled_Flag                        VARCHAR2,
118                      X_Summary_Flag                        VARCHAR2,
119                      X_Segment1                            VARCHAR2,
120                      X_Segment2                            VARCHAR2,
121                      X_Segment3                            VARCHAR2,
122                      X_Segment4                            VARCHAR2,
123                      X_Segment5                            VARCHAR2,
124                      X_Segment6                            VARCHAR2,
125                      X_Segment7                            VARCHAR2,
126                      X_Segment8                            VARCHAR2,
127                      X_Segment9                            VARCHAR2,
128                      X_Segment10                           VARCHAR2,
129                      X_Segment11                           VARCHAR2,
130                      X_Segment12                           VARCHAR2,
131                      X_Segment13                           VARCHAR2,
132                      X_Segment14                           VARCHAR2,
133                      X_Segment15                           VARCHAR2,
134                      X_Segment16                           VARCHAR2,
135                      X_Segment17                           VARCHAR2,
136                      X_Segment18                           VARCHAR2,
137                      X_Segment19                           VARCHAR2,
138                      X_Segment20                           VARCHAR2,
139                      X_Segment21                           VARCHAR2,
140                      X_Segment22                           VARCHAR2,
141                      X_Segment23                           VARCHAR2,
142                      X_Segment24                           VARCHAR2,
143                      X_Segment25                           VARCHAR2,
144                      X_Segment26                           VARCHAR2,
145                      X_Segment27                           VARCHAR2,
146                      X_Segment28                           VARCHAR2,
147                      X_Segment29                           VARCHAR2,
148                      X_Segment30                           VARCHAR2,
149                      X_Description                         VARCHAR2,
150                      X_Template_Id                         NUMBER,
151                      X_Start_Date_Active                   DATE,
152                      X_End_Date_Active                     DATE,
153                      X_Attribute1                          VARCHAR2,
154                      X_Attribute2                          VARCHAR2,
155                      X_Attribute3                          VARCHAR2,
156                      X_Attribute4                          VARCHAR2,
157                      X_Attribute5                          VARCHAR2,
158                      X_Attribute6                          VARCHAR2,
159                      X_Attribute7                          VARCHAR2,
160                      X_Attribute8                          VARCHAR2,
161                      X_Attribute9                          VARCHAR2,
162                      X_Attribute10                         VARCHAR2,
163                      X_Context                             VARCHAR2,
164                      X_Segment_Attribute1                  VARCHAR2,
165                      X_Segment_Attribute2                  VARCHAR2,
166                      X_Segment_Attribute3                  VARCHAR2,
167                      X_Segment_Attribute4                  VARCHAR2,
168                      X_Segment_Attribute5                  VARCHAR2,
169                      X_Segment_Attribute6                  VARCHAR2,
170                      X_Segment_Attribute7                  VARCHAR2,
171                      X_Segment_Attribute8                  VARCHAR2,
172                      X_Segment_Attribute9                  VARCHAR2,
173                      X_Segment_Attribute10                 VARCHAR2,
174                      X_Segment_Attribute11                 VARCHAR2,
175                      X_Segment_Attribute12                 VARCHAR2,
176                      X_Segment_Attribute13                 VARCHAR2,
177                      X_Segment_Attribute14                 VARCHAR2,
178                      X_Segment_Attribute15                 VARCHAR2,
179                      X_Segment_Attribute16                 VARCHAR2,
180                      X_Segment_Attribute17                 VARCHAR2,
181                      X_Segment_Attribute18                 VARCHAR2,
182                      X_Segment_Attribute19                 VARCHAR2,
183                      X_Segment_Attribute20                 VARCHAR2,
184                      X_Segment_Attribute21                 VARCHAR2,
185                      X_Segment_Attribute22                 VARCHAR2,
186                      X_Segment_Attribute23                 VARCHAR2,
187                      X_Segment_Attribute24                 VARCHAR2,
188                      X_Segment_Attribute25                 VARCHAR2,
189                      X_Segment_Attribute26                 VARCHAR2,
190                      X_Segment_Attribute27                 VARCHAR2,
191                      X_Segment_Attribute28                 VARCHAR2,
192                      X_Segment_Attribute29                 VARCHAR2,
193                      X_Segment_Attribute30                 VARCHAR2,
194                      X_Segment_Attribute31                 VARCHAR2,
195                      X_Segment_Attribute32                 VARCHAR2,
196                      X_Segment_Attribute33                 VARCHAR2,
197                      X_Segment_Attribute34                 VARCHAR2,
198                      X_Segment_Attribute35                 VARCHAR2,
199                      X_Segment_Attribute36                 VARCHAR2,
200                      X_Segment_Attribute37                 VARCHAR2,
201                      X_Segment_Attribute38                 VARCHAR2,
202                      X_Segment_Attribute39                 VARCHAR2,
203                      X_Segment_Attribute40                 VARCHAR2,
204                      X_Segment_Attribute41                 VARCHAR2,
205                      X_Segment_Attribute42                 VARCHAR2,
206                      X_Jgzz_Recon_Context                  VARCHAR2,
207                      X_Jgzz_Recon_Flag                     VARCHAR2,
208                      X_reference1                          VARCHAR2,
209                      X_reference2                          VARCHAR2,
210                      X_reference3                          VARCHAR2,
211                      X_reference4                          VARCHAR2,
212                      X_reference5                          VARCHAR2,
213                      X_preserve_flag                       VARCHAR2,
214                      X_refresh_flag                        VARCHAR2
215  ) IS
216    CURSOR C IS SELECT rowid FROM gl_code_combinations
217 
218              WHERE code_combination_id = X_Code_Combination_Id;
219 
220 
221 
222 
223 
224 
225 BEGIN
226 
227 
228 
229 
230 
231 
232   INSERT INTO gl_code_combinations(
233           code_combination_id,
234           alternate_code_combination_id,
235           last_update_date,
236           last_updated_by,
237           chart_of_accounts_id,
238           detail_posting_allowed_flag,
239           detail_budgeting_allowed_flag,
240           igi_balanced_budget_flag,
241           account_type,
242           enabled_flag,
243           summary_flag,
244           segment1,
245           segment2,
246           segment3,
247           segment4,
248           segment5,
249           segment6,
250           segment7,
251           segment8,
252           segment9,
253           segment10,
254           segment11,
255           segment12,
256           segment13,
257           segment14,
258           segment15,
259           segment16,
260           segment17,
261           segment18,
262           segment19,
263           segment20,
264           segment21,
265           segment22,
266           segment23,
267           segment24,
268           segment25,
269           segment26,
270           segment27,
271           segment28,
272           segment29,
273           segment30,
274           description,
275           template_id,
276           start_date_active,
277           end_date_active,
278           attribute1,
279           attribute2,
280           attribute3,
281           attribute4,
282           attribute5,
283           attribute6,
284           attribute7,
285           attribute8,
286           attribute9,
287           attribute10,
288           context,
289           segment_attribute1,
290           segment_attribute2,
291           segment_attribute3,
292           segment_attribute4,
293           segment_attribute5,
294           segment_attribute6,
295           segment_attribute7,
296           segment_attribute8,
297           segment_attribute9,
298           segment_attribute10,
299           segment_attribute11,
300           segment_attribute12,
301           segment_attribute13,
302           segment_attribute14,
303           segment_attribute15,
304           segment_attribute16,
305           segment_attribute17,
306           segment_attribute18,
307           segment_attribute19,
308           segment_attribute20,
309           segment_attribute21,
310           segment_attribute22,
311           segment_attribute23,
312           segment_attribute24,
313           segment_attribute25,
314           segment_attribute26,
315           segment_attribute27,
316           segment_attribute28,
317           segment_attribute29,
318           segment_attribute30,
319           segment_attribute31,
320           segment_attribute32,
321           segment_attribute33,
322           segment_attribute34,
323           segment_attribute35,
324           segment_attribute36,
325           segment_attribute37,
326           segment_attribute38,
327           segment_attribute39,
328           segment_attribute40,
329           segment_attribute41,
330           segment_attribute42,
331           jgzz_recon_context,
332           jgzz_recon_flag,
333           reference1,
334           reference2,
335           reference3,
336           reference4,
337           reference5,
338           preserve_flag,
339           refresh_flag
340          ) VALUES (
341           X_Code_Combination_Id,
342           X_Alt_Code_Combination_Id,
343           X_Last_Update_Date,
344           X_Last_Updated_By,
345           X_Chart_Of_Accounts_Id,
346           X_Detail_Posting_F,
347           X_Detail_Budgeting_F,
348           X_Balanced_budgetF,
349           X_Account_Type,
350           X_Enabled_Flag,
351           X_Summary_Flag,
352           X_Segment1,
353           X_Segment2,
354           X_Segment3,
355           X_Segment4,
356           X_Segment5,
357           X_Segment6,
358           X_Segment7,
359           X_Segment8,
360           X_Segment9,
361           X_Segment10,
362           X_Segment11,
363           X_Segment12,
364           X_Segment13,
365           X_Segment14,
366           X_Segment15,
367           X_Segment16,
368           X_Segment17,
369           X_Segment18,
370           X_Segment19,
371           X_Segment20,
372           X_Segment21,
373           X_Segment22,
374           X_Segment23,
375           X_Segment24,
376           X_Segment25,
377           X_Segment26,
378           X_Segment27,
379           X_Segment28,
380           X_Segment29,
381           X_Segment30,
382           X_Description,
383           X_Template_Id,
384           X_Start_Date_Active,
385           X_End_Date_Active,
386           X_Attribute1,
387           X_Attribute2,
388           X_Attribute3,
389           X_Attribute4,
390           X_Attribute5,
391           X_Attribute6,
392           X_Attribute7,
393           X_Attribute8,
394           X_Attribute9,
395           X_Attribute10,
396           X_Context,
397           X_Segment_Attribute1,
398           X_Segment_Attribute2,
399           X_Segment_Attribute3,
400           X_Segment_Attribute4,
401           X_Segment_Attribute5,
402           X_Segment_Attribute6,
403           X_Segment_Attribute7,
404           X_Segment_Attribute8,
405           X_Segment_Attribute9,
406           X_Segment_Attribute10,
407           X_Segment_Attribute11,
408           X_Segment_Attribute12,
409           X_Segment_Attribute13,
410           X_Segment_Attribute14,
411           X_Segment_Attribute15,
412           X_Segment_Attribute16,
413           X_Segment_Attribute17,
414           X_Segment_Attribute18,
415           X_Segment_Attribute19,
416           X_Segment_Attribute20,
417           X_Segment_Attribute21,
418           X_Segment_Attribute22,
419           X_Segment_Attribute23,
420           X_Segment_Attribute24,
421           X_Segment_Attribute25,
422           X_Segment_Attribute26,
423           X_Segment_Attribute27,
424           X_Segment_Attribute28,
425           X_Segment_Attribute29,
426           X_Segment_Attribute30,
427           X_Segment_Attribute31,
428           X_Segment_Attribute32,
429           X_Segment_Attribute33,
430           X_Segment_Attribute34,
431           X_Segment_Attribute35,
432           X_Segment_Attribute36,
433           X_Segment_Attribute37,
434           X_Segment_Attribute38,
435           X_Segment_Attribute39,
436           X_Segment_Attribute40,
437           X_Segment_Attribute41,
438           X_Segment_Attribute42,
439           X_Jgzz_Recon_Context,
440           X_Jgzz_Recon_Flag,
441           X_reference1,
442           X_reference2,
443           X_reference3,
444           X_reference4,
445           X_reference5,
446           X_preserve_flag,
447           X_refresh_flag
448   );
449 
450   OPEN C;
451   FETCH C INTO X_Rowid;
452   if (C%NOTFOUND) then
453     CLOSE C;
454     RAISE NO_DATA_FOUND;
455   end if;
456   CLOSE C;
457 END Insert_Row;
458 
459 -- **********************************************************************
460 
461 PROCEDURE Lock_Row(X_Rowid                                 VARCHAR2,
462                    X_Code_Combination_Id                   NUMBER,
463                    X_Alt_Code_Combination_Id               NUMBER,
464                    X_Chart_Of_Accounts_Id                  NUMBER,
465                    X_Detail_Posting_F                      VARCHAR2,
466                    X_Detail_Budgeting_F                    VARCHAR2,
467                    X_Balanced_BudgetF                      VARCHAR2,
468                    X_Account_Type                          VARCHAR2,
469                    X_Enabled_Flag                          VARCHAR2,
470                    X_Summary_Flag                          VARCHAR2,
471                    X_Segment1                              VARCHAR2,
472                    X_Segment2                              VARCHAR2,
473                    X_Segment3                              VARCHAR2,
474                    X_Segment4                              VARCHAR2,
475                    X_Segment5                              VARCHAR2,
476                    X_Segment6                              VARCHAR2,
477                    X_Segment7                              VARCHAR2,
478                    X_Segment8                              VARCHAR2,
479                    X_Segment9                              VARCHAR2,
480                    X_Segment10                             VARCHAR2,
481                    X_Segment11                             VARCHAR2,
482                    X_Segment12                             VARCHAR2,
483                    X_Segment13                             VARCHAR2,
484                    X_Segment14                             VARCHAR2,
485                    X_Segment15                             VARCHAR2,
486                    X_Segment16                             VARCHAR2,
487                    X_Segment17                             VARCHAR2,
488                    X_Segment18                             VARCHAR2,
489                    X_Segment19                             VARCHAR2,
490                    X_Segment20                             VARCHAR2,
491                    X_Segment21                             VARCHAR2,
492                    X_Segment22                             VARCHAR2,
493                    X_Segment23                             VARCHAR2,
494                    X_Segment24                             VARCHAR2,
495                    X_Segment25                             VARCHAR2,
496                    X_Segment26                             VARCHAR2,
497                    X_Segment27                             VARCHAR2,
498                    X_Segment28                             VARCHAR2,
499                    X_Segment29                             VARCHAR2,
500                    X_Segment30                             VARCHAR2,
501                    X_Description                           VARCHAR2,
502                    X_Template_Id                           NUMBER,
503                    X_Start_Date_Active                     DATE,
504                    X_End_Date_Active                       DATE,
505                    X_Attribute1                            VARCHAR2,
506                    X_Attribute2                            VARCHAR2,
507                    X_Attribute3                            VARCHAR2,
508                    X_Attribute4                            VARCHAR2,
509                    X_Attribute5                            VARCHAR2,
510                    X_Attribute6                            VARCHAR2,
511                    X_Attribute7                            VARCHAR2,
512                    X_Attribute8                            VARCHAR2,
513                    X_Attribute9                            VARCHAR2,
514                    X_Attribute10                           VARCHAR2,
515                    X_Context                               VARCHAR2,
516                    X_Segment_Attribute1                    VARCHAR2,
517                    X_Segment_Attribute2                    VARCHAR2,
518                    X_Segment_Attribute3                    VARCHAR2,
519                    X_Segment_Attribute4                    VARCHAR2,
520                    X_Segment_Attribute5                    VARCHAR2,
521                    X_Segment_Attribute6                    VARCHAR2,
522                    X_Segment_Attribute7                    VARCHAR2,
523                    X_Segment_Attribute8                    VARCHAR2,
524                    X_Segment_Attribute9                    VARCHAR2,
525                    X_Segment_Attribute10                   VARCHAR2,
526                    X_Segment_Attribute11                   VARCHAR2,
527                    X_Segment_Attribute12                   VARCHAR2,
528                    X_Segment_Attribute13                   VARCHAR2,
529                    X_Segment_Attribute14                   VARCHAR2,
530                    X_Segment_Attribute15                   VARCHAR2,
531                    X_Segment_Attribute16                   VARCHAR2,
532                    X_Segment_Attribute17                   VARCHAR2,
533                    X_Segment_Attribute18                   VARCHAR2,
534                    X_Segment_Attribute19                   VARCHAR2,
535                    X_Segment_Attribute20                   VARCHAR2,
536                    X_Segment_Attribute21                   VARCHAR2,
537                    X_Segment_Attribute22                   VARCHAR2,
538                    X_Segment_Attribute23                   VARCHAR2,
539                    X_Segment_Attribute24                   VARCHAR2,
540                    X_Segment_Attribute25                   VARCHAR2,
541                    X_Segment_Attribute26                   VARCHAR2,
542                    X_Segment_Attribute27                   VARCHAR2,
543                    X_Segment_Attribute28                   VARCHAR2,
544                    X_Segment_Attribute29                   VARCHAR2,
545                    X_Segment_Attribute30                   VARCHAR2,
546                    X_Segment_Attribute31                   VARCHAR2,
547                    X_Segment_Attribute32                   VARCHAR2,
548                    X_Segment_Attribute33                   VARCHAR2,
549                    X_Segment_Attribute34                   VARCHAR2,
550                    X_Segment_Attribute35                   VARCHAR2,
551                    X_Segment_Attribute36                   VARCHAR2,
552                    X_Segment_Attribute37                   VARCHAR2,
553                    X_Segment_Attribute38                   VARCHAR2,
554                    X_Segment_Attribute39                   VARCHAR2,
555                    X_Segment_Attribute40                   VARCHAR2,
556                    X_Segment_Attribute41                   VARCHAR2,
557                    X_Segment_Attribute42                   VARCHAR2,
558                    X_Jgzz_Recon_Context                    VARCHAR2,
559                    X_Jgzz_Recon_Flag                       VARCHAR2,
560                    X_reference1                            VARCHAR2,
561                    X_reference2                            VARCHAR2,
562                    X_reference3                            VARCHAR2,
563                    X_reference4                            VARCHAR2,
564                    X_reference5                            VARCHAR2,
565                    X_preserve_flag                         VARCHAR2,
566                    X_refresh_flag                          VARCHAR2
567 ) IS
568   CURSOR C IS
569       SELECT *
570       FROM   gl_code_combinations
571       WHERE  rowid = X_Rowid
572       FOR UPDATE of Code_Combination_Id NOWAIT;
573   Recinfo C%ROWTYPE;
574 BEGIN
575   OPEN C;
576   FETCH C INTO Recinfo;
577   if (C%NOTFOUND) then
578     CLOSE C;
579     RAISE NO_DATA_FOUND;
580   end if;
581   CLOSE C;
582   if (
583           (   (Recinfo.code_combination_id = X_Code_Combination_Id)
584            OR (    (Recinfo.code_combination_id IS NULL)
585                AND (X_Code_Combination_Id IS NULL)))
586       AND (   (Recinfo.alternate_code_combination_id = X_Alt_Code_Combination_Id)
587            OR (    (Recinfo.alternate_code_combination_id IS NULL)
588                AND (X_Alt_Code_Combination_Id IS NULL)))
589       AND (   (Recinfo.chart_of_accounts_id = X_Chart_Of_Accounts_Id)
590            OR (    (Recinfo.chart_of_accounts_id IS NULL)
591                AND (X_Chart_Of_Accounts_Id IS NULL)))
592       AND (   (Recinfo.detail_posting_allowed_flag = X_Detail_Posting_F)
593            OR (    (Recinfo.detail_posting_allowed_flag IS NULL)
594                AND (X_Detail_Posting_F IS NULL)))
595       AND (   (Recinfo.detail_budgeting_allowed_flag = X_Detail_Budgeting_F)
596            OR (    (Recinfo.detail_budgeting_allowed_flag IS NULL)
597                AND (X_Detail_Budgeting_F IS NULL)))
598       AND (   (Recinfo.igi_balanced_budget_flag = X_Balanced_BudgetF)
599            OR (    (Recinfo.igi_balanced_budget_flag IS NULL)
600                AND (X_Balanced_BudgetF IS NULL)))
601       AND (   (Recinfo.account_type = X_Account_Type)
602            OR (    (Recinfo.account_type IS NULL)
603                AND (X_Account_Type IS NULL)))
604       AND (   (Recinfo.enabled_flag = X_Enabled_Flag)
605            OR (    (Recinfo.enabled_flag IS NULL)
606                AND (X_Enabled_Flag IS NULL)))
607       AND (   (Recinfo.summary_flag = X_Summary_Flag)
608            OR (    (Recinfo.summary_flag IS NULL)
609                AND (X_Summary_Flag IS NULL)))
610       AND (   (Recinfo.segment1 = X_Segment1)
611            OR (    (Recinfo.segment1 IS NULL)
612                AND (X_Segment1 IS NULL)))
613       AND (   (Recinfo.segment2 = X_Segment2)
614            OR (    (Recinfo.segment2 IS NULL)
615                AND (X_Segment2 IS NULL)))
616       AND (   (Recinfo.segment3 = X_Segment3)
617            OR (    (Recinfo.segment3 IS NULL)
618                AND (X_Segment3 IS NULL)))
619       AND (   (Recinfo.segment4 = X_Segment4)
620            OR (    (Recinfo.segment4 IS NULL)
621                AND (X_Segment4 IS NULL)))
622       AND (   (Recinfo.segment5 = X_Segment5)
623            OR (    (Recinfo.segment5 IS NULL)
624                AND (X_Segment5 IS NULL)))
625       AND (   (Recinfo.segment6 = X_Segment6)
626            OR (    (Recinfo.segment6 IS NULL)
627                AND (X_Segment6 IS NULL)))
628       AND (   (Recinfo.segment7 = X_Segment7)
629            OR (    (Recinfo.segment7 IS NULL)
630                AND (X_Segment7 IS NULL)))
631       AND (   (Recinfo.segment8 = X_Segment8)
632            OR (    (Recinfo.segment8 IS NULL)
633                AND (X_Segment8 IS NULL)))
634       AND (   (Recinfo.segment9 = X_Segment9)
635            OR (    (Recinfo.segment9 IS NULL)
636                AND (X_Segment9 IS NULL)))
637       AND (   (Recinfo.segment10 = X_Segment10)
638            OR (    (Recinfo.segment10 IS NULL)
639                AND (X_Segment10 IS NULL)))
640       AND (   (Recinfo.segment11 = X_Segment11)
641            OR (    (Recinfo.segment11 IS NULL)
642                AND (X_Segment11 IS NULL)))
643       AND (   (Recinfo.segment12 = X_Segment12)
644            OR (    (Recinfo.segment12 IS NULL)
645                AND (X_Segment12 IS NULL)))
646       AND (   (Recinfo.segment13 = X_Segment13)
647            OR (    (Recinfo.segment13 IS NULL)
648                AND (X_Segment13 IS NULL)))
649       AND (   (Recinfo.segment14 = X_Segment14)
650            OR (    (Recinfo.segment14 IS NULL)
651                AND (X_Segment14 IS NULL)))
652       AND (   (Recinfo.segment15 = X_Segment15)
653            OR (    (Recinfo.segment15 IS NULL)
654                AND (X_Segment15 IS NULL)))
655       AND (   (Recinfo.segment16 = X_Segment16)
656            OR (    (Recinfo.segment16 IS NULL)
657                AND (X_Segment16 IS NULL)))
658       AND (   (Recinfo.segment17 = X_Segment17)
659            OR (    (Recinfo.segment17 IS NULL)
660                AND (X_Segment17 IS NULL)))
661       AND (   (Recinfo.segment18 = X_Segment18)
662            OR (    (Recinfo.segment18 IS NULL)
663                AND (X_Segment18 IS NULL)))
664       AND (   (Recinfo.segment19 = X_Segment19)
665            OR (    (Recinfo.segment19 IS NULL)
666                AND (X_Segment19 IS NULL)))
667       AND (   (Recinfo.segment20 = X_Segment20)
668            OR (    (Recinfo.segment20 IS NULL)
669                AND (X_Segment20 IS NULL)))
670       AND (   (Recinfo.segment21 = X_Segment21)
671            OR (    (Recinfo.segment21 IS NULL)
672                AND (X_Segment21 IS NULL)))
673       AND (   (Recinfo.segment22 = X_Segment22)
674            OR (    (Recinfo.segment22 IS NULL)
675                AND (X_Segment22 IS NULL)))
676       AND (   (Recinfo.segment23 = X_Segment23)
677            OR (    (Recinfo.segment23 IS NULL)
678                AND (X_Segment23 IS NULL)))
679       AND (   (Recinfo.segment24 = X_Segment24)
680            OR (    (Recinfo.segment24 IS NULL)
681                AND (X_Segment24 IS NULL)))
682       AND (   (Recinfo.segment25 = X_Segment25)
683            OR (    (Recinfo.segment25 IS NULL)
684                AND (X_Segment25 IS NULL)))
685       AND (   (Recinfo.segment26 = X_Segment26)
686            OR (    (Recinfo.segment26 IS NULL)
687                AND (X_Segment26 IS NULL)))) THEN
688 
689    if (
690       (   (Recinfo.segment27 = X_Segment27)
691            OR (    (Recinfo.segment27 IS NULL)
692                AND (X_Segment27 IS NULL)))
693       AND (   (Recinfo.segment28 = X_Segment28)
694            OR (    (Recinfo.segment28 IS NULL)
695                AND (X_Segment28 IS NULL)))
696       AND (   (Recinfo.segment29 = X_Segment29)
697            OR (    (Recinfo.segment29 IS NULL)
698                AND (X_Segment29 IS NULL)))
699       AND (   (Recinfo.segment30 = X_Segment30)
700            OR (    (Recinfo.segment30 IS NULL)
701                AND (X_Segment30 IS NULL)))
702       AND (   (Recinfo.description = X_Description)
703            OR (    (Recinfo.description IS NULL)
704                AND (X_Description IS NULL)))
705       AND (   (Recinfo.template_id = X_Template_Id)
706            OR (    (Recinfo.template_id IS NULL)
707                AND (X_Template_Id IS NULL)))
708       AND (   (Recinfo.start_date_active = X_Start_Date_Active)
709            OR (    (Recinfo.start_date_active IS NULL)
710                AND (X_Start_Date_Active IS NULL)))
711       AND (   (Recinfo.end_date_active = X_End_Date_Active)
712            OR (    (Recinfo.end_date_active IS NULL)
713                AND (X_End_Date_Active IS NULL)))
714       AND (   (Recinfo.attribute1 = X_Attribute1)
715            OR (    (Recinfo.attribute1 IS NULL)
716                AND (X_Attribute1 IS NULL)))
717       AND (   (Recinfo.attribute2 = X_Attribute2)
718            OR (    (Recinfo.attribute2 IS NULL)
719                AND (X_Attribute2 IS NULL)))
720       AND (   (Recinfo.attribute3 = X_Attribute3)
721            OR (    (Recinfo.attribute3 IS NULL)
722                AND (X_Attribute3 IS NULL)))
723       AND (   (Recinfo.attribute4 = X_Attribute4)
724            OR (    (Recinfo.attribute4 IS NULL)
725                AND (X_Attribute4 IS NULL)))
726       AND (   (Recinfo.attribute5 = X_Attribute5)
727            OR (    (Recinfo.attribute5 IS NULL)
728                AND (X_Attribute5 IS NULL)))
729       AND (   (Recinfo.attribute6 = X_Attribute6)
730            OR (    (Recinfo.attribute6 IS NULL)
731                AND (X_Attribute6 IS NULL)))
732       AND (   (Recinfo.attribute7 = X_Attribute7)
733            OR (    (Recinfo.attribute7 IS NULL)
734                AND (X_Attribute7 IS NULL)))
735       AND (   (Recinfo.attribute8 = X_Attribute8)
736            OR (    (Recinfo.attribute8 IS NULL)
737                AND (X_Attribute8 IS NULL)))
738       AND (   (Recinfo.attribute9 = X_Attribute9)
739            OR (    (Recinfo.attribute9 IS NULL)
740                AND (X_Attribute9 IS NULL)))
741       AND (   (Recinfo.attribute10 = X_Attribute10)
742            OR (    (Recinfo.attribute10 IS NULL)
743                AND (X_Attribute10 IS NULL)))
744       AND (   (Recinfo.context = X_Context)
745            OR (    (Recinfo.context IS NULL)
746                AND (X_Context IS NULL)))
747       AND (   (Recinfo.segment_attribute1 = X_Segment_Attribute1)
748            OR (    (Recinfo.segment_attribute1 IS NULL)
749                AND (X_Segment_Attribute1 IS NULL)))
750       AND (   (Recinfo.segment_attribute2 = X_Segment_Attribute2)
751            OR (    (Recinfo.segment_attribute2 IS NULL)
752                AND (X_Segment_Attribute2 IS NULL)))
753       AND (   (Recinfo.segment_attribute3 = X_Segment_Attribute3)
754            OR (    (Recinfo.segment_attribute3 IS NULL)
755                AND (X_Segment_Attribute3 IS NULL)))
756       AND (   (Recinfo.segment_attribute4 = X_Segment_Attribute4)
757            OR (    (Recinfo.segment_attribute4 IS NULL)
758                AND (X_Segment_Attribute4 IS NULL)))
759       AND (   (Recinfo.segment_attribute5 = X_Segment_Attribute5)
760            OR (    (Recinfo.segment_attribute5 IS NULL)
761                AND (X_Segment_Attribute5 IS NULL)))
762       AND (   (Recinfo.segment_attribute6 = X_Segment_Attribute6)
763            OR (    (Recinfo.segment_attribute6 IS NULL)
764                AND (X_Segment_Attribute6 IS NULL)))
765       AND (   (Recinfo.segment_attribute7 = X_Segment_Attribute7)
766            OR (    (Recinfo.segment_attribute7 IS NULL)
767                AND (X_Segment_Attribute7 IS NULL)))
768       AND (   (Recinfo.segment_attribute8 = X_Segment_Attribute8)
769            OR (    (Recinfo.segment_attribute8 IS NULL)
770                AND (X_Segment_Attribute8 IS NULL)))
771       AND (   (Recinfo.segment_attribute9 = X_Segment_Attribute9)
772            OR (    (Recinfo.segment_attribute9 IS NULL)
773                AND (X_Segment_Attribute9 IS NULL)))
774       AND (   (Recinfo.segment_attribute10 = X_Segment_Attribute10)
775            OR (    (Recinfo.segment_attribute10 IS NULL)
776                AND (X_Segment_Attribute10 IS NULL)))
777       AND (   (Recinfo.segment_attribute11 = X_Segment_Attribute11)
778            OR (    (Recinfo.segment_attribute11 IS NULL)
779                AND (X_Segment_Attribute11 IS NULL)))
780       AND (   (Recinfo.segment_attribute12 = X_Segment_Attribute12)
781            OR (    (Recinfo.segment_attribute12 IS NULL)
782                AND (X_Segment_Attribute12 IS NULL)))
783       AND (   (Recinfo.segment_attribute13 = X_Segment_Attribute13)
784            OR (    (Recinfo.segment_attribute13 IS NULL)
785                AND (X_Segment_Attribute13 IS NULL)))) THEN
786 
787      if (
788       (   (Recinfo.segment_attribute14 = X_Segment_Attribute14)
789            OR (    (Recinfo.segment_attribute14 IS NULL)
790                AND (X_Segment_Attribute14 IS NULL)))
791       AND (   (Recinfo.segment_attribute15 = X_Segment_Attribute15)
792            OR (    (Recinfo.segment_attribute15 IS NULL)
793                AND (X_Segment_Attribute15 IS NULL)))
794       AND (   (Recinfo.segment_attribute16 = X_Segment_Attribute16)
795            OR (    (Recinfo.segment_attribute16 IS NULL)
796                AND (X_Segment_Attribute16 IS NULL)))
797       AND (   (Recinfo.segment_attribute17 = X_Segment_Attribute17)
798            OR (    (Recinfo.segment_attribute17 IS NULL)
799                AND (X_Segment_Attribute17 IS NULL)))
800       AND (   (Recinfo.segment_attribute18 = X_Segment_Attribute18)
801            OR (    (Recinfo.segment_attribute18 IS NULL)
802                AND (X_Segment_Attribute18 IS NULL)))
803       AND (   (Recinfo.segment_attribute19 = X_Segment_Attribute19)
804            OR (    (Recinfo.segment_attribute19 IS NULL)
805                AND (X_Segment_Attribute19 IS NULL)))
806       AND (   (Recinfo.segment_attribute20 = X_Segment_Attribute20)
807            OR (    (Recinfo.segment_attribute20 IS NULL)
808                AND (X_Segment_Attribute20 IS NULL)))
809       AND (   (Recinfo.segment_attribute21 = X_Segment_Attribute21)
810            OR (    (Recinfo.segment_attribute21 IS NULL)
811                AND (X_Segment_Attribute21 IS NULL)))
812       AND (   (Recinfo.segment_attribute22 = X_Segment_Attribute22)
813            OR (    (Recinfo.segment_attribute22 IS NULL)
814                AND (X_Segment_Attribute22 IS NULL)))
815       AND (   (Recinfo.segment_attribute23 = X_Segment_Attribute23)
816            OR (    (Recinfo.segment_attribute23 IS NULL)
817                AND (X_Segment_Attribute23 IS NULL)))
818       AND (   (Recinfo.segment_attribute24 = X_Segment_Attribute24)
819            OR (    (Recinfo.segment_attribute24 IS NULL)
820                AND (X_Segment_Attribute24 IS NULL)))
821       AND (   (Recinfo.segment_attribute25 = X_Segment_Attribute25)
822            OR (    (Recinfo.segment_attribute25 IS NULL)
823                AND (X_Segment_Attribute25 IS NULL)))
824       AND (   (Recinfo.segment_attribute26 = X_Segment_Attribute26)
825            OR (    (Recinfo.segment_attribute26 IS NULL)
826                AND (X_Segment_Attribute26 IS NULL)))
827       AND (   (Recinfo.segment_attribute27 = X_Segment_Attribute27)
828            OR (    (Recinfo.segment_attribute27 IS NULL)
829                AND (X_Segment_Attribute27 IS NULL)))
830       AND (   (Recinfo.segment_attribute28 = X_Segment_Attribute28)
831            OR (    (Recinfo.segment_attribute28 IS NULL)
832                AND (X_Segment_Attribute28 IS NULL)))
833       AND (   (Recinfo.segment_attribute29 = X_Segment_Attribute29)
834            OR (    (Recinfo.segment_attribute29 IS NULL)
835                AND (X_Segment_Attribute29 IS NULL)))
836       AND (   (Recinfo.segment_attribute30 = X_Segment_Attribute30)
837            OR (    (Recinfo.segment_attribute30 IS NULL)
838                AND (X_Segment_Attribute30 IS NULL)))
839       AND (   (Recinfo.segment_attribute31 = X_Segment_Attribute31)
840            OR (    (Recinfo.segment_attribute31 IS NULL)
841                AND (X_Segment_Attribute31 IS NULL)))
842       AND (   (Recinfo.segment_attribute32 = X_Segment_Attribute32)
843            OR (    (Recinfo.segment_attribute32 IS NULL)
844                AND (X_Segment_Attribute32 IS NULL)))
845       AND (   (Recinfo.segment_attribute33 = X_Segment_Attribute33)
846            OR (    (Recinfo.segment_attribute33 IS NULL)
847                AND (X_Segment_Attribute33 IS NULL)))
848       AND (   (Recinfo.segment_attribute34 = X_Segment_Attribute34)
849            OR (    (Recinfo.segment_attribute34 IS NULL)
850                AND (X_Segment_Attribute34 IS NULL)))
851       AND (   (Recinfo.segment_attribute35 = X_Segment_Attribute35)
852            OR (    (Recinfo.segment_attribute35 IS NULL)
853                AND (X_Segment_Attribute35 IS NULL)))
854       AND (   (Recinfo.segment_attribute36 = X_Segment_Attribute36)
855            OR (    (Recinfo.segment_attribute36 IS NULL)
856                AND (X_Segment_Attribute36 IS NULL)))
857       AND (   (Recinfo.segment_attribute37 = X_Segment_Attribute37)
858            OR (    (Recinfo.segment_attribute37 IS NULL)
859                AND (X_Segment_Attribute37 IS NULL)))
860       AND (   (Recinfo.segment_attribute38 = X_Segment_Attribute38)
861            OR (    (Recinfo.segment_attribute38 IS NULL)
862                AND (X_Segment_Attribute38 IS NULL)))
863       AND (   (Recinfo.segment_attribute39 = X_Segment_Attribute39)
864            OR (    (Recinfo.segment_attribute39 IS NULL)
865                AND (X_Segment_Attribute39 IS NULL)))
866       AND (   (Recinfo.segment_attribute40 = X_Segment_Attribute40)
867            OR (    (Recinfo.segment_attribute40 IS NULL)
868                AND (X_Segment_Attribute40 IS NULL)))
869       AND (   (Recinfo.segment_attribute41 = X_Segment_Attribute41)
870            OR (    (Recinfo.segment_attribute41 IS NULL)
871                AND (X_Segment_Attribute41 IS NULL)))
872       AND (   (Recinfo.segment_attribute42 = X_Segment_Attribute42)
873            OR (    (Recinfo.segment_attribute42 IS NULL)
874                AND (X_Segment_Attribute42 IS NULL)))
875       AND (   (Recinfo.jgzz_recon_context = X_Jgzz_Recon_Context)
876            OR (    (Recinfo.jgzz_recon_context IS NULL)
877                AND (X_Jgzz_Recon_Context IS NULL)))
878       AND (   (Recinfo.jgzz_recon_flag = X_Jgzz_Recon_Flag)
879            OR (    (Recinfo.jgzz_recon_flag IS NULL)
880                AND (X_Jgzz_Recon_Flag IS NULL)))
881       AND (   (Recinfo.reference1 = X_reference1)
882            OR (    (Recinfo.reference1 IS NULL)
883                AND (X_reference1 IS NULL)))
884       AND (   (Recinfo.reference2 = X_reference2)
885            OR (    (Recinfo.reference2 IS NULL)
886                AND (X_reference2 IS NULL)))
887       AND (   (Recinfo.reference3 = X_reference3)
888            OR (    (Recinfo.reference3 IS NULL)
889                AND (X_reference3 IS NULL)))
890       AND (   (Recinfo.reference4 = X_reference4)
891            OR (    (Recinfo.reference4 IS NULL)
892                AND (X_reference4 IS NULL)))
893       AND (   (Recinfo.reference5 = X_reference5)
894            OR (    (Recinfo.reference5 IS NULL)
895                AND (X_reference5 IS NULL)))
896       AND (   (Recinfo.preserve_flag = X_preserve_flag)
897            OR (    (Recinfo.preserve_flag IS NULL)
898                AND (X_preserve_flag IS NULL)))
899       AND (   (Recinfo.refresh_flag = X_refresh_flag)
900            OR (    (Recinfo.refresh_flag IS NULL)
901                AND (X_refresh_flag IS NULL)))
902            ) THEN
903         -- Record has not changed.
904         return;
905       end if;
906     end if;
907   end if;
908 
909   -- Record has been changed.
910   FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
911   APP_EXCEPTION.RAISE_EXCEPTION;
912 
913 END Lock_Row;
914 
915 -- **********************************************************************
916 
917 PROCEDURE Update_Row(X_Rowid                               VARCHAR2,
918                      X_Code_Combination_Id                 NUMBER,
919                      X_Alt_Code_Combination_Id             NUMBER,
920                      X_Last_Update_Date                    DATE,
921                      X_Last_Updated_By                     NUMBER,
922                      X_Chart_Of_Accounts_Id                NUMBER,
923                      X_Detail_Posting_F                    VARCHAR2,
924                      X_Detail_Budgeting_F                  VARCHAR2,
925                      X_Balanced_BudgetF                    VARCHAR2,
926                      X_Account_Type                        VARCHAR2,
927                      X_Enabled_Flag                        VARCHAR2,
928                      X_Summary_Flag                        VARCHAR2,
929                      X_Segment1                            VARCHAR2,
930                      X_Segment2                            VARCHAR2,
931                      X_Segment3                            VARCHAR2,
932                      X_Segment4                            VARCHAR2,
933                      X_Segment5                            VARCHAR2,
934                      X_Segment6                            VARCHAR2,
935                      X_Segment7                            VARCHAR2,
936                      X_Segment8                            VARCHAR2,
937                      X_Segment9                            VARCHAR2,
938                      X_Segment10                           VARCHAR2,
939                      X_Segment11                           VARCHAR2,
940                      X_Segment12                           VARCHAR2,
941                      X_Segment13                           VARCHAR2,
942                      X_Segment14                           VARCHAR2,
943                      X_Segment15                           VARCHAR2,
944                      X_Segment16                           VARCHAR2,
945                      X_Segment17                           VARCHAR2,
946                      X_Segment18                           VARCHAR2,
947                      X_Segment19                           VARCHAR2,
948                      X_Segment20                           VARCHAR2,
949                      X_Segment21                           VARCHAR2,
950                      X_Segment22                           VARCHAR2,
951                      X_Segment23                           VARCHAR2,
952                      X_Segment24                           VARCHAR2,
953                      X_Segment25                           VARCHAR2,
954                      X_Segment26                           VARCHAR2,
955                      X_Segment27                           VARCHAR2,
956                      X_Segment28                           VARCHAR2,
957                      X_Segment29                           VARCHAR2,
958                      X_Segment30                           VARCHAR2,
959                      X_Description                         VARCHAR2,
960                      X_Template_Id                         NUMBER,
961                      X_Start_Date_Active                   DATE,
962                      X_End_Date_Active                     DATE,
963                      X_Attribute1                          VARCHAR2,
964                      X_Attribute2                          VARCHAR2,
965                      X_Attribute3                          VARCHAR2,
966                      X_Attribute4                          VARCHAR2,
967                      X_Attribute5                          VARCHAR2,
968                      X_Attribute6                          VARCHAR2,
969                      X_Attribute7                          VARCHAR2,
970                      X_Attribute8                          VARCHAR2,
971                      X_Attribute9                          VARCHAR2,
972                      X_Attribute10                         VARCHAR2,
973                      X_Context                             VARCHAR2,
974                      X_Segment_Attribute1                  VARCHAR2,
975                      X_Segment_Attribute2                  VARCHAR2,
976                      X_Segment_Attribute3                  VARCHAR2,
977                      X_Segment_Attribute4                  VARCHAR2,
978                      X_Segment_Attribute5                  VARCHAR2,
979                      X_Segment_Attribute6                  VARCHAR2,
980                      X_Segment_Attribute7                  VARCHAR2,
981                      X_Segment_Attribute8                  VARCHAR2,
982                      X_Segment_Attribute9                  VARCHAR2,
983                      X_Segment_Attribute10                 VARCHAR2,
984                      X_Segment_Attribute11                 VARCHAR2,
985                      X_Segment_Attribute12                 VARCHAR2,
986                      X_Segment_Attribute13                 VARCHAR2,
987                      X_Segment_Attribute14                 VARCHAR2,
988                      X_Segment_Attribute15                 VARCHAR2,
989                      X_Segment_Attribute16                 VARCHAR2,
990                      X_Segment_Attribute17                 VARCHAR2,
991                      X_Segment_Attribute18                 VARCHAR2,
992                      X_Segment_Attribute19                 VARCHAR2,
993                      X_Segment_Attribute20                 VARCHAR2,
994                      X_Segment_Attribute21                 VARCHAR2,
995                      X_Segment_Attribute22                 VARCHAR2,
996                      X_Segment_Attribute23                 VARCHAR2,
997                      X_Segment_Attribute24                 VARCHAR2,
998                      X_Segment_Attribute25                 VARCHAR2,
999                      X_Segment_Attribute26                 VARCHAR2,
1000                      X_Segment_Attribute27                 VARCHAR2,
1001                      X_Segment_Attribute28                 VARCHAR2,
1002                      X_Segment_Attribute29                 VARCHAR2,
1003                      X_Segment_Attribute30                 VARCHAR2,
1004                      X_Segment_Attribute31                 VARCHAR2,
1005                      X_Segment_Attribute32                 VARCHAR2,
1006                      X_Segment_Attribute33                 VARCHAR2,
1007                      X_Segment_Attribute34                 VARCHAR2,
1008                      X_Segment_Attribute35                 VARCHAR2,
1009                      X_Segment_Attribute36                 VARCHAR2,
1010                      X_Segment_Attribute37                 VARCHAR2,
1011                      X_Segment_Attribute38                 VARCHAR2,
1012                      X_Segment_Attribute39                 VARCHAR2,
1013                      X_Segment_Attribute40                 VARCHAR2,
1014                      X_Segment_Attribute41                 VARCHAR2,
1015                      X_Segment_Attribute42                 VARCHAR2,
1016                      X_Jgzz_Recon_Context                  VARCHAR2,
1017                      X_Jgzz_Recon_Flag                     VARCHAR2,
1018                      X_reference1                          VARCHAR2,
1019                      X_reference2                          VARCHAR2,
1020                      X_reference3                          VARCHAR2,
1021                      X_reference4                          VARCHAR2,
1022                      X_reference5                          VARCHAR2,
1023                      X_preserve_flag                       VARCHAR2,
1024                      X_refresh_flag                        VARCHAR2
1025  ) IS
1026   old_enabled_flag VARCHAR2(1);
1027   ekey             VARCHAR2(100);
1028   edata            VARCHAR2(200);
1029   edataclob        CLOB;
1030 BEGIN
1031   /* Check to see if account has been disabled */
1032   IF (X_enabled_flag = 'N') THEN
1033     SELECT enabled_flag
1034     INTO old_enabled_flag
1035     FROM gl_code_combinations
1036     WHERE rowid = X_rowid;
1037 
1038     IF (old_enabled_flag = 'Y') THEN
1039       /*
1040        + Account has been disabled, so raise event
1041        */
1042 
1043       /* Get event key */
1044       SELECT to_char(x_chart_of_accounts_id)||':'||
1045              to_char(sysdate, 'RRDDDSSSSS')||':'||
1046              to_char(x_code_combination_id)
1047       INTO ekey
1048       FROM dual;
1049 
1050       /* Raise the disabled account event */
1051       IF (gl_business_events.test(
1052             'oracle.apps.gl.Maintenance.account.disable') = 'MESSAGE') THEN
1053 
1054         edata := '<?xml version="1.0"?> '||
1055                  '<DisabledAccounts> ' ||
1056                  '<CODE_COMBINATION_ID> '||
1057                  to_char(x_code_combination_id) ||
1058                  '</CODE_COMBINATION_ID> ' ||
1059                  '</DisabledAccounts> ';
1060 
1061         dbms_lob.createtemporary(edataclob, FALSE, DBMS_LOB.CALL);
1062         dbms_lob.write(edataclob, length(edata), 1, edata);
1063 
1064         gl_business_events.raise(
1065           p_event_name => 'oracle.apps.gl.Maintenance.account.disable',
1066           p_event_key => ekey,
1067           p_event_data => edataclob);
1068       ELSE
1069         gl_business_events.raise(
1070           p_event_name => 'oracle.apps.gl.Maintenance.account.disable',
1071           p_event_key => ekey);
1072       END IF;
1073     END IF;
1074   END IF;
1075 
1076 
1077   UPDATE gl_code_combinations
1078   SET
1079 
1080     code_combination_id                       =    X_Code_Combination_Id,
1081     alternate_code_combination_id             =    X_Alt_Code_Combination_Id,
1082     last_update_date                          =    X_Last_Update_Date,
1083     last_updated_by                           =    X_Last_Updated_By,
1084     chart_of_accounts_id                      =    X_Chart_Of_Accounts_Id,
1085     detail_posting_allowed_flag               =    X_Detail_Posting_F,
1086     detail_budgeting_allowed_flag             =    X_Detail_Budgeting_F,
1087     igi_balanced_budget_flag                  =    X_Balanced_BudgetF,
1088     account_type                              =    X_Account_Type,
1089     enabled_flag                              =    X_Enabled_Flag,
1090     summary_flag                              =    X_Summary_Flag,
1091     segment1                                  =    X_Segment1,
1092     segment2                                  =    X_Segment2,
1093     segment3                                  =    X_Segment3,
1094     segment4                                  =    X_Segment4,
1095     segment5                                  =    X_Segment5,
1096     segment6                                  =    X_Segment6,
1097     segment7                                  =    X_Segment7,
1098     segment8                                  =    X_Segment8,
1099     segment9                                  =    X_Segment9,
1100     segment10                                 =    X_Segment10,
1101     segment11                                 =    X_Segment11,
1102     segment12                                 =    X_Segment12,
1103     segment13                                 =    X_Segment13,
1104     segment14                                 =    X_Segment14,
1105     segment15                                 =    X_Segment15,
1106     segment16                                 =    X_Segment16,
1107     segment17                                 =    X_Segment17,
1108     segment18                                 =    X_Segment18,
1109     segment19                                 =    X_Segment19,
1110     segment20                                 =    X_Segment20,
1111     segment21                                 =    X_Segment21,
1112     segment22                                 =    X_Segment22,
1113     segment23                                 =    X_Segment23,
1114     segment24                                 =    X_Segment24,
1115     segment25                                 =    X_Segment25,
1116     segment26                                 =    X_Segment26,
1117     segment27                                 =    X_Segment27,
1118     segment28                                 =    X_Segment28,
1119     segment29                                 =    X_Segment29,
1120     segment30                                 =    X_Segment30,
1121     description                               =    X_Description,
1122     template_id                               =    X_Template_Id,
1123     start_date_active                         =    X_Start_Date_Active,
1124     end_date_active                           =    X_End_Date_Active,
1125     attribute1                                =    X_Attribute1,
1126     attribute2                                =    X_Attribute2,
1127     attribute3                                =    X_Attribute3,
1128     attribute4                                =    X_Attribute4,
1129     attribute5                                =    X_Attribute5,
1130     attribute6                                =    X_Attribute6,
1131     attribute7                                =    X_Attribute7,
1132     attribute8                                =    X_Attribute8,
1133     attribute9                                =    X_Attribute9,
1134     attribute10                               =    X_Attribute10,
1135     context                                   =    X_Context,
1136     segment_attribute1                        =    X_Segment_Attribute1,
1137     segment_attribute2                        =    X_Segment_Attribute2,
1138     segment_attribute3                        =    X_Segment_Attribute3,
1139     segment_attribute4                        =    X_Segment_Attribute4,
1140     segment_attribute5                        =    X_Segment_Attribute5,
1141     segment_attribute6                        =    X_Segment_Attribute6,
1142     segment_attribute7                        =    X_Segment_Attribute7,
1143     segment_attribute8                        =    X_Segment_Attribute8,
1144     segment_attribute9                        =    X_Segment_Attribute9,
1145     segment_attribute10                       =    X_Segment_Attribute10,
1146     segment_attribute11                       =    X_Segment_Attribute11,
1147     segment_attribute12                       =    X_Segment_Attribute12,
1148     segment_attribute13                       =    X_Segment_Attribute13,
1149     segment_attribute14                       =    X_Segment_Attribute14,
1150     segment_attribute15                       =    X_Segment_Attribute15,
1151     segment_attribute16                       =    X_Segment_Attribute16,
1152     segment_attribute17                       =    X_Segment_Attribute17,
1153     segment_attribute18                       =    X_Segment_Attribute18,
1154     segment_attribute19                       =    X_Segment_Attribute19,
1155     segment_attribute20                       =    X_Segment_Attribute20,
1156     segment_attribute21                       =    X_Segment_Attribute21,
1157     segment_attribute22                       =    X_Segment_Attribute22,
1158     segment_attribute23                       =    X_Segment_Attribute23,
1159     segment_attribute24                       =    X_Segment_Attribute24,
1160     segment_attribute25                       =    X_Segment_Attribute25,
1161     segment_attribute26                       =    X_Segment_Attribute26,
1162     segment_attribute27                       =    X_Segment_Attribute27,
1163     segment_attribute28                       =    X_Segment_Attribute28,
1164     segment_attribute29                       =    X_Segment_Attribute29,
1165     segment_attribute30                       =    X_Segment_Attribute30,
1166     segment_attribute31                       =    X_Segment_Attribute31,
1167     segment_attribute32                       =    X_Segment_Attribute32,
1168     segment_attribute33                       =    X_Segment_Attribute33,
1169     segment_attribute34                       =    X_Segment_Attribute34,
1170     segment_attribute35                       =    X_Segment_Attribute35,
1171     segment_attribute36                       =    X_Segment_Attribute36,
1172     segment_attribute37                       =    X_Segment_Attribute37,
1173     segment_attribute38                       =    X_Segment_Attribute38,
1174     segment_attribute39                       =    X_Segment_Attribute39,
1175     segment_attribute40                       =    X_Segment_Attribute40,
1176     segment_attribute41                       =    X_Segment_Attribute41,
1177     segment_attribute42                       =    X_Segment_Attribute42,
1178     jgzz_recon_context                        =    X_Jgzz_Recon_Context,
1179     jgzz_recon_flag                           =    X_Jgzz_Recon_Flag,
1180     reference1                                =    X_reference1,
1181     reference2                                =    X_reference2,
1182     reference3                                =    X_reference3,
1183     reference4                                =    X_reference4,
1184     reference5                                =    X_reference5,
1185     preserve_flag                             =    X_preserve_flag,
1186     refresh_flag                              =    X_refresh_flag
1187 
1188   WHERE rowid = X_rowid;
1189 
1190   if (SQL%NOTFOUND) then
1191     RAISE NO_DATA_FOUND;
1192   end if;
1193 
1194 END Update_Row;
1195 
1196 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
1197 BEGIN
1198   DELETE FROM gl_code_combinations
1199   WHERE  rowid = X_Rowid;
1200 
1201   if (SQL%NOTFOUND) then
1202     RAISE NO_DATA_FOUND;
1203   end if;
1204 END Delete_Row;
1205 
1206 -- **********************************************************************
1207 
1208 FUNCTION check_net_income_account(X_CCID NUMBER) RETURN BOOLEAN IS
1209 
1210  	CURSOR check_net_income_account IS
1211 	  SELECT 'ccid exists'
1212 	  FROM DUAL
1213 	  WHERE EXISTS
1214               (SELECT 'X'
1215 	       FROM GL_NET_INCOME_ACCOUNTS
1216 	       WHERE code_combination_id = X_CCID);
1217 dummy VARCHAR2(100);
1218 
1219 BEGIN
1220 OPEN check_net_income_account;
1221 FETCH check_net_income_account INTO dummy;
1222 
1223 IF check_net_income_account%FOUND THEN
1224    CLOSE check_net_income_account;
1225    RETURN ( TRUE );
1226 ELSE
1227    CLOSE check_net_income_account;
1228    RETURN ( FALSE );
1229 END IF;
1230 
1231 
1232 END check_net_income_account;
1233 
1234 -- **********************************************************************
1235 
1236 PROCEDURE Get_Acct_Info(X_CCID 			IN	NUMBER,
1237 			X_NET_INCOME_ACCT_FLAG	IN OUT NOCOPY	NUMBER,
1238 			X_TEMPLATE_ID		IN OUT NOCOPY	NUMBER,
1239 			X_ACCT_TYPE		IN OUT NOCOPY	VARCHAR2,
1240 			X_SUMMARY_FLAG		IN OUT NOCOPY	VARCHAR2,
1241 			X_REFRESH_FLAG		IN OUT NOCOPY	VARCHAR2,
1242 			X_PRESERVE_FLAG		IN OUT NOCOPY	VARCHAR2,
1243                         X_ENABLED_FLAG          IN OUT NOCOPY   VARCHAR2) IS
1244 
1245   CURSOR get_acct_info IS
1246     SELECT NVL(account_type, 'XXX'), NVL(summary_flag, 'XXX'),
1247 	   NVL(template_id, -1), NVL(refresh_flag, 'N'),
1248 	   NVL(preserve_flag, 'N'), enabled_flag
1249     FROM GL_CODE_COMBINATIONS
1250     WHERE code_combination_id = X_CCID;
1251 
1252   ret_val		BOOLEAN := FALSE;
1253 
1254 BEGIN
1255   ret_val := check_net_income_account(X_CCID);
1256 
1257   IF (ret_val = TRUE) THEN
1258     X_NET_INCOME_ACCT_FLAG := 1;
1259   ELSE
1260     X_NET_INCOME_ACCT_FLAG := 0;
1261   END IF;
1262 
1263   OPEN get_acct_info;
1264   FETCH get_acct_info INTO X_ACCT_TYPE, X_SUMMARY_FLAG, X_TEMPLATE_ID,
1265 			   X_REFRESH_FLAG, X_PRESERVE_FLAG, X_ENABLED_FLAG;
1266   CLOSE get_acct_info;
1267 
1268 END Get_Acct_Info;
1269 
1270 -- **********************************************************************
1271 
1272 FUNCTION Get_Ccid(X_COA_ID          	    	IN  NUMBER,
1273 		  X_VALIDATION_DATE		IN  VARCHAR2,
1274 		  X_CONCAT_SEGS          	IN  VARCHAR2) RETURN NUMBER IS
1275 
1276   return_value    BOOLEAN;
1277   rule            VARCHAR2(1000);
1278   where_clause    VARCHAR2(30);
1279 
1280 BEGIN
1281    where_clause := 'SUMMARY_FLAG!=''Y''';
1282 
1283    rule := '\nSUMMARY_FLAG\nI\n' ||
1284            'APPL=SQLGL;NAME=GL_NO_PARENT_SEGMENT_ALLOWED\nN\0';
1285 
1286    return_value := fnd_flex_keyval.validate_segs('CREATE_COMBINATION','SQLGL',
1287                       'GL#', X_COA_ID, X_CONCAT_SEGS,
1288                       'V', sysdate, 'ALL', NULL, rule, where_clause,
1289                       NULL, FALSE, FALSE,
1290                       NULL, NULL, NULL, NULL, NULL, NULL);
1291 
1292    IF (return_value) THEN
1293       return (fnd_flex_keyval.combination_id);
1294    ELSE
1295       return (0);
1296    END IF;
1297 
1298 EXCEPTION
1299   WHEN OTHERS THEN
1300     fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
1301     fnd_message.set_token('PROCEDURE', 'GL_CODE_COMBINAITONS_PKG.Get_CCID');
1302     RAISE;
1303 END Get_Ccid;
1304 
1305 -- **********************************************************************
1306 
1307 PROCEDURE Raise_Bus_Event(X_COA_ID              IN NUMBER,
1308                           X_CCID                IN  NUMBER) IS
1309 
1310   ekey             VARCHAR2(100);
1311   edata            VARCHAR2(200);
1312   edataclob        CLOB;
1313 BEGIN
1314 
1315    /* Get event key */
1316    SELECT to_char(x_coa_id)||':'||
1317           to_char(sysdate, 'RRDDDSSSSS')||':'||
1318           to_char(x_ccid)
1319    INTO ekey
1320    FROM dual;
1321 
1322    /* Raise the disabled account event */
1323    IF (gl_business_events.test(
1324           'oracle.apps.gl.Maintenance.account.disable') = 'MESSAGE') THEN
1325 
1326        edata := '<?xml version="1.0"?> '||
1327                 '<DisabledAccounts> ' ||
1328                 '<CODE_COMBINATION_ID> '||
1329                 to_char(x_ccid) ||
1330                  '</CODE_COMBINATION_ID> ' ||
1331                  '</DisabledAccounts> ';
1332 
1333         dbms_lob.createtemporary(edataclob, FALSE, DBMS_LOB.CALL);
1334         dbms_lob.write(edataclob, length(edata), 1, edata);
1335 
1336         gl_business_events.raise(
1337           p_event_name => 'oracle.apps.gl.Maintenance.account.disable',
1338           p_event_key => ekey,
1339           p_event_data => edataclob);
1340    ELSE
1341         gl_business_events.raise(
1342           p_event_name => 'oracle.apps.gl.Maintenance.account.disable',
1343           p_event_key => ekey);
1344    END IF;
1345 
1346 END Raise_Bus_Event;
1347 
1348 
1349 -- **********************************************************************
1350 
1351 END GL_CODE_COMBINATIONS_PKG;