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.12010000.2 2009/06/19 09:16:43 akhanapu 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 
197     dummy VARCHAR2(1);
198   BEGIN
199     IF (    conversion_method = 'CV'
200         AND update_currency.transaction_currency <> 'STAT') THEN
201       OPEN check_curr;
202       FETCH check_curr INTO dummy;
203       IF (check_curr%FOUND) THEN
204         CLOSE check_curr;
205         fnd_message.set_name('SQLGL', 'GL_ALLOC_A_LEDGER_CURR_ERR');
206         app_exception.raise_exception;
207       ELSIF (check_curr%NOTFOUND) THEN
208         null;
209       END IF;
210       CLOSE check_curr;
211 
212     END IF;
213 
214     UPDATE gl_alloc_formula_lines
215     SET    transaction_currency = update_currency.transaction_currency
216     WHERE  allocation_formula_id = formula_id;
217 
218   EXCEPTION
219     WHEN NO_DATA_FOUND THEN
220       null;
221     WHEN app_exceptions.application_exception THEN
222       RAISE;
223   END update_currency;
224 
225 
226   FUNCTION currency_changed(formula_id 	   	   NUMBER,
227 			    transaction_currency   VARCHAR2) RETURN BOOLEAN IS
228     CURSOR check_lines is
229       SELECT 'Changed'
230       FROM   GL_ALLOC_FORMULA_LINES gafl
231       WHERE  gafl.allocation_formula_id = currency_changed.formula_id
232       AND    gafl.amount IS NULL
233       AND    gafl.transaction_currency <> currency_changed.transaction_currency
234       AND    rownum < 2;
235 
236     dummy     VARCHAR2(100);
237   BEGIN
238     OPEN check_lines;
239     FETCH check_lines INTO dummy;
240     if (check_lines%NOTFOUND) then
241       CLOSE check_lines;
242       RETURN FALSE;
243     else
244       CLOSE check_lines;
245       RETURN TRUE;
246     end if;
247   END currency_changed;
248 
249 
250 PROCEDURE Insert_Row(X_Rowid                        IN OUT NOCOPY VARCHAR2,
251                      X_Allocation_Formula_Id        IN OUT NOCOPY NUMBER,
252                      X_Line_Number                         NUMBER,
253                      X_Line_Type                           VARCHAR2,
254                      X_Operator                            VARCHAR2,
255                      X_Last_Update_Date                    DATE,
256                      X_Last_Updated_By                     NUMBER,
257                      X_Creation_Date                       DATE,
258                      X_Created_By                          NUMBER,
259                      X_Last_Update_Login                   NUMBER,
260                      X_Amount                              NUMBER,
261                      X_Relative_Period                     VARCHAR2,
262                      X_Period_Name                         VARCHAR2,
263                      X_Transaction_Currency                VARCHAR2,
264                      X_Ledger_Currency                     VARCHAR2,
265                      X_Currency_Type                       VARCHAR2,
266                      X_Entered_Currency                    VARCHAR2,
267                      X_Actual_Flag                         VARCHAR2,
268                      X_Budget_Version_Id                   NUMBER,
269                      X_Encumbrance_Type_Id                 NUMBER,
270                      X_Amount_Type                         VARCHAR2,
271                      X_Ledger_Id                           NUMBER,
272                      X_Segment_Types_Key_Full              VARCHAR2,
273                      X_Segment_Break_Key                   VARCHAR2,
274                      X_Segment1                            VARCHAR2,
275                      X_Segment2                            VARCHAR2,
276                      X_Segment3                            VARCHAR2,
277                      X_Segment4                            VARCHAR2,
278                      X_Segment5                            VARCHAR2,
279                      X_Segment6                            VARCHAR2,
280                      X_Segment7                            VARCHAR2,
281                      X_Segment8                            VARCHAR2,
282                      X_Segment9                            VARCHAR2,
283                      X_Segment10                           VARCHAR2,
284                      X_Segment11                           VARCHAR2,
285                      X_Segment12                           VARCHAR2,
286                      X_Segment13                           VARCHAR2,
287                      X_Segment14                           VARCHAR2,
288                      X_Segment15                           VARCHAR2,
289                      X_Segment16                           VARCHAR2,
290                      X_Segment17                           VARCHAR2,
291                      X_Segment18                           VARCHAR2,
292                      X_Segment19                           VARCHAR2,
293                      X_Segment20                           VARCHAR2,
294                      X_Segment21                           VARCHAR2,
295                      X_Segment22                           VARCHAR2,
296                      X_Segment23                           VARCHAR2,
297                      X_Segment24                           VARCHAR2,
298                      X_Segment25                           VARCHAR2,
299                      X_Segment26                           VARCHAR2,
300                      X_Segment27                           VARCHAR2,
301                      X_Segment28                           VARCHAR2,
302                      X_Segment29                           VARCHAR2,
303                      X_Segment30                           VARCHAR2
304  ) IS
305    CURSOR C IS SELECT rowid FROM GL_ALLOC_FORMULA_LINES
306              WHERE allocation_formula_id = X_Allocation_Formula_Id
307              AND   line_number = X_Line_Number;
308 
309 BEGIN
310 
311   -- Get formula id if it was not provided
312   IF (x_allocation_formula_id IS NULL) THEN
313     x_allocation_formula_id := gl_alloc_formulas_pkg.get_unique_id;
314   END IF;
315 
316   INSERT INTO GL_ALLOC_FORMULA_LINES(
317           allocation_formula_id,
318           line_number,
319           line_type,
320           operator,
321           last_update_date,
322           last_updated_by,
323           creation_date,
324           created_by,
325           last_update_login,
326           amount,
327           relative_period,
328           period_name,
329           transaction_currency,
330           ledger_currency,
331           currency_type,
332           entered_currency,
333           actual_flag,
334           budget_version_id,
335           encumbrance_type_id,
336           amount_type,
337           ledger_id,
338           ledger_action_code,
339           segment_types_key,
340           segment_break_key,
341           segment1,
342           segment2,
343           segment3,
344           segment4,
345           segment5,
346           segment6,
347           segment7,
348           segment8,
349           segment9,
350           segment10,
351           segment11,
352           segment12,
353           segment13,
354           segment14,
355           segment15,
356           segment16,
357           segment17,
358           segment18,
359           segment19,
360           segment20,
361           segment21,
362           segment22,
363           segment23,
364           segment24,
365           segment25,
366           segment26,
367           segment27,
368           segment28,
369           segment29,
370           segment30
371          ) VALUES (
372           X_Allocation_Formula_Id,
373           X_Line_Number,
374           X_Line_Type,
375           X_Operator,
376           X_Last_Update_Date,
377           X_Last_Updated_By,
378           X_Creation_Date,
379           X_Created_By,
380           X_Last_Update_Login,
381           X_Amount,
382           X_Relative_Period,
383           X_Period_Name,
384           X_Transaction_Currency,
385           X_Ledger_Currency,
386           X_Currency_Type,
387           X_Entered_Currency,
388           X_Actual_Flag,
389           X_Budget_Version_Id,
390           X_Encumbrance_Type_Id,
391           X_Amount_Type,
392           X_Ledger_Id,
393           SUBSTR(X_Segment_Types_Key_Full, 1, 1),
394           SUBSTR(X_Segment_Types_Key_Full, 3),
395           X_Segment_Break_Key,
396           X_Segment1,
397           X_Segment2,
398           X_Segment3,
399           X_Segment4,
400           X_Segment5,
401           X_Segment6,
402           X_Segment7,
403           X_Segment8,
404           X_Segment9,
405           X_Segment10,
406           X_Segment11,
407           X_Segment12,
408           X_Segment13,
409           X_Segment14,
410           X_Segment15,
411           X_Segment16,
412           X_Segment17,
413           X_Segment18,
414           X_Segment19,
415           X_Segment20,
416           X_Segment21,
417           X_Segment22,
418           X_Segment23,
419           X_Segment24,
420           X_Segment25,
421           X_Segment26,
422           X_Segment27,
423           X_Segment28,
424           X_Segment29,
425           X_Segment30
426   );
427 
428   OPEN C;
429   FETCH C INTO X_Rowid;
430   if (C%NOTFOUND) then
431     CLOSE C;
432     RAISE NO_DATA_FOUND;
433   end if;
434   CLOSE C;
435 END Insert_Row;
436 
437 PROCEDURE Lock_Row(X_Rowid                                 VARCHAR2,
438                    X_Allocation_Formula_Id                 NUMBER,
439                    X_Line_Number                           NUMBER,
440                    X_Line_Type                             VARCHAR2,
441                    X_Operator                              VARCHAR2,
442                    X_Amount                                NUMBER,
443                    X_Relative_Period                       VARCHAR2,
444                    X_Period_Name                           VARCHAR2,
445                    X_Transaction_Currency                  VARCHAR2,
446                    X_Ledger_Currency                       VARCHAR2,
447                    X_Currency_Type                         VARCHAR2,
448                    X_Entered_Currency                      VARCHAR2,
449                    X_Actual_Flag                           VARCHAR2,
450                    X_Budget_Version_Id                     NUMBER,
451                    X_Encumbrance_Type_Id                   NUMBER,
452                    X_Amount_Type                           VARCHAR2,
453                    X_Ledger_Id                             NUMBER,
454                    X_Segment_Types_Key_Full                VARCHAR2,
455                    X_Segment_Break_Key                     VARCHAR2,
456                    X_Segment1                              VARCHAR2,
457                    X_Segment2                              VARCHAR2,
458                    X_Segment3                              VARCHAR2,
459                    X_Segment4                              VARCHAR2,
460                    X_Segment5                              VARCHAR2,
461                    X_Segment6                              VARCHAR2,
462                    X_Segment7                              VARCHAR2,
463                    X_Segment8                              VARCHAR2,
464                    X_Segment9                              VARCHAR2,
465                    X_Segment10                             VARCHAR2,
466                    X_Segment11                             VARCHAR2,
467                    X_Segment12                             VARCHAR2,
468                    X_Segment13                             VARCHAR2,
469                    X_Segment14                             VARCHAR2,
470                    X_Segment15                             VARCHAR2,
471                    X_Segment16                             VARCHAR2,
472                    X_Segment17                             VARCHAR2,
473                    X_Segment18                             VARCHAR2,
474                    X_Segment19                             VARCHAR2,
475                    X_Segment20                             VARCHAR2,
476                    X_Segment21                             VARCHAR2,
477                    X_Segment22                             VARCHAR2,
478                    X_Segment23                             VARCHAR2,
479                    X_Segment24                             VARCHAR2,
480                    X_Segment25                             VARCHAR2,
481                    X_Segment26                             VARCHAR2,
482                    X_Segment27                             VARCHAR2,
483                    X_Segment28                             VARCHAR2,
484                    X_Segment29                             VARCHAR2,
485                    X_Segment30                             VARCHAR2
486 ) IS
487   CURSOR C IS
488       SELECT *
489       FROM   GL_ALLOC_FORMULA_LINES
490       WHERE  rowid = X_Rowid
491       FOR UPDATE of Allocation_Formula_Id NOWAIT;
492   Recinfo C%ROWTYPE;
493 
494   X_Ledger_Action_Code VARCHAR2(1) := SUBSTR(X_Segment_Types_Key_Full, 1, 1);
495   X_Segment_Types_Key  VARCHAR2(60) := SUBSTR(X_Segment_Types_Key_Full, 3, 60);
496 BEGIN
497   OPEN C;
498   FETCH C INTO Recinfo;
499   if (C%NOTFOUND) then
500     CLOSE C;
501     RAISE NO_DATA_FOUND;
502   end if;
503   CLOSE C;
504   if (
505           (   (Recinfo.allocation_formula_id = X_Allocation_Formula_Id)
506            OR (    (Recinfo.allocation_formula_id IS NULL)
507                AND (X_Allocation_Formula_Id IS NULL)))
508       AND (   (Recinfo.line_number = X_Line_Number)
509            OR (    (Recinfo.line_number IS NULL)
510                AND (X_Line_Number IS NULL)))
511       AND (   (Recinfo.line_type = X_Line_Type)
512            OR (    (Recinfo.line_type IS NULL)
513                AND (X_Line_Type IS NULL)))
514       AND (   (Recinfo.operator = X_Operator)
515            OR (    (Recinfo.operator IS NULL)
516                AND (X_Operator IS NULL)))
517       AND (   (Recinfo.amount = X_Amount)
518            OR (    (Recinfo.amount IS NULL)
519                AND (X_Amount IS NULL)))
520       AND (   (Recinfo.relative_period = X_Relative_Period)
521            OR (    (Recinfo.relative_period IS NULL)
522                AND (X_Relative_Period IS NULL)))
523       AND (   (Recinfo.period_name = X_Period_Name)
524            OR (    (Recinfo.period_name IS NULL)
525                AND (X_Period_Name IS NULL)))
526       AND (   (Recinfo.transaction_currency = X_Transaction_Currency)
527            OR (    (Recinfo.transaction_currency IS NULL)
528                AND (X_Transaction_Currency IS NULL)))
529       AND (   (Recinfo.ledger_currency = X_Ledger_Currency)
530            OR (    (Recinfo.ledger_currency IS NULL)
531                AND (X_Ledger_Currency IS NULL)))
532       AND (   (Recinfo.currency_type = X_Currency_Type)
533            OR (    (Recinfo.currency_type IS NULL)
534                AND (X_Currency_Type IS NULL)))
535       AND (   (Recinfo.entered_currency = X_Entered_Currency)
536            OR (    (Recinfo.entered_currency IS NULL)
537                AND (X_Entered_Currency IS NULL)))
538       AND (   (Recinfo.actual_flag = X_Actual_Flag)
539            OR (    (Recinfo.actual_flag IS NULL)
540                AND (X_Actual_Flag IS NULL)))
541       AND (   (Recinfo.budget_version_id = X_Budget_Version_Id)
542            OR (    (Recinfo.budget_version_id IS NULL)
543                AND (X_Budget_Version_Id IS NULL)))
544       AND (   (Recinfo.encumbrance_type_id = X_Encumbrance_Type_Id)
545            OR (    (Recinfo.encumbrance_type_id IS NULL)
546                AND (X_Encumbrance_Type_Id IS NULL)))
547       AND (   (Recinfo.amount_type = X_Amount_Type)
548            OR (    (Recinfo.amount_type IS NULL)
549                AND (X_Amount_Type IS NULL)))
550       AND (   (Recinfo.ledger_id = X_Ledger_Id)
551            OR (    (Recinfo.ledger_id IS NULL)
552                AND (X_Ledger_Id IS NULL)))
553       AND (   (Recinfo.ledger_action_code = X_Ledger_Action_Code)
554            OR (    (Recinfo.ledger_action_code IS NULL)
555                AND (X_Ledger_Action_Code IS NULL)))
556       AND (   (Recinfo.segment_types_key = X_Segment_Types_Key)
557            OR (    (Recinfo.segment_types_key IS NULL)
558                AND (X_Segment_Types_Key IS NULL)))
559       AND (   (Recinfo.segment_break_key = X_Segment_Break_Key)
560            OR (    (Recinfo.segment_break_key IS NULL)
561                AND (X_Segment_Break_Key IS NULL)))
562       AND (   (Recinfo.segment1 = X_Segment1)
563            OR (    (Recinfo.segment1 IS NULL)
564                AND (X_Segment1 IS NULL)))
565       AND (   (Recinfo.segment2 = X_Segment2)
566            OR (    (Recinfo.segment2 IS NULL)
567                AND (X_Segment2 IS NULL)))
568       AND (   (Recinfo.segment3 = X_Segment3)
569            OR (    (Recinfo.segment3 IS NULL)
570                AND (X_Segment3 IS NULL)))
571       AND (   (Recinfo.segment4 = X_Segment4)
572            OR (    (Recinfo.segment4 IS NULL)
573                AND (X_Segment4 IS NULL)))
574       AND (   (Recinfo.segment5 = X_Segment5)
575            OR (    (Recinfo.segment5 IS NULL)
576                AND (X_Segment5 IS NULL)))
577       AND (   (Recinfo.segment6 = X_Segment6)
578            OR (    (Recinfo.segment6 IS NULL)
579                AND (X_Segment6 IS NULL)))
580       AND (   (Recinfo.segment7 = X_Segment7)
581            OR (    (Recinfo.segment7 IS NULL)
582                AND (X_Segment7 IS NULL)))
583       AND (   (Recinfo.segment8 = X_Segment8)
584            OR (    (Recinfo.segment8 IS NULL)
585                AND (X_Segment8 IS NULL)))
586       AND (   (Recinfo.segment9 = X_Segment9)
587            OR (    (Recinfo.segment9 IS NULL)
588                AND (X_Segment9 IS NULL)))
589       AND (   (Recinfo.segment10 = X_Segment10)
590            OR (    (Recinfo.segment10 IS NULL)
591                AND (X_Segment10 IS NULL)))
592       AND (   (Recinfo.segment11 = X_Segment11)
593            OR (    (Recinfo.segment11 IS NULL)
594                AND (X_Segment11 IS NULL)))
595       AND (   (Recinfo.segment12 = X_Segment12)
596            OR (    (Recinfo.segment12 IS NULL)
597                AND (X_Segment12 IS NULL)))
598       AND (   (Recinfo.segment13 = X_Segment13)
599            OR (    (Recinfo.segment13 IS NULL)
600                AND (X_Segment13 IS NULL)))
601       AND (   (Recinfo.segment14 = X_Segment14)
602            OR (    (Recinfo.segment14 IS NULL)
603                AND (X_Segment14 IS NULL)))
604       AND (   (Recinfo.segment15 = X_Segment15)
605            OR (    (Recinfo.segment15 IS NULL)
606                AND (X_Segment15 IS NULL)))
607       AND (   (Recinfo.segment16 = X_Segment16)
608            OR (    (Recinfo.segment16 IS NULL)
609                AND (X_Segment16 IS NULL)))
610       AND (   (Recinfo.segment17 = X_Segment17)
611            OR (    (Recinfo.segment17 IS NULL)
612                AND (X_Segment17 IS NULL)))
613       AND (   (Recinfo.segment18 = X_Segment18)
614            OR (    (Recinfo.segment18 IS NULL)
615                AND (X_Segment18 IS NULL)))
616       AND (   (Recinfo.segment19 = X_Segment19)
617            OR (    (Recinfo.segment19 IS NULL)
618                AND (X_Segment19 IS NULL)))
619       AND (   (Recinfo.segment20 = X_Segment20)
620            OR (    (Recinfo.segment20 IS NULL)
621                AND (X_Segment20 IS NULL)))
622       AND (   (Recinfo.segment21 = X_Segment21)
623            OR (    (Recinfo.segment21 IS NULL)
624                AND (X_Segment21 IS NULL)))
625       AND (   (Recinfo.segment22 = X_Segment22)
626            OR (    (Recinfo.segment22 IS NULL)
627                AND (X_Segment22 IS NULL)))
628       AND (   (Recinfo.segment23 = X_Segment23)
629            OR (    (Recinfo.segment23 IS NULL)
630                AND (X_Segment23 IS NULL)))
631       AND (   (Recinfo.segment24 = X_Segment24)
632            OR (    (Recinfo.segment24 IS NULL)
633                AND (X_Segment24 IS NULL)))
634       AND (   (Recinfo.segment25 = X_Segment25)
635            OR (    (Recinfo.segment25 IS NULL)
636                AND (X_Segment25 IS NULL)))
637       AND (   (Recinfo.segment26 = X_Segment26)
638            OR (    (Recinfo.segment26 IS NULL)
639                AND (X_Segment26 IS NULL)))
640       AND (   (Recinfo.segment27 = X_Segment27)
641            OR (    (Recinfo.segment27 IS NULL)
642                AND (X_Segment27 IS NULL)))
643       AND (   (Recinfo.segment28 = X_Segment28)
644            OR (    (Recinfo.segment28 IS NULL)
645                AND (X_Segment28 IS NULL)))
646       AND (   (Recinfo.segment29 = X_Segment29)
647            OR (    (Recinfo.segment29 IS NULL)
648                AND (X_Segment29 IS NULL)))
649       AND (   (Recinfo.segment30 = X_Segment30)
650            OR (    (Recinfo.segment30 IS NULL)
651                AND (X_Segment30 IS NULL)))
652           ) then
653     return;
654   else
655     FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
656     APP_EXCEPTION.RAISE_EXCEPTION;
657   end if;
658 END Lock_Row;
659 
660 PROCEDURE Update_Row(X_Rowid                               VARCHAR2,
661                      X_Allocation_Formula_Id               NUMBER,
662                      X_Line_Number                         NUMBER,
663                      X_Line_Type                           VARCHAR2,
664                      X_Operator                            VARCHAR2,
665                      X_Last_Update_Date                    DATE,
666                      X_Last_Updated_By                     NUMBER,
667                      X_Last_Update_Login                   NUMBER,
668                      X_Amount                              NUMBER,
669                      X_Relative_Period                     VARCHAR2,
670                      X_Period_Name                         VARCHAR2,
671                      X_Transaction_Currency                VARCHAR2,
672                      X_Ledger_Currency                     VARCHAR2,
673                      X_Currency_Type                       VARCHAR2,
674                      X_Entered_Currency                    VARCHAR2,
675                      X_Actual_Flag                         VARCHAR2,
676                      X_Budget_Version_Id                   NUMBER,
677                      X_Encumbrance_Type_Id                 NUMBER,
678                      X_Amount_Type                         VARCHAR2,
679                      X_Ledger_Id                           NUMBER,
680                      X_Segment_Types_Key_Full              VARCHAR2,
681                      X_Segment_Break_Key                   VARCHAR2,
682                      X_Segment1                            VARCHAR2,
683                      X_Segment2                            VARCHAR2,
684                      X_Segment3                            VARCHAR2,
685                      X_Segment4                            VARCHAR2,
686                      X_Segment5                            VARCHAR2,
687                      X_Segment6                            VARCHAR2,
688                      X_Segment7                            VARCHAR2,
689                      X_Segment8                            VARCHAR2,
690                      X_Segment9                            VARCHAR2,
691                      X_Segment10                           VARCHAR2,
692                      X_Segment11                           VARCHAR2,
693                      X_Segment12                           VARCHAR2,
694                      X_Segment13                           VARCHAR2,
695                      X_Segment14                           VARCHAR2,
696                      X_Segment15                           VARCHAR2,
697                      X_Segment16                           VARCHAR2,
698                      X_Segment17                           VARCHAR2,
699                      X_Segment18                           VARCHAR2,
700                      X_Segment19                           VARCHAR2,
701                      X_Segment20                           VARCHAR2,
702                      X_Segment21                           VARCHAR2,
703                      X_Segment22                           VARCHAR2,
704                      X_Segment23                           VARCHAR2,
705                      X_Segment24                           VARCHAR2,
706                      X_Segment25                           VARCHAR2,
707                      X_Segment26                           VARCHAR2,
708                      X_Segment27                           VARCHAR2,
709                      X_Segment28                           VARCHAR2,
710                      X_Segment29                           VARCHAR2,
711                      X_Segment30                           VARCHAR2
712 ) IS
713 BEGIN
714   UPDATE GL_ALLOC_FORMULA_LINES
715   SET
716 
717     allocation_formula_id           =    X_Allocation_Formula_Id,
718     line_number                     =    X_Line_Number,
719     line_type                       =    X_Line_Type,
720     operator                        =    X_Operator,
721     last_update_date                =    X_Last_Update_Date,
722     last_updated_by                 =    X_Last_Updated_By,
723     last_update_login               =    X_Last_Update_Login,
724     amount                          =    X_Amount,
725     relative_period                 =    X_Relative_Period,
726     period_name                     =    X_Period_Name,
727     transaction_currency            =    X_Transaction_Currency,
728     ledger_currency                 =    X_Ledger_Currency,
729     currency_type                   =    X_Currency_Type,
730     entered_currency                =    X_Entered_Currency,
731     actual_flag                     =    X_Actual_Flag,
732     budget_version_id               =    X_Budget_Version_Id,
733     encumbrance_type_id             =    X_Encumbrance_Type_Id,
734     amount_type                     =    X_Amount_Type,
735     ledger_id                       =    X_Ledger_Id,
736     ledger_action_code              =    SUBSTR(X_Segment_Types_Key_Full, 1, 1),
737     segment_types_key               =    SUBSTR(X_Segment_Types_Key_Full, 3),
738     segment_break_key               =    X_Segment_Break_Key,
739     segment1                        =    X_Segment1,
740     segment2                        =    X_Segment2,
741     segment3                        =    X_Segment3,
742     segment4                        =    X_Segment4,
743     segment5                        =    X_Segment5,
744     segment6                        =    X_Segment6,
745     segment7                        =    X_Segment7,
746     segment8                        =    X_Segment8,
747     segment9                        =    X_Segment9,
748     segment10                       =    X_Segment10,
749     segment11                       =    X_Segment11,
750     segment12                       =    X_Segment12,
751     segment13                       =    X_Segment13,
752     segment14                       =    X_Segment14,
753     segment15                       =    X_Segment15,
754     segment16                       =    X_Segment16,
755     segment17                       =    X_Segment17,
756     segment18                       =    X_Segment18,
757     segment19                       =    X_Segment19,
758     segment20                       =    X_Segment20,
759     segment21                       =    X_Segment21,
760     segment22                       =    X_Segment22,
761     segment23                       =    X_Segment23,
762     segment24                       =    X_Segment24,
763     segment25                       =    X_Segment25,
764     segment26                       =    X_Segment26,
765     segment27                       =    X_Segment27,
766     segment28                       =    X_Segment28,
767     segment29                       =    X_Segment29,
768     segment30                       =    X_Segment30
769   WHERE rowid = X_rowid;
770 
771   if (SQL%NOTFOUND) then
772     RAISE NO_DATA_FOUND;
773   end if;
774 
775 END Update_Row;
776 
777 PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
778 BEGIN
779   DELETE FROM GL_ALLOC_FORMULA_LINES
780   WHERE  rowid = X_Rowid;
781 
782   if (SQL%NOTFOUND) then
783     RAISE NO_DATA_FOUND;
784   end if;
785 END Delete_Row;
786 
787 END gl_alloc_form_lines_pkg;