DBA Data[Home] [Help]

PACKAGE BODY: APPS.GL_ALLOC_FORM_LINES_PKG

Source


1 PACKAGE BODY gl_alloc_form_lines_pkg AS
2 /* $Header: glimaflb.pls 120.6 2003/08/20 20:45:16 ticheng ship $ */
3 
4 --
5 -- PUBLIC FUNCTIONS
6 --
7 
8   FUNCTION complete_formula(formula_id  NUMBER,
9                             actual_flag VARCHAR2) RETURN BOOLEAN IS
10     CURSOR count_lines is
11       SELECT count(*)
12       FROM   GL_ALLOC_FORMULA_LINES gafl
13       WHERE  gafl.allocation_formula_id = formula_id;
14 
15     line_count     NUMBER;
16   BEGIN
17     line_count := 0;
18 
19     OPEN count_lines;
20     FETCH count_lines INTO line_count;
21 
22     IF (line_count = 5) THEN
23       CLOSE count_lines;
24       RETURN(TRUE);
25     ELSIF (    (actual_flag = 'B')
26            AND (line_count = 4)) THEN
27       CLOSE count_lines;
28       RETURN(TRUE);
29     ELSE
30       CLOSE count_lines;
31       RETURN(FALSE);
32     END IF;
33 
34   EXCEPTION
35     WHEN app_exceptions.application_exception THEN
36       RAISE;
37     WHEN OTHERS THEN
38       fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
39       fnd_message.set_token(
40         'PROCEDURE', 'gl_alloc_formula_lines_pkg.complete_formula');
41       RAISE;
42   END complete_formula;
43 
44   PROCEDURE delete_rows(formula_id NUMBER) IS
45   BEGIN
46     DELETE gl_alloc_formula_lines
47     WHERE  allocation_formula_id = formula_id;
48   EXCEPTION
49     WHEN NO_DATA_FOUND THEN
50       null;
51   END delete_rows;
52 
53   PROCEDURE delete_batch(batch_id NUMBER) IS
54   BEGIN
55     DELETE gl_alloc_formula_lines
56     WHERE  allocation_formula_id IN
57       (SELECT allocation_formula_id
58        FROM   gl_alloc_formulas
59        WHERE  allocation_batch_id = batch_id);
60   EXCEPTION
61     WHEN NO_DATA_FOUND THEN
62       null;
63   END delete_batch;
64 
65   PROCEDURE validate_ledger_action(x_object_type_code	           VARCHAR2,
66                                    x_segment_types_key_full        VARCHAR2) IS
67     original_ledger_action VARCHAR2(1) :=
68                            SUBSTR(x_segment_types_key_full, 1, 1);
69   BEGIN
70     IF (x_object_type_code = 'L' and original_ledger_action <> 'C') THEN
71       fnd_message.set_name('SQLGL', 'GL_ALLOC_ACTION_FOR_LEDGER');
72       app_exception.raise_exception;
73     ELSIF (x_object_type_code = 'S' and original_ledger_action = 'C') THEN
74       fnd_message.set_name('SQLGL', 'GL_ALLOC_ACTION_FOR_LEDGER_SET');
75       app_exception.raise_exception;
76     END IF;
77   EXCEPTION
78     WHEN app_exception.application_exception THEN
79       RAISE;
80   END validate_ledger_action;
81 
82   PROCEDURE check_target_ledger(x_allocation_formula_id NUMBER) IS
83     CURSOR target_line IS
84       SELECT ledger_id, actual_flag, transaction_currency
85       FROM   gl_alloc_formula_lines
86       WHERE  allocation_formula_id = x_allocation_formula_id
87       AND    line_number = 4;
88 
89     target_ledger_id    NUMBER;
90     target_actual_flag  VARCHAR2(1);
91     transaction_curr    VARCHAR2(15);
92   BEGIN
93     OPEN target_line;
94     FETCH target_line INTO target_ledger_id,
95                            target_actual_flag,
96                            transaction_curr;
97     CLOSE target_line;
98 
99     IF (target_ledger_id IS NULL OR target_actual_flag = 'A') THEN
100       RETURN;
101     END IF;
102 
103     check_target_ledger_currency(target_ledger_id,
104                                  transaction_curr,
105                                  target_actual_flag);
106 
107   EXCEPTION
108     WHEN app_exceptions.application_exception THEN
109       RAISE;
110   END check_target_ledger;
111 
112   PROCEDURE check_target_ledger_currency(x_ledger_id NUMBER,
113                                          x_ledger_currency VARCHAR2,
114                                          x_actual_flag VARCHAR2) IS
115     CURSOR ledger_object_type IS
116       SELECT object_type_code, currency_code
117       FROM   gl_ledgers
118       WHERE  ledger_id = x_ledger_id;
119 
120     CURSOR mismatch_curr IS
121       SELECT 'different currency'
122       FROM   gl_ledgers ldg,
123              gl_ledger_set_assignments lsa
124       WHERE  lsa.ledger_set_id = x_ledger_id
125       AND    ldg.ledger_id = lsa.ledger_id
126       AND    ldg.object_type_code = 'L'
127       AND    ldg.currency_code <> x_ledger_currency
128       AND    rownum = 1;
129 
130     obj_type_code	VARCHAR2(1);
131     curr_code		VARCHAR2(15);
132     dummy		VARCHAR2(20);
133     dummy_num           NUMBER;
134   BEGIN
135     OPEN ledger_object_type;
136     FETCH ledger_object_type INTO obj_type_code, curr_code;
137     CLOSE ledger_object_type;
138 
139     IF (obj_type_code = 'L') THEN
140       IF (   curr_code = x_ledger_currency
141           OR x_ledger_currency = 'STAT') THEN
142         RETURN;
143       END IF;
144 
145     ELSE  -- Ledger Set
146       IF (x_ledger_currency = 'STAT') THEN
147         SELECT count(DISTINCT ldg.currency_code)
148         INTO   dummy_num
149         FROM  gl_ledgers ldg, gl_ledger_set_assignments lsa
150         WHERE lsa.ledger_set_id = x_ledger_id
151         AND   ldg.ledger_id = lsa.ledger_id
152         AND   ldg.object_type_code = 'L';
153 
154         IF (dummy_num <= 1) THEN
155           RETURN;
156         END IF;
157 
158       ELSE
159         OPEN mismatch_curr;
160         FETCH mismatch_curr INTO dummy;
161         IF (mismatch_curr%NOTFOUND) THEN
162           CLOSE mismatch_curr;
163           RETURN;
164         END IF;
165         CLOSE mismatch_curr;
166 
167       END IF;
168     END IF;
169 
170     -- if we reach here, we have a violation
171     IF (x_actual_flag = 'E') THEN
172       fnd_message.set_name('SQLGL', 'GL_ALLOC_CURR_BAL_TYPE_CONFLCT');
173     ELSE
174       fnd_message.set_name('SQLGL', 'GL_ALLOC_BUD_CURR_BAL_CONFLICT');
175     END IF;
176     app_exception.raise_exception;
177 
178   EXCEPTION
179     WHEN app_exceptions.application_exception THEN
180       RAISE;
181   END check_target_ledger_currency;
182 
183 
184   PROCEDURE update_currency(formula_id 			NUMBER,
185 			    transaction_currency	VARCHAR2,
186 			    conversion_method		VARCHAR2) IS
187     CURSOR check_curr IS
188       SELECT 'x'
189       FROM   gl_alloc_formula_lines
190       WHERE  allocation_formula_id = formula_id
191       AND    line_number = 1
192       AND    (   (    currency_type = 'T'
193                   AND ledger_currency <> update_currency.transaction_currency)
194               OR (    currency_type = 'E'
195                   AND entered_currency <> update_currency.transaction_currency)
196               OR (    currency_type = 'S' ));
197 
198     dummy VARCHAR2(1);
199   BEGIN
200     IF (    conversion_method = 'CV'
201         AND update_currency.transaction_currency <> 'STAT') THEN
202       OPEN check_curr;
203       FETCH check_curr INTO dummy;
204       IF (check_curr%FOUND) THEN
205         CLOSE check_curr;
206         fnd_message.set_name('SQLGL', 'GL_ALLOC_A_LEDGER_CURR_ERR');
207         app_exception.raise_exception;
208       ELSIF (check_curr%NOTFOUND) THEN
209         null;
210       END IF;
211       CLOSE check_curr;
212 
213     END IF;
214 
215     UPDATE gl_alloc_formula_lines
216     SET    transaction_currency = update_currency.transaction_currency
217     WHERE  allocation_formula_id = formula_id;
218 
219   EXCEPTION
220     WHEN NO_DATA_FOUND THEN
221       null;
222     WHEN app_exceptions.application_exception THEN
223       RAISE;
224   END update_currency;
225 
226 
227   FUNCTION currency_changed(formula_id 	   	   NUMBER,
228 			    transaction_currency   VARCHAR2) RETURN BOOLEAN IS
229     CURSOR check_lines is
230       SELECT 'Changed'
231       FROM   GL_ALLOC_FORMULA_LINES gafl
232       WHERE  gafl.allocation_formula_id = currency_changed.formula_id
233       AND    gafl.amount IS NULL
234       AND    gafl.transaction_currency <> currency_changed.transaction_currency
235       AND    rownum < 2;
236 
237     dummy     VARCHAR2(100);
238   BEGIN
239     OPEN check_lines;
240     FETCH check_lines INTO dummy;
241     if (check_lines%NOTFOUND) then
242       CLOSE check_lines;
243       RETURN FALSE;
244     else
245       CLOSE check_lines;
246       RETURN TRUE;
247     end if;
248   END currency_changed;
249 
250 
251 PROCEDURE Insert_Row(X_Rowid                        IN OUT NOCOPY VARCHAR2,
252                      X_Allocation_Formula_Id        IN OUT NOCOPY NUMBER,
253                      X_Line_Number                         NUMBER,
254                      X_Line_Type                           VARCHAR2,
255                      X_Operator                            VARCHAR2,
256                      X_Last_Update_Date                    DATE,
257                      X_Last_Updated_By                     NUMBER,
258                      X_Creation_Date                       DATE,
259                      X_Created_By                          NUMBER,
260                      X_Last_Update_Login                   NUMBER,
261                      X_Amount                              NUMBER,
262                      X_Relative_Period                     VARCHAR2,
263                      X_Period_Name                         VARCHAR2,
264                      X_Transaction_Currency                VARCHAR2,
265                      X_Ledger_Currency                     VARCHAR2,
266                      X_Currency_Type                       VARCHAR2,
267                      X_Entered_Currency                    VARCHAR2,
268                      X_Actual_Flag                         VARCHAR2,
269                      X_Budget_Version_Id                   NUMBER,
270                      X_Encumbrance_Type_Id                 NUMBER,
271                      X_Amount_Type                         VARCHAR2,
272                      X_Ledger_Id                           NUMBER,
273                      X_Segment_Types_Key_Full              VARCHAR2,
274                      X_Segment_Break_Key                   VARCHAR2,
275                      X_Segment1                            VARCHAR2,
276                      X_Segment2                            VARCHAR2,
277                      X_Segment3                            VARCHAR2,
278                      X_Segment4                            VARCHAR2,
279                      X_Segment5                            VARCHAR2,
280                      X_Segment6                            VARCHAR2,
281                      X_Segment7                            VARCHAR2,
282                      X_Segment8                            VARCHAR2,
283                      X_Segment9                            VARCHAR2,
284                      X_Segment10                           VARCHAR2,
285                      X_Segment11                           VARCHAR2,
286                      X_Segment12                           VARCHAR2,
287                      X_Segment13                           VARCHAR2,
288                      X_Segment14                           VARCHAR2,
289                      X_Segment15                           VARCHAR2,
290                      X_Segment16                           VARCHAR2,
291                      X_Segment17                           VARCHAR2,
292                      X_Segment18                           VARCHAR2,
293                      X_Segment19                           VARCHAR2,
294                      X_Segment20                           VARCHAR2,
295                      X_Segment21                           VARCHAR2,
296                      X_Segment22                           VARCHAR2,
297                      X_Segment23                           VARCHAR2,
298                      X_Segment24                           VARCHAR2,
299                      X_Segment25                           VARCHAR2,
300                      X_Segment26                           VARCHAR2,
301                      X_Segment27                           VARCHAR2,
302                      X_Segment28                           VARCHAR2,
303                      X_Segment29                           VARCHAR2,
304                      X_Segment30                           VARCHAR2
305  ) IS
306    CURSOR C IS SELECT rowid FROM GL_ALLOC_FORMULA_LINES
307              WHERE allocation_formula_id = X_Allocation_Formula_Id
308              AND   line_number = X_Line_Number;
309 
310 BEGIN
311 
312   -- Get formula id if it was not provided
313   IF (x_allocation_formula_id IS NULL) THEN
314     x_allocation_formula_id := gl_alloc_formulas_pkg.get_unique_id;
315   END IF;
316 
317   INSERT INTO GL_ALLOC_FORMULA_LINES(
318           allocation_formula_id,
319           line_number,
320           line_type,
321           operator,
322           last_update_date,
323           last_updated_by,
324           creation_date,
325           created_by,
326           last_update_login,
327           amount,
328           relative_period,
329           period_name,
330           transaction_currency,
331           ledger_currency,
332           currency_type,
333           entered_currency,
334           actual_flag,
335           budget_version_id,
336           encumbrance_type_id,
337           amount_type,
338           ledger_id,
339           ledger_action_code,
340           segment_types_key,
341           segment_break_key,
342           segment1,
343           segment2,
344           segment3,
345           segment4,
346           segment5,
347           segment6,
348           segment7,
349           segment8,
350           segment9,
351           segment10,
352           segment11,
353           segment12,
354           segment13,
355           segment14,
356           segment15,
357           segment16,
358           segment17,
359           segment18,
360           segment19,
361           segment20,
362           segment21,
363           segment22,
364           segment23,
365           segment24,
366           segment25,
367           segment26,
368           segment27,
369           segment28,
370           segment29,
371           segment30
372          ) VALUES (
373           X_Allocation_Formula_Id,
374           X_Line_Number,
375           X_Line_Type,
376           X_Operator,
377           X_Last_Update_Date,
378           X_Last_Updated_By,
379           X_Creation_Date,
380           X_Created_By,
381           X_Last_Update_Login,
382           X_Amount,
383           X_Relative_Period,
384           X_Period_Name,
385           X_Transaction_Currency,
386           X_Ledger_Currency,
387           X_Currency_Type,
388           X_Entered_Currency,
389           X_Actual_Flag,
390           X_Budget_Version_Id,
391           X_Encumbrance_Type_Id,
392           X_Amount_Type,
393           X_Ledger_Id,
394           SUBSTR(X_Segment_Types_Key_Full, 1, 1),
395           SUBSTR(X_Segment_Types_Key_Full, 3),
396           X_Segment_Break_Key,
397           X_Segment1,
398           X_Segment2,
399           X_Segment3,
400           X_Segment4,
401           X_Segment5,
402           X_Segment6,
403           X_Segment7,
404           X_Segment8,
405           X_Segment9,
406           X_Segment10,
407           X_Segment11,
408           X_Segment12,
409           X_Segment13,
410           X_Segment14,
411           X_Segment15,
412           X_Segment16,
413           X_Segment17,
414           X_Segment18,
415           X_Segment19,
416           X_Segment20,
417           X_Segment21,
418           X_Segment22,
419           X_Segment23,
420           X_Segment24,
421           X_Segment25,
422           X_Segment26,
423           X_Segment27,
424           X_Segment28,
425           X_Segment29,
426           X_Segment30
427   );
428 
429   OPEN C;
430   FETCH C INTO X_Rowid;
431   if (C%NOTFOUND) then
432     CLOSE C;
433     RAISE NO_DATA_FOUND;
434   end if;
435   CLOSE C;
436 END Insert_Row;
437 
438 PROCEDURE Lock_Row(X_Rowid                                 VARCHAR2,
439                    X_Allocation_Formula_Id                 NUMBER,
440                    X_Line_Number                           NUMBER,
441                    X_Line_Type                             VARCHAR2,
442                    X_Operator                              VARCHAR2,
443                    X_Amount                                NUMBER,
444                    X_Relative_Period                       VARCHAR2,
445                    X_Period_Name                           VARCHAR2,
446                    X_Transaction_Currency                  VARCHAR2,
447                    X_Ledger_Currency                       VARCHAR2,
448                    X_Currency_Type                         VARCHAR2,
449                    X_Entered_Currency                      VARCHAR2,
450                    X_Actual_Flag                           VARCHAR2,
451                    X_Budget_Version_Id                     NUMBER,
452                    X_Encumbrance_Type_Id                   NUMBER,
453                    X_Amount_Type                           VARCHAR2,
454                    X_Ledger_Id                             NUMBER,
455                    X_Segment_Types_Key_Full                VARCHAR2,
456                    X_Segment_Break_Key                     VARCHAR2,
457                    X_Segment1                              VARCHAR2,
458                    X_Segment2                              VARCHAR2,
459                    X_Segment3                              VARCHAR2,
460                    X_Segment4                              VARCHAR2,
461                    X_Segment5                              VARCHAR2,
462                    X_Segment6                              VARCHAR2,
463                    X_Segment7                              VARCHAR2,
464                    X_Segment8                              VARCHAR2,
465                    X_Segment9                              VARCHAR2,
466                    X_Segment10                             VARCHAR2,
467                    X_Segment11                             VARCHAR2,
468                    X_Segment12                             VARCHAR2,
469                    X_Segment13                             VARCHAR2,
470                    X_Segment14                             VARCHAR2,
471                    X_Segment15                             VARCHAR2,
472                    X_Segment16                             VARCHAR2,
473                    X_Segment17                             VARCHAR2,
474                    X_Segment18                             VARCHAR2,
475                    X_Segment19                             VARCHAR2,
476                    X_Segment20                             VARCHAR2,
477                    X_Segment21                             VARCHAR2,
478                    X_Segment22                             VARCHAR2,
479                    X_Segment23                             VARCHAR2,
480                    X_Segment24                             VARCHAR2,
481                    X_Segment25                             VARCHAR2,
482                    X_Segment26                             VARCHAR2,
483                    X_Segment27                             VARCHAR2,
484                    X_Segment28                             VARCHAR2,
485                    X_Segment29                             VARCHAR2,
486                    X_Segment30                             VARCHAR2
487 ) IS
488   CURSOR C IS
489       SELECT *
490       FROM   GL_ALLOC_FORMULA_LINES
491       WHERE  rowid = X_Rowid
492       FOR UPDATE of Allocation_Formula_Id NOWAIT;
493   Recinfo C%ROWTYPE;
494 
495   X_Ledger_Action_Code VARCHAR2(1) := SUBSTR(X_Segment_Types_Key_Full, 1, 1);
496   X_Segment_Types_Key  VARCHAR2(60) := SUBSTR(X_Segment_Types_Key_Full, 3, 60);
497 BEGIN
498   OPEN C;
499   FETCH C INTO Recinfo;
500   if (C%NOTFOUND) then
501     CLOSE C;
502     RAISE NO_DATA_FOUND;
503   end if;
504   CLOSE C;
505   if (
506           (   (Recinfo.allocation_formula_id = X_Allocation_Formula_Id)
507            OR (    (Recinfo.allocation_formula_id IS NULL)
508                AND (X_Allocation_Formula_Id IS NULL)))
509       AND (   (Recinfo.line_number = X_Line_Number)
510            OR (    (Recinfo.line_number IS NULL)
511                AND (X_Line_Number IS NULL)))
512       AND (   (Recinfo.line_type = X_Line_Type)
513            OR (    (Recinfo.line_type IS NULL)
514                AND (X_Line_Type IS NULL)))
515       AND (   (Recinfo.operator = X_Operator)
516            OR (    (Recinfo.operator IS NULL)
517                AND (X_Operator IS NULL)))
518       AND (   (Recinfo.amount = X_Amount)
519            OR (    (Recinfo.amount IS NULL)
520                AND (X_Amount IS NULL)))
521       AND (   (Recinfo.relative_period = X_Relative_Period)
522            OR (    (Recinfo.relative_period IS NULL)
523                AND (X_Relative_Period IS NULL)))
524       AND (   (Recinfo.period_name = X_Period_Name)
525            OR (    (Recinfo.period_name IS NULL)
526                AND (X_Period_Name IS NULL)))
527       AND (   (Recinfo.transaction_currency = X_Transaction_Currency)
528            OR (    (Recinfo.transaction_currency IS NULL)
529                AND (X_Transaction_Currency IS NULL)))
530       AND (   (Recinfo.ledger_currency = X_Ledger_Currency)
531            OR (    (Recinfo.ledger_currency IS NULL)
532                AND (X_Ledger_Currency IS NULL)))
533       AND (   (Recinfo.currency_type = X_Currency_Type)
534            OR (    (Recinfo.currency_type IS NULL)
535                AND (X_Currency_Type IS NULL)))
536       AND (   (Recinfo.entered_currency = X_Entered_Currency)
537            OR (    (Recinfo.entered_currency IS NULL)
538                AND (X_Entered_Currency IS NULL)))
539       AND (   (Recinfo.actual_flag = X_Actual_Flag)
540            OR (    (Recinfo.actual_flag IS NULL)
541                AND (X_Actual_Flag IS NULL)))
542       AND (   (Recinfo.budget_version_id = X_Budget_Version_Id)
543            OR (    (Recinfo.budget_version_id IS NULL)
544                AND (X_Budget_Version_Id IS NULL)))
545       AND (   (Recinfo.encumbrance_type_id = X_Encumbrance_Type_Id)
546            OR (    (Recinfo.encumbrance_type_id IS NULL)
547                AND (X_Encumbrance_Type_Id IS NULL)))
548       AND (   (Recinfo.amount_type = X_Amount_Type)
549            OR (    (Recinfo.amount_type IS NULL)
550                AND (X_Amount_Type IS NULL)))
551       AND (   (Recinfo.ledger_id = X_Ledger_Id)
552            OR (    (Recinfo.ledger_id IS NULL)
553                AND (X_Ledger_Id IS NULL)))
554       AND (   (Recinfo.ledger_action_code = X_Ledger_Action_Code)
555            OR (    (Recinfo.ledger_action_code IS NULL)
556                AND (X_Ledger_Action_Code IS NULL)))
557       AND (   (Recinfo.segment_types_key = X_Segment_Types_Key)
558            OR (    (Recinfo.segment_types_key IS NULL)
559                AND (X_Segment_Types_Key IS NULL)))
560       AND (   (Recinfo.segment_break_key = X_Segment_Break_Key)
561            OR (    (Recinfo.segment_break_key IS NULL)
562                AND (X_Segment_Break_Key IS NULL)))
563       AND (   (Recinfo.segment1 = X_Segment1)
564            OR (    (Recinfo.segment1 IS NULL)
565                AND (X_Segment1 IS NULL)))
566       AND (   (Recinfo.segment2 = X_Segment2)
567            OR (    (Recinfo.segment2 IS NULL)
568                AND (X_Segment2 IS NULL)))
569       AND (   (Recinfo.segment3 = X_Segment3)
570            OR (    (Recinfo.segment3 IS NULL)
571                AND (X_Segment3 IS NULL)))
572       AND (   (Recinfo.segment4 = X_Segment4)
573            OR (    (Recinfo.segment4 IS NULL)
574                AND (X_Segment4 IS NULL)))
575       AND (   (Recinfo.segment5 = X_Segment5)
576            OR (    (Recinfo.segment5 IS NULL)
577                AND (X_Segment5 IS NULL)))
578       AND (   (Recinfo.segment6 = X_Segment6)
579            OR (    (Recinfo.segment6 IS NULL)
580                AND (X_Segment6 IS NULL)))
581       AND (   (Recinfo.segment7 = X_Segment7)
582            OR (    (Recinfo.segment7 IS NULL)
583                AND (X_Segment7 IS NULL)))
584       AND (   (Recinfo.segment8 = X_Segment8)
585            OR (    (Recinfo.segment8 IS NULL)
586                AND (X_Segment8 IS NULL)))
587       AND (   (Recinfo.segment9 = X_Segment9)
588            OR (    (Recinfo.segment9 IS NULL)
589                AND (X_Segment9 IS NULL)))
590       AND (   (Recinfo.segment10 = X_Segment10)
591            OR (    (Recinfo.segment10 IS NULL)
592                AND (X_Segment10 IS NULL)))
593       AND (   (Recinfo.segment11 = X_Segment11)
594            OR (    (Recinfo.segment11 IS NULL)
595                AND (X_Segment11 IS NULL)))
596       AND (   (Recinfo.segment12 = X_Segment12)
597            OR (    (Recinfo.segment12 IS NULL)
598                AND (X_Segment12 IS NULL)))
599       AND (   (Recinfo.segment13 = X_Segment13)
600            OR (    (Recinfo.segment13 IS NULL)
601                AND (X_Segment13 IS NULL)))
602       AND (   (Recinfo.segment14 = X_Segment14)
603            OR (    (Recinfo.segment14 IS NULL)
604                AND (X_Segment14 IS NULL)))
605       AND (   (Recinfo.segment15 = X_Segment15)
606            OR (    (Recinfo.segment15 IS NULL)
607                AND (X_Segment15 IS NULL)))
608       AND (   (Recinfo.segment16 = X_Segment16)
609            OR (    (Recinfo.segment16 IS NULL)
610                AND (X_Segment16 IS NULL)))
611       AND (   (Recinfo.segment17 = X_Segment17)
612            OR (    (Recinfo.segment17 IS NULL)
613                AND (X_Segment17 IS NULL)))
614       AND (   (Recinfo.segment18 = X_Segment18)
615            OR (    (Recinfo.segment18 IS NULL)
616                AND (X_Segment18 IS NULL)))
617       AND (   (Recinfo.segment19 = X_Segment19)
618            OR (    (Recinfo.segment19 IS NULL)
619                AND (X_Segment19 IS NULL)))
620       AND (   (Recinfo.segment20 = X_Segment20)
621            OR (    (Recinfo.segment20 IS NULL)
622                AND (X_Segment20 IS NULL)))
623       AND (   (Recinfo.segment21 = X_Segment21)
624            OR (    (Recinfo.segment21 IS NULL)
625                AND (X_Segment21 IS NULL)))
626       AND (   (Recinfo.segment22 = X_Segment22)
627            OR (    (Recinfo.segment22 IS NULL)
628                AND (X_Segment22 IS NULL)))
629       AND (   (Recinfo.segment23 = X_Segment23)
630            OR (    (Recinfo.segment23 IS NULL)
631                AND (X_Segment23 IS NULL)))
632       AND (   (Recinfo.segment24 = X_Segment24)
633            OR (    (Recinfo.segment24 IS NULL)
634                AND (X_Segment24 IS NULL)))
635       AND (   (Recinfo.segment25 = X_Segment25)
636            OR (    (Recinfo.segment25 IS NULL)
637                AND (X_Segment25 IS NULL)))
638       AND (   (Recinfo.segment26 = X_Segment26)
639            OR (    (Recinfo.segment26 IS NULL)
640                AND (X_Segment26 IS NULL)))
641       AND (   (Recinfo.segment27 = X_Segment27)
642            OR (    (Recinfo.segment27 IS NULL)
643                AND (X_Segment27 IS NULL)))
644       AND (   (Recinfo.segment28 = X_Segment28)
645            OR (    (Recinfo.segment28 IS NULL)
646                AND (X_Segment28 IS NULL)))
647       AND (   (Recinfo.segment29 = X_Segment29)
648            OR (    (Recinfo.segment29 IS NULL)
649                AND (X_Segment29 IS NULL)))
650       AND (   (Recinfo.segment30 = X_Segment30)
651            OR (    (Recinfo.segment30 IS NULL)
652                AND (X_Segment30 IS NULL)))
653           ) then
654     return;
655   else
656     FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
657     APP_EXCEPTION.RAISE_EXCEPTION;
658   end if;
659 END Lock_Row;
660 
661 PROCEDURE Update_Row(X_Rowid                               VARCHAR2,
662                      X_Allocation_Formula_Id               NUMBER,
663                      X_Line_Number                         NUMBER,
664                      X_Line_Type                           VARCHAR2,
665                      X_Operator                            VARCHAR2,
666                      X_Last_Update_Date                    DATE,
667                      X_Last_Updated_By                     NUMBER,
668                      X_Last_Update_Login                   NUMBER,
669                      X_Amount                              NUMBER,
670                      X_Relative_Period                     VARCHAR2,
671                      X_Period_Name                         VARCHAR2,
672                      X_Transaction_Currency                VARCHAR2,
673                      X_Ledger_Currency                     VARCHAR2,
674                      X_Currency_Type                       VARCHAR2,
675                      X_Entered_Currency                    VARCHAR2,
676                      X_Actual_Flag                         VARCHAR2,
677                      X_Budget_Version_Id                   NUMBER,
678                      X_Encumbrance_Type_Id                 NUMBER,
679                      X_Amount_Type                         VARCHAR2,
680                      X_Ledger_Id                           NUMBER,
681                      X_Segment_Types_Key_Full              VARCHAR2,
682                      X_Segment_Break_Key                   VARCHAR2,
683                      X_Segment1                            VARCHAR2,
684                      X_Segment2                            VARCHAR2,
685                      X_Segment3                            VARCHAR2,
686                      X_Segment4                            VARCHAR2,
687                      X_Segment5                            VARCHAR2,
688                      X_Segment6                            VARCHAR2,
689                      X_Segment7                            VARCHAR2,
690                      X_Segment8                            VARCHAR2,
691                      X_Segment9                            VARCHAR2,
692                      X_Segment10                           VARCHAR2,
693                      X_Segment11                           VARCHAR2,
694                      X_Segment12                           VARCHAR2,
695                      X_Segment13                           VARCHAR2,
696                      X_Segment14                           VARCHAR2,
697                      X_Segment15                           VARCHAR2,
698                      X_Segment16                           VARCHAR2,
699                      X_Segment17                           VARCHAR2,
700                      X_Segment18                           VARCHAR2,
701                      X_Segment19                           VARCHAR2,
702                      X_Segment20                           VARCHAR2,
703                      X_Segment21                           VARCHAR2,
704                      X_Segment22                           VARCHAR2,
705                      X_Segment23                           VARCHAR2,
706                      X_Segment24                           VARCHAR2,
707                      X_Segment25                           VARCHAR2,
708                      X_Segment26                           VARCHAR2,
709                      X_Segment27                           VARCHAR2,
710                      X_Segment28                           VARCHAR2,
711                      X_Segment29                           VARCHAR2,
712                      X_Segment30                           VARCHAR2
713 ) IS
714 BEGIN
715   UPDATE GL_ALLOC_FORMULA_LINES
716   SET
717 
718     allocation_formula_id           =    X_Allocation_Formula_Id,
719     line_number                     =    X_Line_Number,
720     line_type                       =    X_Line_Type,
721     operator                        =    X_Operator,
722     last_update_date                =    X_Last_Update_Date,
723     last_updated_by                 =    X_Last_Updated_By,
724     last_update_login               =    X_Last_Update_Login,
725     amount                          =    X_Amount,
726     relative_period                 =    X_Relative_Period,
727     period_name                     =    X_Period_Name,
728     transaction_currency            =    X_Transaction_Currency,
729     ledger_currency                 =    X_Ledger_Currency,
730     currency_type                   =    X_Currency_Type,
731     entered_currency                =    X_Entered_Currency,
732     actual_flag                     =    X_Actual_Flag,
733     budget_version_id               =    X_Budget_Version_Id,
734     encumbrance_type_id             =    X_Encumbrance_Type_Id,
735     amount_type                     =    X_Amount_Type,
736     ledger_id                       =    X_Ledger_Id,
737     ledger_action_code              =    SUBSTR(X_Segment_Types_Key_Full, 1, 1),
738     segment_types_key               =    SUBSTR(X_Segment_Types_Key_Full, 3),
739     segment_break_key               =    X_Segment_Break_Key,
740     segment1                        =    X_Segment1,
741     segment2                        =    X_Segment2,
742     segment3                        =    X_Segment3,
743     segment4                        =    X_Segment4,
744     segment5                        =    X_Segment5,
745     segment6                        =    X_Segment6,
746     segment7                        =    X_Segment7,
747     segment8                        =    X_Segment8,
748     segment9                        =    X_Segment9,
749     segment10                       =    X_Segment10,
750     segment11                       =    X_Segment11,
751     segment12                       =    X_Segment12,
752     segment13                       =    X_Segment13,
753     segment14                       =    X_Segment14,
754     segment15                       =    X_Segment15,
755     segment16                       =    X_Segment16,
756     segment17                       =    X_Segment17,
757     segment18                       =    X_Segment18,
758     segment19                       =    X_Segment19,
759     segment20                       =    X_Segment20,
760     segment21                       =    X_Segment21,
761     segment22                       =    X_Segment22,
762     segment23                       =    X_Segment23,
763     segment24                       =    X_Segment24,
764     segment25                       =    X_Segment25,
765     segment26                       =    X_Segment26,
766     segment27                       =    X_Segment27,
767     segment28                       =    X_Segment28,
768     segment29                       =    X_Segment29,
769     segment30                       =    X_Segment30
770   WHERE rowid = X_rowid;
771 
772   if (SQL%NOTFOUND) then
773     RAISE NO_DATA_FOUND;
774   end if;
775 
776 END Update_Row;
777 
778 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
779 BEGIN
780   DELETE FROM GL_ALLOC_FORMULA_LINES
781   WHERE  rowid = X_Rowid;
782 
783   if (SQL%NOTFOUND) then
784     RAISE NO_DATA_FOUND;
785   end if;
786 END Delete_Row;
787 
788 END gl_alloc_form_lines_pkg;