[Home] [Help]
PACKAGE BODY: APPS.GL_BUDGET_ENTITIES_PKG
Source
1 PACKAGE BODY gl_budget_entities_pkg AS
2 /* $Header: glibdorb.pls 120.8 2005/05/05 01:01:46 kvora ship $ */
3
4 --
5 -- PRIVATE FUNCTIONS
6 --
7
8 --
9 -- Procedure
10 -- select_row
11 -- Purpose
12 -- Used to select a particular budget organization row
13 -- History
14 -- 21-MAR-93 D. J. Ogg Created
15 -- Arguments
16 -- recinfo Various information about the row
17 -- Example
18 -- gl_budget_entities_pkg.select_row(recinfo)
19 -- Notes
20 --
21 PROCEDURE select_row( recinfo IN OUT NOCOPY gl_budget_entities%ROWTYPE) IS
22 BEGIN
23 SELECT *
24 INTO recinfo
25 FROM gl_budget_entities
26 WHERE budget_entity_id = recinfo.budget_entity_id;
27 END SELECT_ROW;
28
29
30 --
31 -- PUBLIC FUNCTIONS
32 --
33
34 PROCEDURE check_unique(lgr_id NUMBER, org_name VARCHAR2,
35 row_id VARCHAR2) IS
36 CURSOR chk_duplicates is
37 SELECT status_code
38 FROM GL_BUDGET_ENTITIES be
39 WHERE be.ledger_id = lgr_id
40 AND be.name = org_name
41 AND ( row_id is null
42 OR be.rowid <> row_id);
43 status_code VARCHAR2(1);
44 BEGIN
45 OPEN chk_duplicates;
46 FETCH chk_duplicates INTO status_code;
47
48 IF chk_duplicates%FOUND THEN
49 CLOSE chk_duplicates;
50 IF ( status_code = 'D' ) THEN
51 fnd_message.set_name('SQLGL', 'GL_DUP_BUD_ORG_DEL_INP');
52 app_exception.raise_exception;
53 ELSE
54 fnd_message.set_name('SQLGL', 'GL_DUPLICATE_BUD_ORG_NAME');
55 app_exception.raise_exception;
56 END IF;
57 END IF;
58
59 CLOSE chk_duplicates;
60
61 EXCEPTION
62 WHEN app_exceptions.application_exception THEN
63 RAISE;
64 WHEN OTHERS THEN
65 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
66 fnd_message.set_token('PROCEDURE',
67 'gl_budget_entities_pkg.check_unique');
68 RAISE;
69 END check_unique;
70
71 FUNCTION check_for_all(lgr_id NUMBER, row_id VARCHAR2) RETURN BOOLEAN IS
72 CURSOR check_for_all is
73 SELECT 'Exists'
74 FROM GL_BUDGET_ENTITIES be, gl_lookups l
75 WHERE l.lookup_type = 'LITERAL'
76 AND l.lookup_code = 'ALL'
77 AND upper(be.name) = upper(l.meaning)
78 AND be.ledger_id = lgr_id
79 AND ( row_id is null
80 OR be.rowid <> row_id);
81 dummy VARCHAR2(100);
82 BEGIN
83 OPEN check_for_all;
84 FETCH check_for_all INTO dummy;
85
86 IF check_for_all%FOUND THEN
87 CLOSE check_for_all;
88 return(TRUE);
89 ELSE
90 CLOSE check_for_all;
91 return(FALSE);
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_budget_entities_pkg.check_for_all');
101 RAISE;
102 END check_for_all;
103
104 FUNCTION has_ranges(org_id NUMBER) RETURN BOOLEAN IS
105 CURSOR check_for_ranges is
106 SELECT 'Has ranges'
107 FROM GL_BUDGET_ASSIGNMENT_RANGES bar
108 WHERE bar.budget_entity_id = org_id;
109 dummy VARCHAR2(100);
110 BEGIN
111 OPEN check_for_ranges;
112 FETCH check_for_ranges INTO dummy;
113
114 IF check_for_ranges%FOUND THEN
115 CLOSE check_for_ranges;
116 return(TRUE);
117 ELSE
118 CLOSE check_for_ranges;
119 return(FALSE);
120 END IF;
121
122 EXCEPTION
123 WHEN app_exceptions.application_exception THEN
124 RAISE;
125 WHEN OTHERS THEN
126 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
127 fnd_message.set_token('PROCEDURE',
128 'gl_budget_entities_pkg.has_ranges');
129 RAISE;
130 END has_ranges;
131
132 FUNCTION get_unique_id RETURN NUMBER IS
133 CURSOR get_new_id IS
134 SELECT gl_budget_entities_s.NEXTVAL
135 FROM dual;
136 new_id number;
137 BEGIN
138 OPEN get_new_id;
139 FETCH get_new_id INTO new_id;
140
141 IF get_new_id%FOUND THEN
142 CLOSE get_new_id;
143 return(new_id);
144 ELSE
145 CLOSE get_new_id;
146 fnd_message.set_name('SQLGL', 'GL_ERROR_GETTING_UNIQUE_ID');
147 fnd_message.set_token('SEQUENCE', 'GL_BUDGET_ENTITIES_S');
148 app_exception.raise_exception;
149 END IF;
150
151 EXCEPTION
152 WHEN app_exceptions.application_exception THEN
153 RAISE;
154 WHEN OTHERS THEN
155 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
156 fnd_message.set_token('PROCEDURE',
157 'gl_budget_entities_pkg.get_unique_id');
158 RAISE;
159 END get_unique_id;
160
161 PROCEDURE lock_organization(org_id NUMBER) IS
162 CURSOR lock_org is
163 SELECT 'Locked organization'
164 FROM GL_BUDGET_ENTITIES be
165 WHERE be.budget_entity_id = org_id
166 AND not be.status_code = 'D'
167 FOR UPDATE OF status_code;
168 dummy VARCHAR2(100);
169 BEGIN
170 OPEN lock_org;
171 FETCH lock_org INTO dummy;
172
173 IF NOT lock_org%FOUND THEN
174 CLOSE lock_org;
175 fnd_message.set_name('SQLGL', 'GL_BUDORG_DELETED');
176 app_exception.raise_exception;
177 END IF;
178
179 CLOSE lock_org;
180 EXCEPTION
181 WHEN app_exceptions.application_exception THEN
182 RAISE;
183 WHEN OTHERS THEN
184 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
185 fnd_message.set_token('PROCEDURE',
186 'gl_budget_entities_pkg.lock_organization');
187 RAISE;
188 END lock_organization;
189
190 PROCEDURE select_columns( entity_id NUMBER,
191 entity_name IN OUT NOCOPY VARCHAR2,
192 password_required_flag IN OUT NOCOPY VARCHAR2,
193 encrypted_password IN OUT NOCOPY VARCHAR2,
194 status_code IN OUT NOCOPY VARCHAR2
195 ) IS
196 recinfo gl_budget_entities%ROWTYPE;
197
198 BEGIN
199 recinfo.budget_entity_id := entity_id;
200
201 select_row(recinfo);
202
203 entity_name := recinfo.name;
204 password_required_flag := recinfo.budget_password_required_flag;
205 encrypted_password := recinfo.encrypted_budget_password;
206 status_code := recinfo.status_code;
207 END select_columns;
208
209 PROCEDURE budget_and_account_seg_info(
210 lgr_id NUMBER,
211 coa_id NUMBER,
212 x_budget_version_id IN OUT NOCOPY NUMBER,
213 x_budget_name IN OUT NOCOPY VARCHAR2,
214 x_bj_required IN OUT NOCOPY VARCHAR2,
215 x_segment_name OUT NOCOPY VARCHAR2) IS
216 BEGIN
217 IF (lgr_id IS NOT NULL) then
218 x_segment_name := gl_flexfields_pkg.get_account_segment(coa_id);
219 END IF;
220 gl_budget_utils_pkg.get_current_budget(lgr_id,
221 x_budget_version_id,
222 x_budget_name,
223 x_bj_required);
224 EXCEPTION
225 WHEN app_exceptions.application_exception THEN
226 RAISE;
227 WHEN OTHERS THEN
228 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
229 fnd_message.set_token('PROCEDURE',
230 'gl_budget_entities_pkg.budget_and_acount_seg_info');
231 RAISE;
232 END budget_and_account_seg_info;
233
234 --** Added Security_Flag for Definition Access Set enhancement
235 PROCEDURE Insert_Row(X_Rowid IN OUT NOCOPY VARCHAR2,
236 X_Budget_Entity_Id IN OUT NOCOPY NUMBER,
237 X_Name VARCHAR2,
238 X_Ledger_Id NUMBER,
239 X_Last_Update_Date DATE,
240 X_Last_Updated_By NUMBER,
241 X_Budget_Password_Required VARCHAR2,
242 X_Status_Code VARCHAR2,
243 X_Creation_Date DATE,
244 X_Created_By NUMBER,
245 X_Last_Update_Login NUMBER,
246 X_Encrypted_Budget_Password VARCHAR2,
247 X_Description VARCHAR2,
248 X_Start_Date DATE,
249 X_End_Date DATE,
250 X_Segment1_Type NUMBER,
251 X_Segment2_Type NUMBER,
252 X_Segment3_Type NUMBER,
253 X_Segment4_Type NUMBER,
254 X_Segment5_Type NUMBER,
255 X_Segment6_Type NUMBER,
256 X_Segment7_Type NUMBER,
257 X_Segment8_Type NUMBER,
258 X_Segment9_Type NUMBER,
259 X_Segment10_Type NUMBER,
260 X_Segment11_Type NUMBER,
261 X_Segment12_Type NUMBER,
262 X_Segment13_Type NUMBER,
263 X_Segment14_Type NUMBER,
264 X_Segment15_Type NUMBER,
265 X_Segment16_Type NUMBER,
266 X_Segment17_Type NUMBER,
267 X_Segment18_Type NUMBER,
268 X_Segment19_Type NUMBER,
269 X_Segment20_Type NUMBER,
270 X_Segment21_Type NUMBER,
271 X_Segment22_Type NUMBER,
272 X_Segment23_Type NUMBER,
273 X_Segment24_Type NUMBER,
274 X_Segment25_Type NUMBER,
275 X_Segment26_Type NUMBER,
276 X_Segment27_Type NUMBER,
277 X_Segment28_Type NUMBER,
278 X_Segment29_Type NUMBER,
279 X_Segment30_Type NUMBER,
280 X_Attribute1 VARCHAR2,
281 X_Attribute2 VARCHAR2,
282 X_Attribute3 VARCHAR2,
283 X_Attribute4 VARCHAR2,
284 X_Attribute5 VARCHAR2,
285 X_Attribute6 VARCHAR2,
286 X_Attribute7 VARCHAR2,
287 X_Attribute8 VARCHAR2,
288 X_Attribute9 VARCHAR2,
289 X_Attribute10 VARCHAR2,
290 X_Context VARCHAR2,
291 X_All_Name BOOLEAN,
292 X_Chart_Of_Accounts_Id NUMBER,
293 X_Security_Flag VARCHAR2
294 ) IS
295 CURSOR C IS SELECT rowid FROM gl_budget_entities
296 WHERE budget_entity_id = X_Budget_Entity_Id;
297
298 L_Status_Code VARCHAR2(1);
299
300 BEGIN
301 -- Make sure only one ALL organization
302 IF (X_All_Name AND
303 gl_budget_entities_pkg.check_for_all(
304 X_Ledger_Id,
305 X_Rowid)) THEN
306 fnd_message.set_name('SQLGL', 'GL_BUDGET_ONLY_ONE_ALL');
307 app_exception.raise_exception;
308 END IF;
309
310 -- Set budget_entity_id
311 -- Changed functionality to retrieve id from sequence only if
312 -- routine is not called from the iSpeed API, since the API
313 -- retrieves and passes in the id.
314
315 IF (X_Status_Code = 'ISPEED') THEN
316 L_Status_Code := 'C';
317 ELSE
318 L_Status_Code := X_Status_Code;
319 END IF;
320
321 -- Insert the corresponding rows in gl_entity_budgets.
322 gl_entity_budgets_pkg.insert_entity(
323 X_Budget_Entity_Id,
324 X_Ledger_Id,
325 X_Last_Updated_By,
326 X_Last_Update_Login);
327
328 -- Insert a budget timestamp for the chart of accounts,
329 -- if necessary.
330 gl_bc_event_tstamps_pkg.insert_event_timestamp(
331 X_Chart_Of_Accounts_Id,
332 'B',
333 X_Last_Updated_By,
334 X_Last_Update_Login);
335
336
337 INSERT INTO gl_budget_entities(
338
339 budget_entity_id,
340 name,
341 ledger_id,
342 last_update_date,
343 last_updated_by,
344 budget_password_required_flag,
345 status_code,
346 creation_date,
347 created_by,
348 last_update_login,
349 encrypted_budget_password,
350 description,
351 start_date,
352 end_date,
353 segment1_type,
354 segment2_type,
355 segment3_type,
356 segment4_type,
357 segment5_type,
358 segment6_type,
359 segment7_type,
360 segment8_type,
361 segment9_type,
362 segment10_type,
363 segment11_type,
364 segment12_type,
365 segment13_type,
366 segment14_type,
367 segment15_type,
368 segment16_type,
369 segment17_type,
370 segment18_type,
371 segment19_type,
372 segment20_type,
373 segment21_type,
374 segment22_type,
375 segment23_type,
376 segment24_type,
377 segment25_type,
378 segment26_type,
379 segment27_type,
380 segment28_type,
381 segment29_type,
382 segment30_type,
383 attribute1,
384 attribute2,
385 attribute3,
386 attribute4,
387 attribute5,
388 attribute6,
389 attribute7,
390 attribute8,
391 attribute9,
392 attribute10,
393 context,
394 security_flag)
395 VALUES (
396
397 X_Budget_Entity_Id,
398 X_Name,
399 X_Ledger_Id,
400 X_Last_Update_Date,
401 X_Last_Updated_By,
402 X_Budget_Password_Required,
403 L_Status_Code,
404 X_Creation_Date,
405 X_Created_By,
406 X_Last_Update_Login,
407 X_Encrypted_Budget_Password,
408 X_Description,
409 X_Start_Date,
410 X_End_Date,
411 X_Segment1_Type,
412 X_Segment2_Type,
413 X_Segment3_Type,
414 X_Segment4_Type,
415 X_Segment5_Type,
416 X_Segment6_Type,
417 X_Segment7_Type,
418 X_Segment8_Type,
419 X_Segment9_Type,
420 X_Segment10_Type,
421 X_Segment11_Type,
422 X_Segment12_Type,
423 X_Segment13_Type,
424 X_Segment14_Type,
425 X_Segment15_Type,
426 X_Segment16_Type,
427 X_Segment17_Type,
428 X_Segment18_Type,
429 X_Segment19_Type,
430 X_Segment20_Type,
431 X_Segment21_Type,
432 X_Segment22_Type,
433 X_Segment23_Type,
434 X_Segment24_Type,
435 X_Segment25_Type,
436 X_Segment26_Type,
437 X_Segment27_Type,
438 X_Segment28_Type,
439 X_Segment29_Type,
440 X_Segment30_Type,
441 X_Attribute1,
442 X_Attribute2,
443 X_Attribute3,
444 X_Attribute4,
445 X_Attribute5,
446 X_Attribute6,
447 X_Attribute7,
448 X_Attribute8,
449 X_Attribute9,
450 X_Attribute10,
451 X_Context,
452 X_Security_Flag);
453
454 OPEN C;
455 FETCH C INTO X_Rowid;
456 if (C%NOTFOUND) then
457 CLOSE C;
458 Raise NO_DATA_FOUND;
459 end if;
460 CLOSE C;
461
462 EXCEPTION
463 WHEN app_exceptions.application_exception THEN
464 RAISE;
465 WHEN OTHERS THEN
466 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
467 fnd_message.set_token('PROCEDURE',
468 'gl_budget_entities_pkg.insert_row');
469 RAISE;
470 END Insert_Row;
471
472 --** Added Security_Flag for Definition Access Set enhancement
473 PROCEDURE Update_Row(X_Rowid VARCHAR2,
474
475 X_Budget_Entity_Id NUMBER,
476 X_Name VARCHAR2,
477 X_Ledger_Id NUMBER,
478 X_Last_Update_Date DATE,
479 X_Last_Updated_By NUMBER,
480 X_Budget_Password_Required VARCHAR2,
481 X_Status_Code VARCHAR2,
482 X_Last_Update_Login NUMBER,
483 X_Encrypted_Budget_Password VARCHAR2,
484 X_Description VARCHAR2,
485 X_Start_Date DATE,
486 X_End_Date DATE,
487 X_Segment1_Type NUMBER,
488 X_Segment2_Type NUMBER,
489 X_Segment3_Type NUMBER,
490 X_Segment4_Type NUMBER,
491 X_Segment5_Type NUMBER,
492 X_Segment6_Type NUMBER,
493 X_Segment7_Type NUMBER,
494 X_Segment8_Type NUMBER,
495 X_Segment9_Type NUMBER,
496 X_Segment10_Type NUMBER,
497 X_Segment11_Type NUMBER,
498 X_Segment12_Type NUMBER,
499 X_Segment13_Type NUMBER,
500 X_Segment14_Type NUMBER,
501 X_Segment15_Type NUMBER,
502 X_Segment16_Type NUMBER,
503 X_Segment17_Type NUMBER,
504 X_Segment18_Type NUMBER,
505 X_Segment19_Type NUMBER,
506 X_Segment20_Type NUMBER,
507 X_Segment21_Type NUMBER,
508 X_Segment22_Type NUMBER,
509 X_Segment23_Type NUMBER,
510 X_Segment24_Type NUMBER,
511 X_Segment25_Type NUMBER,
512 X_Segment26_Type NUMBER,
513 X_Segment27_Type NUMBER,
514 X_Segment28_Type NUMBER,
515 X_Segment29_Type NUMBER,
516 X_Segment30_Type NUMBER,
517 X_Attribute1 VARCHAR2,
518 X_Attribute2 VARCHAR2,
519 X_Attribute3 VARCHAR2,
520 X_Attribute4 VARCHAR2,
521 X_Attribute5 VARCHAR2,
522 X_Attribute6 VARCHAR2,
523 X_Attribute7 VARCHAR2,
524 X_Attribute8 VARCHAR2,
525 X_Attribute9 VARCHAR2,
526 X_Attribute10 VARCHAR2,
527 X_Context VARCHAR2,
528 X_All_Name BOOLEAN,
529 X_Security_Flag VARCHAR2
530
531 ) IS
532 BEGIN
533
534 -- Make sure only one ALL organization
535 IF (X_All_Name AND
536 gl_budget_entities_pkg.check_for_all(
537 X_Ledger_Id,
538 X_Rowid)) THEN
539 fnd_message.set_name('SQLGL', 'GL_BUDGET_ONLY_ONE_ALL');
540 app_exception.raise_exception;
541 END IF;
542
543 UPDATE gl_budget_entities
544 SET
545 budget_entity_id = X_Budget_Entity_Id,
546 name = X_Name,
547 ledger_id = X_Ledger_Id,
548 last_update_date = X_Last_Update_Date,
549 last_updated_by = X_Last_Updated_By,
550 budget_password_required_flag = X_Budget_Password_Required,
551 status_code = X_Status_Code,
552 last_update_login = X_Last_Update_Login,
553 encrypted_budget_password = X_Encrypted_Budget_Password,
554 description = X_Description,
555 start_date = X_Start_Date,
556 end_date = X_End_Date,
557 segment1_type = X_Segment1_Type,
558 segment2_type = X_Segment2_Type,
559 segment3_type = X_Segment3_Type,
560 segment4_type = X_Segment4_Type,
561 segment5_type = X_Segment5_Type,
562 segment6_type = X_Segment6_Type,
563 segment7_type = X_Segment7_Type,
564 segment8_type = X_Segment8_Type,
565 segment9_type = X_Segment9_Type,
566 segment10_type = X_Segment10_Type,
567 segment11_type = X_Segment11_Type,
568 segment12_type = X_Segment12_Type,
569 segment13_type = X_Segment13_Type,
570 segment14_type = X_Segment14_Type,
571 segment15_type = X_Segment15_Type,
572 segment16_type = X_Segment16_Type,
573 segment17_type = X_Segment17_Type,
574 segment18_type = X_Segment18_Type,
575 segment19_type = X_Segment19_Type,
576 segment20_type = X_Segment20_Type,
577 segment21_type = X_Segment21_Type,
578 segment22_type = X_Segment22_Type,
579 segment23_type = X_Segment23_Type,
580 segment24_type = X_Segment24_Type,
581 segment25_type = X_Segment25_Type,
582 segment26_type = X_Segment26_Type,
583 segment27_type = X_Segment27_Type,
584 segment28_type = X_Segment28_Type,
585 segment29_type = X_Segment29_Type,
586 segment30_type = X_Segment30_Type,
587 attribute1 = X_Attribute1,
588 attribute2 = X_Attribute2,
589 attribute3 = X_Attribute3,
590 attribute4 = X_Attribute4,
591 attribute5 = X_Attribute5,
592 attribute6 = X_Attribute6,
593 attribute7 = X_Attribute7,
594 attribute8 = X_Attribute8,
595 attribute9 = X_Attribute9,
596 attribute10 = X_Attribute10,
597 context = X_Context,
598 security_flag = X_Security_Flag
599 WHERE rowid = X_Rowid;
600
601 if (SQL%NOTFOUND) then
602 Raise NO_DATA_FOUND;
603 end if;
604 EXCEPTION
605 WHEN app_exceptions.application_exception THEN
606 RAISE;
607 WHEN OTHERS THEN
608 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
609 fnd_message.set_token('PROCEDURE',
610 'gl_budget_entities_pkg.update_row');
611 RAISE;
612 END Update_Row;
613
614 --** Added for Definition Access Set enhancement
615 PROCEDURE Lock_Row (X_Rowid IN OUT NOCOPY VARCHAR2,
616 X_Budget_Entity_Id IN OUT NOCOPY NUMBER,
617 X_Name VARCHAR2,
618 X_Ledger_Id NUMBER,
619 X_Budget_Password_Required VARCHAR2,
620 X_Status_Code VARCHAR2,
621 X_Encrypted_Budget_Password VARCHAR2,
622 X_Description VARCHAR2,
623 X_Start_Date DATE,
624 X_End_Date DATE,
625 X_Segment1_Type NUMBER,
626 X_Segment2_Type NUMBER,
627 X_Segment3_Type NUMBER,
628 X_Segment4_Type NUMBER,
629 X_Segment5_Type NUMBER,
630 X_Segment6_Type NUMBER,
631 X_Segment7_Type NUMBER,
632 X_Segment8_Type NUMBER,
633 X_Segment9_Type NUMBER,
634 X_Segment10_Type NUMBER,
635 X_Segment11_Type NUMBER,
636 X_Segment12_Type NUMBER,
637 X_Segment13_Type NUMBER,
638 X_Segment14_Type NUMBER,
639 X_Segment15_Type NUMBER,
640 X_Segment16_Type NUMBER,
641 X_Segment17_Type NUMBER,
642 X_Segment18_Type NUMBER,
643 X_Segment19_Type NUMBER,
644 X_Segment20_Type NUMBER,
645 X_Segment21_Type NUMBER,
646 X_Segment22_Type NUMBER,
647 X_Segment23_Type NUMBER,
648 X_Segment24_Type NUMBER,
649 X_Segment25_Type NUMBER,
650 X_Segment26_Type NUMBER,
651 X_Segment27_Type NUMBER,
652 X_Segment28_Type NUMBER,
653 X_Segment29_Type NUMBER,
654 X_Segment30_Type NUMBER,
655 X_Attribute1 VARCHAR2,
656 X_Attribute2 VARCHAR2,
657 X_Attribute3 VARCHAR2,
658 X_Attribute4 VARCHAR2,
659 X_Attribute5 VARCHAR2,
660 X_Attribute6 VARCHAR2,
661 X_Attribute7 VARCHAR2,
662 X_Attribute8 VARCHAR2,
663 X_Attribute9 VARCHAR2,
664 X_Attribute10 VARCHAR2,
665 X_Context VARCHAR2,
666 X_Security_Flag VARCHAR2
667 ) IS
668 CURSOR C IS SELECT
669 Budget_Entity_Id ,
670 Name,
671 Ledger_Id,
672 Budget_Password_Required_Flag,
673 Status_Code,
674 Encrypted_Budget_Password,
675 Description,
676 Start_Date,
677 End_Date,
678 Segment1_Type,
679 Segment2_Type,
680 Segment3_Type,
681 Segment4_Type,
682 Segment5_Type,
683 Segment6_Type,
684 Segment7_Type,
685 Segment8_Type,
686 Segment9_Type,
687 Segment10_Type,
688 Segment11_Type,
689 Segment12_Type,
690 Segment13_Type,
691 Segment14_Type,
692 Segment15_Type,
693 Segment16_Type,
694 Segment17_Type,
695 Segment18_Type,
696 Segment19_Type,
697 Segment20_Type,
698 Segment21_Type,
699 Segment22_Type,
700 Segment23_Type,
701 Segment24_Type,
702 Segment25_Type,
703 Segment26_Type,
704 Segment27_Type,
705 Segment28_Type,
706 Segment29_Type,
707 Segment30_Type,
708 Attribute1,
709 Attribute2,
710 Attribute3,
711 Attribute4,
712 Attribute5,
713 Attribute6,
714 Attribute7,
715 Attribute8,
716 Attribute9,
717 Attribute10,
718 Context,
719 Security_Flag
720 FROM Gl_Budget_Entities
721 WHERE ROWID = X_Rowid
722 FOR UPDATE OF Budget_Entity_Id NOWAIT;
723 recinfo C%ROWTYPE;
724
725 BEGIN
726 OPEN C;
727 FETCH C INTO recinfo;
728 IF (C%NOTFOUND) THEN
729 CLOSE C;
730 fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
731 app_exception.raise_exception;
732 END IF;
733 CLOSE C;
734
735 IF (
736 (recinfo.Budget_Entity_Id = X_Budget_Entity_Id)
737 AND (recinfo.Name = X_Name)
738 AND (recinfo.Ledger_Id = X_Ledger_Id)
739 AND (recinfo.Budget_Password_Required_Flag = X_Budget_Password_Required)
740 AND (recinfo.Status_Code = X_Status_Code)
741 AND (recinfo.Security_Flag = X_Security_Flag)
742
743 AND ((recinfo.Encrypted_Budget_Password = X_Encrypted_Budget_Password)
744 OR ((recinfo.Encrypted_Budget_Password is null)
745 AND (X_Encrypted_Budget_Password is null)))
746
747 AND ((recinfo.Description = X_Description)
748 OR ((recinfo.Description is null)
749 AND (X_Description is null)))
750
751 AND ((recinfo.Context = X_Context)
752 OR ((recinfo.Context is null)
753 AND (X_Context is null)))
754
755 AND ((recinfo.Start_Date = X_Start_Date)
756 OR ((recinfo.Start_Date is null)
757 AND (X_Start_Date is null)))
758
759 AND ((recinfo.End_Date = X_End_Date)
760 OR ((recinfo.End_Date is null)
761 AND (X_End_Date is null)))
762
763 AND ((recinfo.Segment1_Type = X_Segment1_Type)
764 OR ((recinfo.Segment1_Type is null)
765 AND (X_Segment1_Type is null)))
766
767 AND ((recinfo.Segment2_Type = X_Segment2_Type)
768 OR ((recinfo.Segment2_Type is null)
769 AND (X_Segment2_Type is null)))
770
771 AND ((recinfo.Segment3_Type = X_Segment3_Type)
772 OR ((recinfo.Segment3_Type is null)
773 AND (X_Segment3_Type is null)))
774
775 AND ((recinfo.Segment4_Type = X_Segment4_Type)
776 OR ((recinfo.Segment4_Type is null)
777 AND (X_Segment4_Type is null)))
778
779 AND ((recinfo.Segment5_Type = X_Segment5_Type)
780 OR ((recinfo.Segment5_Type is null)
781 AND (X_Segment5_Type is null)))
782
783 AND ((recinfo.Segment6_Type = X_Segment6_Type)
784 OR ((recinfo.Segment6_Type is null)
785 AND (X_Segment6_Type is null)))
786
787 AND ((recinfo.Segment7_Type = X_Segment7_Type)
788 OR ((recinfo.Segment7_Type is null)
789 AND (X_Segment7_Type is null)))
790
791 AND ((recinfo.Segment8_Type = X_Segment8_Type)
792 OR ((recinfo.Segment8_Type is null)
793 AND (X_Segment8_Type is null)))
794
795 AND ((recinfo.Segment9_Type = X_Segment9_Type)
796 OR ((recinfo.Segment9_Type is null)
797 AND (X_Segment9_Type is null)))
798
799 AND ((recinfo.Segment10_Type = X_Segment10_Type)
800 OR ((recinfo.Segment10_Type is null)
801 AND (X_Segment10_Type is null)))
802
803 AND ((recinfo.Segment11_Type = X_Segment11_Type)
804 OR ((recinfo.Segment11_Type is null)
805 AND (X_Segment11_Type is null)))
806
807 AND ((recinfo.Segment12_Type = X_Segment12_Type)
808 OR ((recinfo.Segment12_Type is null)
809 AND (X_Segment12_Type is null)))
810
811 AND ((recinfo.Segment13_Type = X_Segment13_Type)
812 OR ((recinfo.Segment13_Type is null)
813 AND (X_Segment13_Type is null)))
814
815 AND ((recinfo.Segment14_Type = X_Segment14_Type)
816 OR ((recinfo.Segment14_Type is null)
817 AND (X_Segment14_Type is null)))
818
819 AND ((recinfo.Segment15_Type = X_Segment15_Type)
820 OR ((recinfo.Segment15_Type is null)
821 AND (X_Segment15_Type is null)))
822
823 AND ((recinfo.Segment16_Type = X_Segment16_Type)
824 OR ((recinfo.Segment16_Type is null)
825 AND (X_Segment16_Type is null)))
826
827 AND ((recinfo.Segment17_Type = X_Segment17_Type)
828 OR ((recinfo.Segment17_Type is null)
829 AND (X_Segment17_Type is null)))
830
831 AND ((recinfo.Segment18_Type = X_Segment18_Type)
832 OR ((recinfo.Segment18_Type is null)
833 AND (X_Segment18_Type is null)))
834
835 AND ((recinfo.Segment19_Type = X_Segment19_Type)
836 OR ((recinfo.Segment19_Type is null)
837 AND (X_Segment19_Type is null)))
838
839 AND ((recinfo.Segment20_Type = X_Segment20_Type)
840 OR ((recinfo.Segment20_Type is null)
841 AND (X_Segment20_Type is null)))
842
843 AND ((recinfo.Segment21_Type = X_Segment21_Type)
844 OR ((recinfo.Segment21_Type is null)
845 AND (X_Segment21_Type is null)))
846
847 AND ((recinfo.Segment22_Type = X_Segment22_Type)
848 OR ((recinfo.Segment22_Type is null)
849 AND (X_Segment22_Type is null)))
850
851 AND ((recinfo.Segment23_Type = X_Segment23_Type)
852 OR ((recinfo.Segment23_Type is null)
853 AND (X_Segment23_Type is null)))
854
855 AND ((recinfo.Segment24_Type = X_Segment24_Type)
856 OR ((recinfo.Segment24_Type is null)
857 AND (X_Segment24_Type is null)))
858
859 AND ((recinfo.Segment25_Type = X_Segment25_Type)
860 OR ((recinfo.Segment25_Type is null)
861 AND (X_Segment25_Type is null)))
862
863 AND ((recinfo.Segment26_Type = X_Segment26_Type)
864 OR ((recinfo.Segment26_Type is null)
865 AND (X_Segment26_Type is null)))
866
867 AND ((recinfo.Segment27_Type = X_Segment27_Type)
868 OR ((recinfo.Segment27_Type is null)
869 AND (X_Segment27_Type is null)))
870
871 AND ((recinfo.Segment28_Type = X_Segment28_Type)
872 OR ((recinfo.Segment28_Type is null)
873 AND (X_Segment28_Type is null)))
874
875 AND ((recinfo.Segment29_Type = X_Segment29_Type)
876 OR ((recinfo.Segment29_Type is null)
877 AND (X_Segment29_Type is null)))
878
879 AND ((recinfo.Segment30_Type = X_Segment30_Type)
880 OR ((recinfo.Segment30_Type is null)
881 AND (X_Segment30_Type is null)))
882
883 AND ((recinfo.Attribute1 = X_Attribute1)
884 OR ((recinfo.Attribute1 is null)
885 AND (X_Attribute1 is null)))
886
887 AND ((recinfo.Attribute2 = X_Attribute2)
888 OR ((recinfo.Attribute2 is null)
889 AND (X_Attribute2 is null)))
890
891 AND ((recinfo.Attribute3 = X_Attribute3)
892 OR ((recinfo.Attribute3 is null)
893 AND (X_Attribute3 is null)))
894
895 AND ((recinfo.Attribute4 = X_Attribute4)
896 OR ((recinfo.Attribute4 is null)
897 AND (X_Attribute4 is null)))
898
899 AND ((recinfo.Attribute5 = X_Attribute5)
900 OR ((recinfo.Attribute5 is null)
901 AND (X_Attribute5 is null)))
902
903 AND ((recinfo.Attribute6 = X_Attribute6)
904 OR ((recinfo.Attribute6 is null)
905 AND (X_Attribute6 is null)))
906
907 AND ((recinfo.Attribute7 = X_Attribute7)
908 OR ((recinfo.Attribute7 is null)
909 AND (X_Attribute7 is null)))
910
911 AND ((recinfo.Attribute8 = X_Attribute8)
912 OR ((recinfo.Attribute8 is null)
913 AND (X_Attribute8 is null)))
914
915 AND ((recinfo.Attribute9 = X_Attribute9)
916 OR ((recinfo.Attribute9 is null)
917 AND (X_Attribute9 is null)))
918
919 AND ((recinfo.Attribute10 = X_Attribute10)
920 OR ((recinfo.Attribute10 is null)
921 AND (X_Attribute10 is null)))
922 ) THEN
923 return;
924 ELSE
925 fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
926 app_exception.raise_exception;
927 END IF;
928
929 END Lock_Row;
930
931 --** Modified call to Insert_Row
932 PROCEDURE Insert_Org(X_Rowid IN OUT NOCOPY VARCHAR2,
933 X_Budget_Entity_Id IN OUT NOCOPY NUMBER,
934 X_Name VARCHAR2,
935 X_Ledger_Id NUMBER,
936 X_Last_Update_Date DATE,
937 X_Last_Updated_By NUMBER,
938 X_Budget_Password_Required VARCHAR2,
939 X_Status_Code VARCHAR2,
940 X_Creation_Date DATE,
941 X_Created_By NUMBER,
942 X_Last_Update_Login NUMBER,
943 X_Encrypted_Budget_Password VARCHAR2,
944 X_Description VARCHAR2,
945 X_Start_Date DATE,
946 X_End_Date DATE,
947 X_Segment1_Type NUMBER,
948 X_Segment2_Type NUMBER,
949 X_Segment3_Type NUMBER,
950 X_Segment4_Type NUMBER,
951 X_Segment5_Type NUMBER,
952 X_Segment6_Type NUMBER,
953 X_Segment7_Type NUMBER,
954 X_Segment8_Type NUMBER,
955 X_Segment9_Type NUMBER,
956 X_Segment10_Type NUMBER,
957 X_Segment11_Type NUMBER,
958 X_Segment12_Type NUMBER,
959 X_Segment13_Type NUMBER,
960 X_Segment14_Type NUMBER,
961 X_Segment15_Type NUMBER,
962 X_Segment16_Type NUMBER,
963 X_Segment17_Type NUMBER,
964 X_Segment18_Type NUMBER,
965 X_Segment19_Type NUMBER,
966 X_Segment20_Type NUMBER,
967 X_Segment21_Type NUMBER,
968 X_Segment22_Type NUMBER,
969 X_Segment23_Type NUMBER,
970 X_Segment24_Type NUMBER,
971 X_Segment25_Type NUMBER,
972 X_Segment26_Type NUMBER,
973 X_Segment27_Type NUMBER,
974 X_Segment28_Type NUMBER,
975 X_Segment29_Type NUMBER,
976 X_Segment30_Type NUMBER,
977 X_Attribute1 VARCHAR2,
978 X_Attribute2 VARCHAR2,
979 X_Attribute3 VARCHAR2,
980 X_Attribute4 VARCHAR2,
981 X_Attribute5 VARCHAR2,
982 X_Attribute6 VARCHAR2,
983 X_Attribute7 VARCHAR2,
984 X_Attribute8 VARCHAR2,
985 X_Attribute9 VARCHAR2,
986 X_Attribute10 VARCHAR2,
987 X_Context VARCHAR2
988 ) IS
989
990 L_All_Org BOOLEAN;
991 L_Coa_Id NUMBER(15);
992 L_Translated_All VARCHAR2(80);
993 L_Message VARCHAR2(240);
994
995 BEGIN
996
997 SELECT chart_of_accounts_id
998 INTO L_Coa_Id
999 FROM GL_LEDGERS
1000 WHERE ledger_id = X_Ledger_Id;
1001
1002 SELECT meaning
1003 INTO L_Translated_All
1004 FROM GL_LOOKUPS
1005 WHERE lookup_type = 'LITERAL'
1006 AND lookup_code = 'ALL';
1007
1008 IF (upper(X_Name) = L_Translated_All) THEN
1009 L_All_Org := TRUE;
1010 ELSE
1011 L_All_Org := FALSE;
1012 END IF;
1013
1014 GL_BUDGET_ENTITIES_PKG.Insert_Row(
1015 X_Rowid,
1016 X_Budget_Entity_Id,
1017 X_Name,
1018 X_Ledger_Id,
1019 X_Last_Update_Date,
1020 X_Last_Updated_By,
1021 X_Budget_Password_Required,
1022 X_Status_Code,
1023 X_Creation_Date,
1024 X_Created_By,
1025 X_Last_Update_Login,
1026 X_Encrypted_Budget_Password,
1027 X_Description,
1028 X_Start_Date,
1029 X_End_Date,
1030 X_Segment1_Type,
1031 X_Segment2_Type,
1032 X_Segment3_Type,
1033 X_Segment4_Type,
1034 X_Segment5_Type,
1035 X_Segment6_Type,
1036 X_Segment7_Type,
1037 X_Segment8_Type,
1038 X_Segment9_Type,
1039 X_Segment10_Type,
1040 X_Segment11_Type,
1041 X_Segment12_Type,
1042 X_Segment13_Type,
1043 X_Segment14_Type,
1044 X_Segment15_Type,
1045 X_Segment16_Type,
1046 X_Segment17_Type,
1047 X_Segment18_Type,
1048 X_Segment19_Type,
1049 X_Segment20_Type,
1050 X_Segment21_Type,
1051 X_Segment22_Type,
1052 X_Segment23_Type,
1053 X_Segment24_Type,
1054 X_Segment25_Type,
1055 X_Segment26_Type,
1056 X_Segment27_Type,
1057 X_Segment28_Type,
1058 X_Segment29_Type,
1059 X_Segment30_Type,
1060 X_Attribute1,
1061 X_Attribute2,
1062 X_Attribute3,
1063 X_Attribute4,
1064 X_Attribute5,
1065 X_Attribute6,
1066 X_Attribute7,
1067 X_Attribute8,
1068 X_Attribute9,
1069 X_Attribute10,
1070 X_Context,
1071 L_All_Org,
1072 L_Coa_Id,
1073 'N');
1074 EXCEPTION
1075 WHEN app_exceptions.application_exception THEN
1076 RAISE;
1077 WHEN OTHERS THEN
1078 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
1079 fnd_message.set_token('PROCEDURE',
1080 'GL_BUDGET_ENTITIES_PKG.Insert_Org');
1081 RAISE;
1082 END Insert_Org;
1083
1084
1085 FUNCTION Submit_Assign_Ranges_Request(
1086 X_Ledger_id IN VARCHAR2,
1087 X_Orgid IN VARCHAR2)
1088 return NUMBER IS
1089
1090 L_request_id NUMBER;
1091 request_failed EXCEPTION;
1092
1093 BEGIN
1094
1095 L_request_id := 0;
1096
1097 L_request_id := FND_REQUEST.SUBMIT_REQUEST(
1098 'SQLGL', 'GLBAAR', NULL, NULL, FALSE,
1099 X_Ledger_id, X_Orgid, chr(0),
1100 '', '', '', '', '', '', '', '', '', '',
1101 '', '', '', '', '', '', '', '', '', '',
1102 '', '', '', '', '', '', '', '', '', '',
1103 '', '', '', '', '', '', '', '', '', '',
1104 '', '', '', '', '', '', '', '', '', '',
1105 '', '', '', '', '', '', '', '', '', '',
1106 '', '', '', '', '', '', '', '', '', '',
1107 '', '', '', '', '', '', '', '', '', '',
1108 '', '', '', '', '', '', '', '', '', '',
1109 '', '', '', '', '', '', '');
1110
1111 IF (L_request_id = 0) THEN
1112 RAISE request_failed;
1113 END IF;
1114
1115 RETURN (L_request_id);
1116
1117 EXCEPTION
1118 WHEN request_failed THEN
1119 RAISE;
1120 WHEN OTHERS THEN
1121 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
1122 fnd_message.set_token('PROCEDURE',
1123 'GL_BUDGET_ENTITIES_PKG.Insert_Org');
1124 RAISE;
1125
1126 END Submit_Assign_Ranges_Request;
1127
1128
1129 PROCEDURE Set_BC_Timestamp(X_Ledger_Id NUMBER) IS
1130
1131 L_User_Id NUMBER;
1132 L_Login_Id NUMBER;
1133 L_Coa_Id NUMBER;
1134
1135 BEGIN
1136
1137 L_User_Id := FND_GLOBAL.user_id;
1138 L_Login_Id := FND_GLOBAL.login_id;
1139
1140 SELECT chart_of_accounts_id
1141 INTO L_Coa_Id
1142 FROM gl_ledgers
1143 WHERE ledger_id = X_Ledger_Id;
1144
1145 GL_BC_EVENT_TSTAMPS_PKG.Set_Event_Timestamp(L_Coa_Id,
1146 'B',
1147 L_User_Id,
1148 L_Login_Id);
1149
1150 EXCEPTION
1151 WHEN app_exceptions.application_exception THEN
1152 RAISE;
1153 WHEN OTHERS THEN
1154 fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
1155 fnd_message.set_token('PROCEDURE',
1156 'GL_BUDGET_ORG_PKG.Set_BC_Timestamp');
1157 RAISE;
1158 END Set_BC_Timestamp;
1159
1160 END gl_budget_entities_pkg;