[Home] [Help]
PACKAGE BODY: APPS.FEM_BUSINESS_RULE_PVT
Source
1 PACKAGE BODY FEM_BUSINESS_RULE_PVT AS
2 /* $Header: FEMVBUSB.pls 120.12.12010000.2 2008/10/06 17:48:51 huli ship $ */
3
4 --------------------------------------------------------------------------------
5 -- PRIVATE CONSTANTS
6 --------------------------------------------------------------------------------
7 G_FEM constant varchar2(3) := 'FEM';
8 G_PKG_NAME constant varchar2(30) := 'FEM_BUSINESS_RULE_PVT';
9 G_BLOCK constant varchar2(80) := G_FEM||'.PLSQL.'||G_PKG_NAME;
10
11 -- Action Types
12 G_UNDEF_ACTION_TYPE constant number := -1;
13 G_DELETE_ACTION_TYPE constant number := 0;
14 G_DUPLICATE_ACTION_TYPE constant number := 1;
15 G_BACKUP_ACTION_TYPE constant number := 2;
16 G_REVERT_ACTION_TYPE constant number := 3;
17
18 -- Constants for default effective start and end dates if not specified
19 -- in profile options.
20 G_DEFAULT_START_DATE_NULL constant date := FND_DATE.Canonical_To_Date('1900/01/01');
21 G_DEFAULT_END_DATE_NULL constant date := FND_DATE.Canonical_To_Date('2500/01/01');
22
23 -- Log Level Constants
24 G_LOG_LEVEL_1 constant number := FND_LOG.Level_Statement;
25 G_LOG_LEVEL_2 constant number := FND_LOG.Level_Procedure;
26 G_LOG_LEVEL_3 constant number := FND_LOG.Level_Event;
27 G_LOG_LEVEL_4 constant number := FND_LOG.Level_Exception;
28 G_LOG_LEVEL_5 constant number := FND_LOG.Level_Error;
29 G_LOG_LEVEL_6 constant number := FND_LOG.Level_Unexpected;
30
31 G_PLSQL_COMPILATION_ERROR exception;
32 pragma exception_init(G_PLSQL_COMPILATION_ERROR,-6550);
33
34 --------------------------------------------------------------------------------
35 -- VARIABLE TYPE DEFINITIONS
36 --------------------------------------------------------------------------------
37 t_object_type_code FEM_OBJECT_TYPES.object_type_code%TYPE;
38 t_object_id FEM_OBJECT_CATALOG_B.object_id%TYPE;
39 t_object_name FEM_OBJECT_CATALOG_TL.object_name%TYPE;
40 t_folder_id FEM_OBJECT_CATALOG_B.folder_id%TYPE;
41 t_object_definition_id FEM_OBJECT_DEFINITION_B.object_definition_id%TYPE;
42 t_approval_status_code FEM_OBJECT_DEFINITION_B.approval_status_code%TYPE;
43
44 t_request_id FEM_WF_REQUESTS.wf_request_id%TYPE;
45 t_id number;
46
47 t_code FND_LOOKUP_VALUES.lookup_code%TYPE;
48 t_meaning FND_LOOKUP_VALUES.meaning%TYPE;
49
50 t_plsql_pkg_name FEM_OBJECT_TYPES.object_plsql_pkg_name%TYPE;
51
52 t_return_status varchar2(1);
53 t_msg_count number;
54 t_msg_data varchar2(2000);
55
56
57 --------------------------------------------------------------------------------
58 -- PRIVATE CURSORS
59 --------------------------------------------------------------------------------
60
61 -- Object Definitions in a Workflow Request
62 cursor req_obj_defs_cur(
63 p_request_id number
64 ,p_request_item_code varchar2
65 ,p_request_type_code varchar2
66 )
67 is
68 select req_def.object_definition_id
69 ,req_def.object_type_code
70 ,req_def.prev_approval_status_code
71 from fem_wf_requests req
72 ,fem_wf_req_object_defs req_def
73 ,fem_object_definition_b def
74 where req.wf_request_id = p_request_id
75 and req.wf_request_item_code = p_request_item_code
76 and req.wf_request_type_code = p_request_type_code
77 and req_def.wf_request_id = req.wf_request_id
78 and def.object_definition_id = req_def.object_definition_id
79 and def.old_approved_copy_flag = G_CURRENT_COPY;
80
81 -- Object Definitions in a Workflow Request with Denormalized Names
82 cursor info_obj_defs_cur(
83 p_request_id number
84 ,p_request_item_code varchar2
85 ,p_request_type_code varchar2
86 )
87 is
88 select def.object_definition_id
89 ,def.display_name as object_definition_name
90 ,def.old_approved_copy_obj_def_id
91 ,def.object_id
92 ,obj.object_name
93 ,obj.object_type_code
94 ,typ.object_type_name
95 ,obj.folder_id
96 ,fol.folder_name
97 ,typ.view_only_oa_function_name
98 from fem_wf_requests req
99 ,fem_wf_req_object_defs req_def
100 ,fem_object_definition_vl def
101 ,fem_object_catalog_vl obj
102 ,fem_object_types_vl typ
103 ,fem_folders_vl fol
104 where req.wf_request_id = p_request_id
105 and req.wf_request_item_code = p_request_item_code
106 and req.wf_request_type_code = p_request_type_code
107 and req_def.wf_request_id = req.wf_request_id
108 and def.object_definition_id = req_def.object_definition_id
109 and def.old_approved_copy_flag = G_CURRENT_COPY
110 and obj.object_id = def.object_id
111 and typ.object_type_code = obj.object_type_code
112 and fol.folder_id = obj.folder_id;
113
114
115 -- Overlapping Object Definitions under the same Object.
116 cursor overlapping_obj_defs_cur (
117 p_obj_id number
118 ,p_exclude_obj_def_id number
119 ,p_effective_start_date date
120 ,p_effective_end_date date
121 )
122 is
123 select def.object_definition_id
124 ,def.display_name as object_definition_name
125 ,def.object_id
126 ,obj.object_name
127 ,fol.folder_name
128 ,def.effective_start_date
129 ,def.effective_end_date
130 from fem_object_definition_vl def
131 ,fem_object_catalog_vl obj
132 ,fem_folders_vl fol
133 where def.object_id = obj.object_id
134 and fol.folder_id = obj.folder_id
135 and def.old_approved_copy_flag = G_CURRENT_COPY
136 and def.object_id = p_obj_id
137 and def.object_definition_id <> nvl(p_exclude_obj_def_id, -1)
138 and (
139 (
140 (def.effective_start_date <= p_effective_start_date)
141 and
142 (def.effective_end_date >= p_effective_start_date)
143 )
144 or
145 (
146 (def.effective_start_date <= p_effective_end_date)
147 and
148 (def.effective_end_date >= p_effective_end_date)
149 )
150 or
151 (
152 (def.effective_start_date >= p_effective_start_date)
153 and
154 (def.effective_end_date <= p_effective_end_date)
155 )
156 );
157
158
159 --------------------------------------------------------------------------------
160 -- PRIVATE SPECIFICATIONS
161 --------------------------------------------------------------------------------
162
163 PROCEDURE SetApprovalStatus (
164 p_obj_def_id in number
165 ,p_approval_status_code in varchar2 := FND_API.G_MISS_CHAR
166 ,p_approver_user_id in number := FND_API.G_MISS_NUM
167 ,p_approval_date in date := FND_API.G_MISS_DATE
168 );
169
170 FUNCTION GetApprovalStatus(
171 p_obj_def_id in number
172 )
173 RETURN varchar2;
174
175 FUNCTION GetObjectPlsqlPkgName(
176 p_object_type_code in varchar2
177 )
178 RETURN varchar2;
179
180 PROCEDURE CopyObjectDefinitionInternal (
181 p_copy_type_code in varchar2
182 ,p_object_type_code in varchar2
183 ,p_source_obj_def_id in number
184 ,p_target_obj_def_id in number
185 ,p_target_copy_flag in varchar2
186 ,p_is_full_copy in boolean
187 ,p_is_new_copy in boolean
188 );
189
190 PROCEDURE DeleteObjectDefinitionInternal(
191 p_object_type_code in varchar2
192 ,p_obj_def_id in number
193 );
194
195 PROCEDURE CopyObjectDetailsInternal (
196 p_copy_type_code in varchar2
197 ,p_object_type_code in varchar2
198 ,p_source_obj_id in number
199 ,p_target_obj_id in number
200 );
201
202 PROCEDURE DeleteObjectDetailsInternal(
203 p_object_type_code in varchar2
204 ,p_obj_id in number
205 );
206
207 PROCEDURE CopyObjectRec (
208 p_source_obj_id in number
209 ,p_target_obj_id in number
210 ,p_target_obj_name in varchar2
211 ,p_target_obj_desc in varchar2 := FND_API.G_MISS_CHAR
212 ,p_created_by in number
213 ,p_creation_date in date
214 );
215
216 PROCEDURE DeleteObjectRec (
217 p_obj_id in number
218 );
219
220 PROCEDURE CopyObjectDefinitionRec (
221 p_source_obj_def_id in number
222 ,p_target_obj_def_id in number
223 ,p_target_obj_id in number := FND_API.G_MISS_NUM
224 ,p_target_obj_def_name in varchar2 := FND_API.G_MISS_CHAR
225 ,p_target_obj_def_desc in varchar2 := FND_API.G_MISS_CHAR
226 ,p_target_start_date in date := FND_API.G_MISS_DATE
227 ,p_target_end_date in date := FND_API.G_MISS_DATE
228 ,p_target_copy_flag in varchar2
229 ,p_target_copy_obj_def_id in number := FND_API.G_MISS_NUM
230 ,p_created_by in number
231 ,p_creation_date in date
232 );
233
234 PROCEDURE DeleteObjectDefinitionRec(
235 p_obj_def_id in number
236 );
237
238 PROCEDURE CopyObjectDependencyRecs(
239 p_source_obj_def_id in number
240 ,p_target_obj_def_id in number
241 ,p_created_by in number
242 ,p_creation_date in date
243 );
244
245 PROCEDURE DeleteObjectDependencyRecs(
246 p_obj_def_id in number
247 );
248
249 PROCEDURE CopyVtObjDefAttrRec(
250 p_source_obj_def_id in number
251 ,p_target_obj_def_id in number
252 ,p_created_by in number
253 ,p_creation_date in date
254 );
255
256 PROCEDURE DeleteVtObjDefAttrRec(
257 p_obj_def_id in number
258 );
259
260 PROCEDURE SetOldApprovedObjDefId(
261 p_obj_def_id in number
262 ,p_old_approved_obj_def_id in number
263 );
264
265 FUNCTION GetOldApprovedObjDefId (
266 p_obj_def_id in number
267 )
268 RETURN number;
269
270 FUNCTION ObjectDefinitionExists (
271 p_obj_def_id in number
272 )
273 RETURN boolean;
274
275 FUNCTION IsObjectEmpty(
276 p_obj_id in number
277 ,p_exclude_obj_def_id in number default null
278 )
279 RETURN boolean;
280
281 PROCEDURE CreateWfReqObjectDefRow (
282 p_wf_request_id in number
283 ,p_obj_def_id in number
284 ,p_object_type_code in varchar2
285 ,p_prev_approval_status_code in varchar2
286 );
287
288 FUNCTION GetObjectDefinitionsCount(
289 p_request_id in number
290 ,p_request_item_code in varchar2
291 ,p_request_type_code in varchar2
292 )
293 RETURN number;
294
295 PROCEDURE CheckOverlapObjDefsInternal(
296 p_obj_id in number
297 ,p_exclude_obj_def_id in number
298 ,p_effective_start_date in date
299 ,p_effective_end_date in date
300 ,p_action_type in number
301 );
302
303 PROCEDURE GetEffectiveDates(
304 p_obj_def_id in number
305 ,x_effective_start_date out nocopy date
306 ,x_effective_end_date out nocopy date
307 );
308
309 FUNCTION GetProfileOptionDateValue (
310 p_profile_option_name in varchar2
311 )
312 RETURN date;
313
314
315 --------------------------------------------------------------------------------
316 -- PUBLIC BODIES
317 --------------------------------------------------------------------------------
318
319 --
320 -- PROCEDURE
321 -- DeleteObjectDefinition
322 --
323 -- DESCRIPTION
324 -- Deletes a Business Rule Definition and all its detail records.
325 --
326 -- IN
327 -- p_api_version - API Version
328 -- p_init_msg_list - Initialize Message List Flag (Boolean)
329 -- p_commit - Commit Work Flag (Boolean)
330 -- p_object_type_code - Object Type Code
331 -- p_obj_def_id - Object Definition ID
332 -- p_process_type - Process Type (optional)
333 -- 0 = DEFAULT
334 -- 1 = WORKFLOW
335 --
336 -- OUT
337 -- x_return_status - Return Status of API Call
338 -- x_msg_count - Total Count of Error Messages in API Call
339 -- x_msg_data - Error Message in API Call
340 --
341 --------------------------------------------------------------------------------
342 PROCEDURE DeleteObjectDefinition (
343 p_api_version in number := 1.0
344 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
345 ,p_commit in varchar2 := FND_API.G_FALSE
346 ,x_return_status out nocopy varchar2
347 ,x_msg_count out nocopy number
348 ,x_msg_data out nocopy varchar2
349 ,p_object_type_code in varchar2
350 ,p_obj_def_id in number
351 ,p_process_type in number := G_DEFAULT
352 )
353 --------------------------------------------------------------------------------
354 IS
355
356 l_delete_request_id number;
357
358 BEGIN
359
360 DeleteObjectDefinition (
361 p_api_version => p_api_version
362 ,p_init_msg_list => p_init_msg_list
363 ,p_commit => p_commit
364 ,x_return_status => x_return_status
365 ,x_msg_count => x_msg_count
366 ,x_msg_data => x_msg_data
367 ,p_object_type_code => p_object_type_code
368 ,p_obj_def_id => p_obj_def_id
369 ,p_process_type => p_process_type
370 ,x_delete_request_id => l_delete_request_id
371 );
372
373 END DeleteObjectDefinition;
374
375 --
376 -- PROCEDURE
377 -- DeleteObjectDefinition
378 --
379 -- DESCRIPTION
380 -- Deletes a Business Rule Definition and all its detail records.
381 --
382 -- IN
383 -- p_api_version - API Version
384 -- p_init_msg_list - Initialize Message List Flag (Boolean)
385 -- p_commit - Commit Work Flag (Boolean)
386 -- p_object_type_code - Object Type Code
387 -- p_obj_def_id - Object Definition Id
388 -- p_process_type - Process Type (optional)
389 -- 0 = DEFAULT
390 -- 1 = WORKFLOW
391 --
392 -- OUT
393 -- x_return_status - Return Status of API Call
394 -- x_msg_count - Total Count of Error Messages in API Call
395 -- x_msg_data - Error Message in API Call
396 -- x_delete_request_id - Delete Request Id
397 --
398 --------------------------------------------------------------------------------
399 PROCEDURE DeleteObjectDefinition (
400 p_api_version in number := 1.0
401 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
402 ,p_commit in varchar2 := FND_API.G_FALSE
403 ,x_return_status out nocopy varchar2
404 ,x_msg_count out nocopy number
408 ,p_process_type in number := G_DEFAULT
405 ,x_msg_data out nocopy varchar2
406 ,p_object_type_code in varchar2
407 ,p_obj_def_id in number
409 ,x_delete_request_id out nocopy number
410 )
411 --------------------------------------------------------------------------------
412 IS
413
414 l_api_name constant varchar2(30) := 'DeleteObjectDefinition';
415 l_api_version constant number := 1.0;
416
417 l_obj_id t_object_id%TYPE;
418 l_old_approved_obj_def_id t_object_definition_id%TYPE;
419 l_approval_status_code t_approval_status_code%TYPE;
420
421 l_can_delete varchar2(1);
422
423 l_return_status t_return_status%TYPE;
424 l_msg_count t_msg_count%TYPE;
425 l_msg_data t_msg_data%TYPE;
426
427 l_prg_msg VARCHAR2(2000);
428 l_callstack VARCHAR2(2000);
429
430
431 BEGIN
432
433 -- Standard Start of API Savepoint
434 savepoint DeleteObjectDefinition_PVT;
435
436 -- Standard call to check for call compatibility
437 if not FND_API.Compatible_API_Call (
438 p_current_version_number => l_api_version
439 ,p_caller_version_number => p_api_version
440 ,p_api_name => l_api_name
441 ,p_pkg_name => G_PKG_NAME
442 ) then
443 raise FND_API.G_EXC_UNEXPECTED_ERROR;
444 end if;
445
446 -- Initialize Message Stack on FND_MSG_PUB
447 if (FND_API.To_Boolean(p_init_msg_list)) then
448 FND_MSG_PUB.Initialize;
449 end if;
450
451 FEM_ENGINES_PKG.Tech_Message (
452 p_severity => G_LOG_LEVEL_3
453 ,p_module => G_BLOCK||'.'||l_api_name
454 ,p_msg_text => 'BEGIN, p_object_type_code:' || p_object_type_code
455 || ' p_obj_def_id:' || p_obj_def_id
456 );
457
458 ------------------------------------------------
459 -- Initialize Package and Procedure Variables --
460 ------------------------------------------------
461 -- Initialize API return status to success
462 x_return_status := FND_API.G_RET_STS_SUCCESS;
463
464 -- Set Approval Request Id to null
465 x_delete_request_id := null;
466
467 -- Only perform the delete logic if the object definition exists
468 if (ObjectDefinitionExists(p_obj_def_id)) then
469
470 FEM_ENGINES_PKG.Tech_Message (
471 p_severity => G_LOG_LEVEL_3
472 ,p_module => G_BLOCK||'.'||l_api_name
473 ,p_msg_text => 'ObjectDefinitionExists');
474
475 -- Get the Object Id
476 l_obj_id := GetObjectId(p_obj_def_id);
477
478 FEM_ENGINES_PKG.Tech_Message (
479 p_severity => G_LOG_LEVEL_3
480 ,p_module => G_BLOCK||'.'||l_api_name
481 ,p_msg_text => 'l_obj_id:' || l_obj_id);
482
483 -- If this is the only Object Definition for the Object, then check to see
484 -- if we can delete the parent Object. Otherwise simply check to see if we
485 -- can delete the Object Definition.
486 if ((l_obj_id is not null) and IsObjectEmpty(l_obj_id,p_obj_def_id)) then
487
488 FEM_ENGINES_PKG.Tech_Message (
489 p_severity => G_LOG_LEVEL_3
490 ,p_module => G_BLOCK||'.'||l_api_name
491 ,p_msg_text => 'IsObjectEmpty');
492
493 -- Check to see if we can delete the Object (this will also check to see
494 -- if the last Object Definition can be deleted).
495 FEM_PL_PKG.can_delete_object (
496 p_api_version => 1.0
497 ,p_init_msg_list => FND_API.G_FALSE
498 ,x_return_status => l_return_status
499 ,x_msg_count => l_msg_count
500 ,x_msg_data => l_msg_data
501 ,p_object_id => l_obj_id
502 ,p_process_type => p_process_type
503 ,x_can_delete_obj => l_can_delete
504 );
505 FEM_ENGINES_PKG.Tech_Message (
506 p_severity => G_LOG_LEVEL_3
507 ,p_module => G_BLOCK||'.'||l_api_name
508 ,p_msg_text => 'IsObjectEmpty 1');
509
510 else
511
512 FEM_ENGINES_PKG.Tech_Message (
513 p_severity => G_LOG_LEVEL_3
514 ,p_module => G_BLOCK||'.'||l_api_name
515 ,p_msg_text => 'NOT IsObjectEmpty');
516
517 -- Check to see if we can delete the Object Definition
518 FEM_PL_PKG.can_delete_object_def (
519 p_api_version => 1.0
520 ,p_init_msg_list => FND_API.G_FALSE
521 ,x_return_status => l_return_status
522 ,x_msg_count => l_msg_count
523 ,x_msg_data => l_msg_data
524 ,p_object_definition_id => p_obj_def_id
525 ,p_process_type => p_process_type
526 ,x_can_delete_obj_def => l_can_delete
527 );
528
529 FEM_ENGINES_PKG.Tech_Message (
530 p_severity => G_LOG_LEVEL_3
531 ,p_module => G_BLOCK||'.'||l_api_name
532 ,p_msg_text => 'NOT IsObjectEmpty 1');
533 end if;
534
535 -- We can ignore l_can_delete as these FEM_PL_PKG API's now have the
536 -- x_return_status out param.
537 if (l_return_status = FND_API.G_RET_STS_ERROR) then
538 raise FND_API.G_EXC_ERROR;
539 elsif (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
543 FEM_ENGINES_PKG.Tech_Message (
540 raise FND_API.G_EXC_UNEXPECTED_ERROR;
541 end if;
542
544 p_severity => G_LOG_LEVEL_3
545 ,p_module => G_BLOCK||'.'||l_api_name
546 ,p_msg_text => 'Before GetApprovalStatus');
547
548 l_approval_status_code := GetApprovalStatus(p_obj_def_id);
549
550 FEM_ENGINES_PKG.Tech_Message (
551 p_severity => G_LOG_LEVEL_3
552 ,p_module => G_BLOCK||'.'||l_api_name
553 ,p_msg_text => 'After GetApprovalStatus');
554
555 if ( (p_process_type = G_DEFAULT)
556 and (l_approval_status_code in (G_APPROVED_STATUS,G_NOT_APPROVED_STATUS))
557 ) then
558
559 -- If business rule has ever gone through an approval process, then we
560 -- must submit this business rule for deletion by raising a delete
561 -- business event
562 FEM_ENGINES_PKG.Tech_Message (
563 p_severity => G_LOG_LEVEL_3
564 ,p_module => G_BLOCK||'.'||l_api_name
565 ,p_msg_text => 'Before SetApprovalStatus');
566
567
568 SetApprovalStatus (
569 p_obj_def_id => p_obj_def_id
570 ,p_approval_status_code => G_SUBMIT_DELETE_STATUS
571 );
572
573 FEM_ENGINES_PKG.Tech_Message (
574 p_severity => G_LOG_LEVEL_3
575 ,p_module => G_BLOCK||'.'||l_api_name
576 ,p_msg_text => 'After SetApprovalStatus');
577
578 x_delete_request_id :=
579 FEM_FEMAPPR_ITEM_TYPE.CreateWfRequestRow (
580 p_request_item_code => FEM_FEMAPPR_ITEM_TYPE.G_BUSINESS_RULE_ITEM
581 ,p_request_type_code => FEM_FEMAPPR_ITEM_TYPE.G_DELETE_TYPE
582 );
583
584 FEM_ENGINES_PKG.Tech_Message (
585 p_severity => G_LOG_LEVEL_3
586 ,p_module => G_BLOCK||'.'||l_api_name
587 ,p_msg_text => 'After FEM_FEMAPPR_ITEM_TYPE.CreateWfRequestRow x_delete_request_id:' || x_delete_request_id);
588
589 CreateWfReqObjectDefRow (
590 p_wf_request_id => x_delete_request_id
591 ,p_obj_def_id => p_obj_def_id
592 ,p_object_type_code => p_object_type_code
593 ,p_prev_approval_status_code => l_approval_status_code
594 );
595
596 FEM_ENGINES_PKG.Tech_Message (
597 p_severity => G_LOG_LEVEL_3
598 ,p_module => G_BLOCK||'.'||l_api_name
599 ,p_msg_text => 'After CreateWfReqObjectDefRow, l_approval_status_code:' || l_approval_status_code);
600
601
602 FEM_FEMAPPR_ITEM_TYPE.RaiseEvent (
603 p_event_name => FEM_FEMAPPR_ITEM_TYPE.G_BUSINESS_RULE_EVENT_DELETE
604 ,p_request_id => x_delete_request_id
605 ,p_user_id => FND_GLOBAL.User_Id
606 ,p_user_name => FND_GLOBAL.User_Name
607 ,p_responsibility_id => FND_GLOBAL.Resp_Id
608 ,p_application_id => FND_GLOBAL.Resp_Appl_Id
609 ,p_org_id => FND_GLOBAL.Org_Id
610 );
611
612 FEM_ENGINES_PKG.Tech_Message (
613 p_severity => G_LOG_LEVEL_3
614 ,p_module => G_BLOCK||'.'||l_api_name
615 ,p_msg_text => 'After FEM_FEMAPPR_ITEM_TYPE.RaiseEvent');
616
617 else
618
619 FEM_ENGINES_PKG.Tech_Message (
620 p_severity => G_LOG_LEVEL_3
621 ,p_module => G_BLOCK||'.'||l_api_name
622 ,p_msg_text => 'Before calling GetOldApprovedObjDefId ');
623
624 -- Otherwise, go through the regular delete processing
625
626 -- Get the Old Approved Copy before deleting the Current Copy
627 l_old_approved_obj_def_id := GetOldApprovedObjDefId(p_obj_def_id);
628
629 FEM_ENGINES_PKG.Tech_Message (
630 p_severity => G_LOG_LEVEL_3
631 ,p_module => G_BLOCK||'.'||l_api_name
632 ,p_msg_text => 'After calling l_old_approved_obj_def_id: ' || l_old_approved_obj_def_id);
633
634
635 -- Delete the Current Copy
636 DeleteObjectDefinitionInternal(
637 p_object_type_code => p_object_type_code
638 ,p_obj_def_id => p_obj_def_id
639 );
640
641
642 FEM_ENGINES_PKG.Tech_Message (
643 p_severity => G_LOG_LEVEL_3
644 ,p_module => G_BLOCK||'.'||l_api_name
645 ,p_msg_text => 'After DeleteObjectDefinitionInternal');
646
647 -- Delete the Old Approved Copy
648 if (l_old_approved_obj_def_id is not null) then
649
650 FEM_ENGINES_PKG.Tech_Message (
651 p_severity => G_LOG_LEVEL_3
652 ,p_module => G_BLOCK||'.'||l_api_name
653 ,p_msg_text => 'not null l_old_approved_obj_def_id Before DeleteObjectDefinitionInternal');
654
655 DeleteObjectDefinitionInternal(
656 p_object_type_code => p_object_type_code
657 ,p_obj_def_id => l_old_approved_obj_def_id
658 );
659
660
661 FEM_ENGINES_PKG.Tech_Message (
662 p_severity => G_LOG_LEVEL_3
663 ,p_module => G_BLOCK||'.'||l_api_name
664 ,p_msg_text => 'not null l_old_approved_obj_def_id After DeleteObjectDefinitionInternal');
665 end if;
666
667 -- Delete the Object if it no longer has any Object Definitions
668 if ((l_obj_id is not null) and IsObjectEmpty(l_obj_id)) then
669
673 ,p_msg_text => 'IsObjectEmpty 1 Before DeleteObjectDefinitionInternal, l_obj_id:' || l_obj_id);
670 FEM_ENGINES_PKG.Tech_Message (
671 p_severity => G_LOG_LEVEL_3
672 ,p_module => G_BLOCK||'.'||l_api_name
674
675 -- Delete any detail records of an Object if they exist
676 DeleteObjectDetailsInternal (
677 p_object_type_code => p_object_type_code
678 ,p_obj_id => l_obj_id
679 );
680
681
682 FEM_ENGINES_PKG.Tech_Message (
683 p_severity => G_LOG_LEVEL_3
684 ,p_module => G_BLOCK||'.'||l_api_name
685 ,p_msg_text => 'IsObjectEmpty 1 After DeleteObjectDefinitionInternal, l_obj_id:' || l_obj_id);
686 -- Delete the Object record
687 DeleteObjectRec(l_obj_id);
688
689 FEM_ENGINES_PKG.Tech_Message (
690 p_severity => G_LOG_LEVEL_3
691 ,p_module => G_BLOCK||'.'||l_api_name
692 ,p_msg_text => 'After DeleteObjectRec');
693
694 end if;
695
696 end if;
697
698 end if;
699
700 -----------------------
701 -- Finalize API Call --
702 -----------------------
703 -- Standard check of p_commit
704 if FND_API.To_Boolean(p_commit) then
705 commit work;
706 end if;
707
708 -- Standard call to get message count and if count is 1, get message info
709 FND_MSG_PUB.Count_And_Get (
710 p_count => x_msg_count
711 ,p_data => x_msg_data
712 );
713
714 FEM_ENGINES_PKG.Tech_Message (
715 p_severity => G_LOG_LEVEL_3
716 ,p_module => G_BLOCK||'.'||l_api_name
717 ,p_msg_text => 'END'
718 );
719
720 EXCEPTION
721
722 when FND_API.G_EXC_ERROR then
723 l_callstack := DBMS_UTILITY.Format_Call_Stack;
724 FEM_ENGINES_PKG.Tech_Message (
725 p_severity => G_LOG_LEVEL_6
726 ,p_module => G_BLOCK||'.'||l_api_name
727 ,p_msg_text => 'G_EXC_ERROR, l_callstack:' || l_callstack
728 );
729 BEGIN
730 ROLLBACK TO DeleteObjectDefinition_PVT;
731 EXCEPTION
732 WHEN OTHERS THEN rollback;
733 END;
734
735 x_return_status := FND_API.G_RET_STS_ERROR;
736 FND_MSG_PUB.Count_And_Get(
737 p_count => x_msg_count
738 ,p_data => x_msg_data
739 );
740
741 when FND_API.G_EXC_UNEXPECTED_ERROR then
742 l_callstack := DBMS_UTILITY.Format_Call_Stack;
743 FEM_ENGINES_PKG.Tech_Message (
744 p_severity => G_LOG_LEVEL_6
745 ,p_module => G_BLOCK||'.'||l_api_name
746 ,p_msg_text => 'G_EXC_UNEXPECTED_ERROR, l_callstack:' || l_callstack
747 );
748 BEGIN
749 ROLLBACK TO DeleteObjectDefinition_PVT;
750 EXCEPTION
751 WHEN OTHERS THEN rollback;
752 END;
753 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
754 FND_MSG_PUB.Count_And_Get(
755 p_count => x_msg_count
756 ,p_data => x_msg_data
757 );
758
759 when others then
760 l_callstack := DBMS_UTILITY.Format_Call_Stack;
761 l_prg_msg := SQLERRM;
762 FEM_ENGINES_PKG.Tech_Message (
763 p_severity => G_LOG_LEVEL_6
764 ,p_module => G_BLOCK||'.'||l_api_name
765 ,p_msg_text => 'others, l_callstack:' || l_callstack
766 );
767 FEM_ENGINES_PKG.Tech_Message (
768 p_severity => G_LOG_LEVEL_6
769 ,p_module => G_BLOCK||'.'||l_api_name
770 ,p_msg_text => 'others 1, l_prg_msg:' || l_prg_msg
771 );
772
773 BEGIN
774 ROLLBACK TO DeleteObjectDefinition_PVT;
775 EXCEPTION
776 WHEN OTHERS THEN rollback;
777 END;
778 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
779 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
780 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
781 end if;
782 FND_MSG_PUB.Count_And_Get(
783 p_count => x_msg_count
784 ,p_data => x_msg_data
785 );
786
787 END DeleteObjectDefinition;
788
789
790 --
791 -- PROCEDURE
792 -- DuplicateObjectDefinition
793 --
794 -- DESCRIPTION
795 -- Duplicates all the detail records of a Business Rule Definition (source)
796 -- into another empty Business Rule Definition (target).
797 -- NOTE: It does not copy the Business Rule Definition record in
798 -- FEM_OBJECT_DEFINITION_VL. That record must already exist.
799 --
800 -- IN
801 -- p_api_version - API Version
802 -- p_init_msg_list - Initialize Message List Flag (Boolean)
803 -- p_commit - Commit Work Flag (Boolean)
804 -- p_object_type_code - Object Type Code
805 -- p_source_obj_def_id - Source Object Definition ID
806 -- p_target_obj_def_id - Target Object Definition ID
807 --
808 -- OUT
809 -- x_return_status - Return Status of API Call
810 -- x_msg_count - Total Count of Error Messages in API Call
811 -- x_msg_data - Error Message in API Call
812 --
813 --------------------------------------------------------------------------------
814 PROCEDURE DuplicateObjectDefinition (
818 ,x_return_status out nocopy varchar2
815 p_api_version in number := 1.0
816 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
817 ,p_commit in varchar2 := FND_API.G_FALSE
819 ,x_msg_count out nocopy number
820 ,x_msg_data out nocopy varchar2
821 ,p_object_type_code in varchar2
822 ,p_source_obj_def_id in number
823 ,p_target_obj_def_id in number
824 )
825 --------------------------------------------------------------------------------
826 IS
827
828 l_api_name constant varchar2(30) := 'DuplicateObjectDefinition';
829 l_api_version constant number := 1.0;
830
831 BEGIN
832
833 -- Standard Start of API Savepoint
834 savepoint DuplicateObjectDefinition_PVT;
835
836 -- Standard call to check for call compatibility
837 if not FND_API.Compatible_API_Call (
838 p_current_version_number => l_api_version
839 ,p_caller_version_number => p_api_version
840 ,p_api_name => l_api_name
841 ,p_pkg_name => G_PKG_NAME
842 ) then
843 raise FND_API.G_EXC_UNEXPECTED_ERROR;
844 end if;
845
846 -- Initialize Message Stack on FND_MSG_PUB
847 if (FND_API.To_Boolean(p_init_msg_list)) then
848 FND_MSG_PUB.Initialize;
849 end if;
850
851 FEM_ENGINES_PKG.Tech_Message (
852 p_severity => G_LOG_LEVEL_2
853 ,p_module => G_BLOCK||'.'||l_api_name
854 ,p_msg_text => 'BEGIN'
855 );
856
857 ------------------------------------------------
858 -- Initialize Package and Procedure Variables --
859 ------------------------------------------------
860 -- Initialize API return status to success
861 x_return_status := FND_API.G_RET_STS_SUCCESS;
862
863 CopyObjectDefinitionInternal (
864 p_copy_type_code => G_DUPLICATE
865 ,p_object_type_code => p_object_type_code
866 ,p_source_obj_def_id => p_source_obj_def_id
867 ,p_target_obj_def_id => p_target_obj_def_id
868 ,p_target_copy_flag => G_CURRENT_COPY
869 ,p_is_full_copy => false
870 ,p_is_new_copy => true
871 );
872
873 -----------------------
874 -- Finalize API Call --
875 -----------------------
876 -- Standard check of p_commit
877 if FND_API.To_Boolean(p_commit) then
878 commit work;
879 end if;
880
881 -- Standard call to get message count and if count is 1, get message info
882 FND_MSG_PUB.Count_And_Get (
883 p_count => x_msg_count
884 ,p_data => x_msg_data
885 );
886
887 FEM_ENGINES_PKG.Tech_Message (
888 p_severity => G_LOG_LEVEL_2
889 ,p_module => G_BLOCK||'.'||l_api_name
890 ,p_msg_text => 'END'
891 );
892
893 EXCEPTION
894
895 when FND_API.G_EXC_ERROR then
896 rollback to DuplicateObjectDefinition_PVT;
897 x_return_status := FND_API.G_RET_STS_ERROR;
898 FND_MSG_PUB.Count_And_Get(
899 p_count => x_msg_count
900 ,p_data => x_msg_data
901 );
902
903 when FND_API.G_EXC_UNEXPECTED_ERROR then
904 rollback to DuplicateObjectDefinition_PVT;
905 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
906 FND_MSG_PUB.Count_And_Get(
907 p_count => x_msg_count
908 ,p_data => x_msg_data
909 );
910
911 when others then
912 rollback to DuplicateObjectDefinition_PVT;
913 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
914 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
915 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
916 end if;
917 FND_MSG_PUB.Count_And_Get(
918 p_count => x_msg_count
919 ,p_data => x_msg_data
920 );
921
922 END DuplicateObjectDefinition;
923
924
925 --
926 -- PROCEDURE
927 -- BackupObjectDefinition
928 --
929 -- DESCRIPTION
930 -- Creates a backup of a Business Rule Definition and all its detail records.
931 -- Returns the old approved copy object definition id.
932 --
933 -- IN
934 -- p_api_version - API Version
935 -- p_init_msg_list - Initialize Message List Flag (Boolean)
936 -- p_commit - Commit Work Flag (Boolean)
937 -- p_object_type_code - Object Type Code
938 -- p_obj_def_id - Object Definition ID
939 --
940 -- OUT
941 -- x_return_status - Return Status of API Call
942 -- x_msg_count - Total Count of Error Messages in API Call
943 -- x_msg_data - Error Message in API Call
944 -- x_old_approved_obj_def_id - Old Approved Copy Object Definition ID
945 --
946 --------------------------------------------------------------------------------
947 PROCEDURE BackupObjectDefinition (
948 p_api_version in number := 1.0
949 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
950 ,p_commit in varchar2 := FND_API.G_FALSE
951 ,x_return_status out nocopy varchar2
952 ,x_msg_count out nocopy number
953 ,x_msg_data out nocopy varchar2
954 ,p_object_type_code in varchar2
958 --------------------------------------------------------------------------------
955 ,p_obj_def_id in number
956 ,x_old_approved_obj_def_id out nocopy number
957 )
959 IS
960
961 l_api_name constant varchar2(30) := 'BackupObjectDefinition';
962 l_api_version constant number := 1.0;
963
964 l_old_approved_obj_def_id t_object_definition_id%TYPE;
965
966 BEGIN
967
968 -- Standard Start of API Savepoint
969 savepoint BackupObjectDefinition_PVT;
970
971 -- Standard call to check for call compatibility
972 if not FND_API.Compatible_API_Call (
973 p_current_version_number => l_api_version
974 ,p_caller_version_number => p_api_version
975 ,p_api_name => l_api_name
976 ,p_pkg_name => G_PKG_NAME
977 ) then
978 raise FND_API.G_EXC_UNEXPECTED_ERROR;
979 end if;
980
981 -- Initialize Message Stack on FND_MSG_PUB
982 if (FND_API.To_Boolean(p_init_msg_list)) then
983 FND_MSG_PUB.Initialize;
984 end if;
985
986 FEM_ENGINES_PKG.Tech_Message (
987 p_severity => G_LOG_LEVEL_2
988 ,p_module => G_BLOCK||'.'||l_api_name
989 ,p_msg_text => 'BEGIN'
990 );
991
992 ------------------------------------------------
993 -- Initialize Package and Procedure Variables --
994 ------------------------------------------------
995 -- Initialize API return status to success
996 x_return_status := FND_API.G_RET_STS_SUCCESS;
997
998 l_old_approved_obj_def_id := GetOldApprovedObjDefId(p_obj_def_id);
999
1000 if (l_old_approved_obj_def_id is null) then
1001
1002 l_old_approved_obj_def_id := GetNewObjDefId();
1003 SetOldApprovedObjDefId(p_obj_def_id, l_old_approved_obj_def_id);
1004
1005 else
1006
1007 DeleteObjectDefinitionInternal (
1008 p_object_type_code => p_object_type_code,
1009 p_obj_def_id => l_old_approved_obj_def_id
1010 );
1011
1012 end if;
1013
1014 CopyObjectDefinitionInternal (
1015 p_copy_type_code => G_BACKUP
1016 ,p_object_type_code => p_object_type_code
1017 ,p_source_obj_def_id => p_obj_def_id
1018 ,p_target_obj_def_id => l_old_approved_obj_def_id
1019 ,p_target_copy_flag => G_OLD_APPROVED_COPY
1020 ,p_is_full_copy => true
1021 ,p_is_new_copy => false
1022 );
1023
1024 x_old_approved_obj_def_id := l_old_approved_obj_def_id;
1025
1026 -----------------------
1027 -- Finalize API Call --
1028 -----------------------
1029 -- Standard check of p_commit
1030 if FND_API.To_Boolean(p_commit) then
1031 commit work;
1032 end if;
1033
1034 -- Standard call to get message count and if count is 1, get message info
1035 FND_MSG_PUB.Count_And_Get (
1036 p_count => x_msg_count
1037 ,p_data => x_msg_data
1038 );
1039
1040 FEM_ENGINES_PKG.Tech_Message (
1041 p_severity => G_LOG_LEVEL_2
1042 ,p_module => G_BLOCK||'.'||l_api_name
1043 ,p_msg_text => 'END'
1044 );
1045
1046 EXCEPTION
1047
1048 when FND_API.G_EXC_ERROR then
1049 rollback to BackupObjectDefinition_PVT;
1050 x_return_status := FND_API.G_RET_STS_ERROR;
1051 FND_MSG_PUB.Count_And_Get(
1052 p_count => x_msg_count
1053 ,p_data => x_msg_data
1054 );
1055
1056 when FND_API.G_EXC_UNEXPECTED_ERROR then
1057 rollback to BackupObjectDefinition_PVT;
1058 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1059 FND_MSG_PUB.Count_And_Get(
1060 p_count => x_msg_count
1061 ,p_data => x_msg_data
1062 );
1063
1064 when others then
1065 rollback to BackupObjectDefinition_PVT;
1066 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1067 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
1068 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1069 end if;
1070 FND_MSG_PUB.Count_And_Get(
1071 p_count => x_msg_count
1072 ,p_data => x_msg_data
1073 );
1074
1075 END BackupObjectDefinition;
1076
1077
1078 --
1079 -- PROCEDURE
1080 -- RevertObjectDefinition
1081 --
1082 -- DESCRIPTION
1083 -- Reverts a Business Rule Definition and all its detail records from its
1084 -- backup copy.
1085 --
1086 -- IN
1087 -- p_api_version - API Version
1088 -- p_init_msg_list - Initialize Message List Flag (Boolean)
1089 -- p_commit - Commit Work Flag (Boolean)
1090 -- p_object_type_code - Object Type Code
1091 -- p_obj_def_id - Object Definition ID
1092 --
1093 -- OUT
1094 -- x_return_status - Return Status of API Call
1095 -- x_msg_count - Total Count of Error Messages in API Call
1096 -- x_msg_data - Error Message in API Call
1097 --
1098 --------------------------------------------------------------------------------
1099 PROCEDURE RevertObjectDefinition (
1100 p_api_version in number := 1.0
1101 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
1102 ,p_commit in varchar2 := FND_API.G_FALSE
1106 ,p_object_type_code in varchar2
1103 ,x_return_status out nocopy varchar2
1104 ,x_msg_count out nocopy number
1105 ,x_msg_data out nocopy varchar2
1107 ,p_obj_def_id in number
1108 )
1109 --------------------------------------------------------------------------------
1110 IS
1111
1112 l_api_name constant varchar2(30) := 'RevertObjectDefinition';
1113 l_api_version constant number := 1.0;
1114
1115 l_old_approved_obj_def_id t_object_definition_id%TYPE;
1116 l_approval_status_code t_approval_status_code%TYPE;
1117 l_effective_start_date date;
1118 l_effective_end_date date;
1119 l_data_edit_lock_exists varchar2(1);
1120 l_overlap_exists boolean;
1121
1122 BEGIN
1123
1124 -- Standard Start of API Savepoint
1125 savepoint RevertObjectDefinition_PVT;
1126
1127 -- Standard call to check for call compatibility
1128 if not FND_API.Compatible_API_Call (
1129 p_current_version_number => l_api_version
1130 ,p_caller_version_number => p_api_version
1131 ,p_api_name => l_api_name
1132 ,p_pkg_name => G_PKG_NAME
1133 ) then
1134 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1135 end if;
1136
1137 -- Initialize Message Stack on FND_MSG_PUB
1138 if (FND_API.To_Boolean(p_init_msg_list)) then
1139 FND_MSG_PUB.Initialize;
1140 end if;
1141
1142 FEM_ENGINES_PKG.Tech_Message (
1143 p_severity => G_LOG_LEVEL_2
1144 ,p_module => G_BLOCK||'.'||l_api_name
1145 ,p_msg_text => 'BEGIN'
1146 );
1147
1148 ------------------------------------------------
1149 -- Initialize Package and Procedure Variables --
1150 ------------------------------------------------
1151 -- Initialize API return status to success
1152 x_return_status := FND_API.G_RET_STS_SUCCESS;
1153
1154 -- Check that the approval status is NOT_APPROVED
1155 l_approval_status_code := GetApprovalStatus(p_obj_def_id);
1156 if (l_approval_status_code <> G_NOT_APPROVED_STATUS) then
1157 FND_MESSAGE.set_name('FEM', 'FEM_BR_RVRT_NOT_APPROVED_ERR');
1158 FND_MSG_PUB.Add;
1159 raise FND_API.G_EXC_ERROR;
1160 end if;
1161
1162 -- Check that object definitions has an old approved copy
1163 l_old_approved_obj_def_id := GetOldApprovedObjDefId(p_obj_def_id);
1164 if (l_old_approved_obj_def_id is null) then
1165 FND_MESSAGE.set_name('FEM', 'FEM_BR_RVRT_OLD_APPR_CPY_ERR');
1166 FND_MSG_PUB.Add;
1167 raise FND_API.G_EXC_ERROR;
1168 end if;
1169
1170 -- Check for any Data Locks
1171 FEM_PL_PKG.obj_def_data_edit_lock_exists(
1172 p_object_definition_id => p_obj_def_id
1173 ,x_data_edit_lock_exists => l_data_edit_lock_exists
1174 );
1175
1176 if (FND_API.To_Boolean(l_data_edit_lock_exists)) then
1177 FND_MESSAGE.set_name('FEM', 'FEM_BR_RVRT_DATA_EDIT_LOCK_ERR');
1178 FND_MSG_PUB.Add;
1179 raise FND_API.G_EXC_ERROR;
1180 end if;
1181
1182 -- Get effective dates of old approved copy
1183 GetEffectiveDates(
1184 p_obj_def_id => l_old_approved_obj_def_id
1185 ,x_effective_start_date => l_effective_start_date
1186 ,x_effective_end_date => l_effective_end_date
1187 );
1188
1189 -- Check if reverting from old approved copy will cause overlaps with other
1190 -- object definitions.
1191 CheckOverlapObjDefsInternal(
1192 p_obj_id => GetObjectId(p_obj_def_id)
1193 ,p_exclude_obj_def_id => p_obj_def_id
1194 ,p_effective_start_date => l_effective_start_date
1195 ,p_effective_end_date => l_effective_end_date
1196 ,p_action_type => G_REVERT_ACTION_TYPE
1197 );
1198
1199 -- If everthing is OK, then allow reverting object definitinion.
1200 DeleteObjectDefinitionInternal(
1201 p_object_type_code => p_object_type_code
1202 ,p_obj_def_id => p_obj_def_id
1203 );
1204
1205 CopyObjectDefinitionInternal (
1206 p_copy_type_code => G_REVERT
1207 ,p_object_type_code => p_object_type_code
1208 ,p_source_obj_def_id => l_old_approved_obj_def_id
1209 ,p_target_obj_def_id => p_obj_def_id
1210 ,p_target_copy_flag => G_CURRENT_COPY
1211 ,p_is_full_copy => true
1212 ,p_is_new_copy => false
1213 );
1214
1215 -- Override approval status to NOT_APPROVED after reverting.
1216 SetApprovalStatus (
1217 p_obj_def_id => p_obj_def_id
1218 ,p_approval_status_code => G_NOT_APPROVED_STATUS
1219 ,p_approver_user_id => null
1220 ,p_approval_date => null
1221 );
1222
1223 -----------------------
1224 -- Finalize API Call --
1225 -----------------------
1226 -- Standard check of p_commit
1227 if FND_API.To_Boolean(p_commit) then
1228 commit work;
1229 end if;
1230
1231 -- Standard call to get message count and if count is 1, get message info
1232 FND_MSG_PUB.Count_And_Get (
1233 p_count => x_msg_count
1234 ,p_data => x_msg_data
1235 );
1236
1237 FEM_ENGINES_PKG.Tech_Message (
1238 p_severity => G_LOG_LEVEL_2
1239 ,p_module => G_BLOCK||'.'||l_api_name
1240 ,p_msg_text => 'END'
1241 );
1245 when FND_API.G_EXC_ERROR then
1242
1243 EXCEPTION
1244
1246 rollback to RevertObjectDefinition_PVT;
1247 x_return_status := FND_API.G_RET_STS_ERROR;
1248 FND_MSG_PUB.Count_And_Get(
1249 p_count => x_msg_count
1250 ,p_data => x_msg_data
1251 );
1252
1253 when FND_API.G_EXC_UNEXPECTED_ERROR then
1254 rollback to RevertObjectDefinition_PVT;
1255 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1256 FND_MSG_PUB.Count_And_Get(
1257 p_count => x_msg_count
1258 ,p_data => x_msg_data
1259 );
1260
1261 when others then
1262 rollback to RevertObjectDefinition_PVT;
1263 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1264 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
1265 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1266 end if;
1267 FND_MSG_PUB.Count_And_Get(
1268 p_count => x_msg_count
1269 ,p_data => x_msg_data
1270 );
1271
1272 END RevertObjectDefinition;
1273
1274
1275 --
1276 -- PROCEDURE
1277 -- DeleteObject
1278 --
1279 -- DESCRIPTION
1280 -- Deletes an entire Business Rule, including all its Definitions and
1281 -- detail records.
1282 --
1283 -- IN
1284 -- p_api_version - API Version
1285 -- p_init_msg_list - Initialize Message List Flag (Boolean)
1286 -- p_commit - Commit Work Flag (Boolean)
1287 -- p_object_type_code - Object Type Code
1288 -- p_obj_def_id - Object Definition ID
1289 -- p_process_type - Process Type (optional)
1290 -- 0 = DEFAULT
1291 -- 1 = WORKFLOW
1292 --
1293 -- OUT
1294 -- x_return_status - Return Status of API Call
1295 -- x_msg_count - Total Count of Error Messages in API Call
1296 -- x_msg_data - Error Message in API Call
1297 --
1298 --------------------------------------------------------------------------------
1299 PROCEDURE DeleteObject (
1300 p_api_version in number
1301 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
1302 ,p_commit in varchar2 := FND_API.G_FALSE
1303 ,x_return_status out nocopy varchar2
1304 ,x_msg_count out nocopy number
1305 ,x_msg_data out nocopy varchar2
1306 ,p_object_type_code in varchar2
1307 ,p_obj_id in number
1308 ,p_process_type in number := G_DEFAULT
1309 )
1310 --------------------------------------------------------------------------------
1311 IS
1312
1313 -----------------------
1314 -- Declare constants --
1315 -----------------------
1316 l_api_name constant varchar2(30) := 'DeleteObject';
1317 l_api_version constant number := 1.0;
1318
1319 -----------------------
1320 -- Declare variables --
1321 -----------------------
1322 l_can_delete_obj varchar2(1);
1323
1324 l_return_status t_return_status%TYPE;
1325 l_msg_count t_msg_count%TYPE;
1326 l_msg_data t_msg_data%TYPE;
1327
1328 cursor l_obj_defs_cur is
1329 select object_definition_id
1330 from fem_object_definition_b
1331 where object_id = p_obj_id
1332 and old_approved_copy_flag = G_CURRENT_COPY;
1333
1334 BEGIN
1335
1336 -- Standard Start of API Savepoint
1337 savepoint DeleteObject_PVT;
1338
1339 -- Standard call to check for call compatibility
1340 if not FND_API.Compatible_API_Call (
1341 p_current_version_number => l_api_version
1342 ,p_caller_version_number => p_api_version
1343 ,p_api_name => l_api_name
1344 ,p_pkg_name => G_PKG_NAME
1345 ) then
1346 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1347 end if;
1348
1349 -- Initialize Message Stack on FND_MSG_PUB
1350 if (FND_API.To_Boolean(p_init_msg_list)) then
1351 FND_MSG_PUB.Initialize;
1352 end if;
1353
1354 FEM_ENGINES_PKG.Tech_Message (
1355 p_severity => G_LOG_LEVEL_3
1356 ,p_module => G_BLOCK||'.'||l_api_name
1357 ,p_msg_text => 'BEGIN, p_object_type_code:' || p_object_type_code
1358 || ' p_obj_id:' || p_obj_id || ' p_process_type:' || p_process_type
1359 );
1360
1361 ------------------------------------------------
1362 -- Initialize Package and Procedure Variables --
1363 ------------------------------------------------
1364 -- Initialize API return status to success
1365 x_return_status := FND_API.G_RET_STS_SUCCESS;
1366
1367 ------------------------------------------------------------------------------
1368 -- STEP 1: Check to see if we can delete object
1369 ------------------------------------------------------------------------------
1370 FEM_PL_PKG.can_delete_object (
1371 p_api_version => 1.0
1372 ,p_init_msg_list => FND_API.G_FALSE
1373 ,x_return_status => l_return_status
1374 ,x_msg_count => l_msg_count
1375 ,x_msg_data => l_msg_data
1376 ,p_object_id => p_obj_id
1377 ,p_process_type => p_process_type
1378 ,x_can_delete_obj => l_can_delete_obj
1379 );
1380
1384 ,p_msg_text => 'After call FEM_PL_PKG.can_delete_object'
1381 FEM_ENGINES_PKG.Tech_Message (
1382 p_severity => G_LOG_LEVEL_3
1383 ,p_module => G_BLOCK||'.'|| l_api_name
1385 );
1386 -- We can ignore l_can_delete_obj as this FEM_PL_PKG API now has the
1387 -- x_return_status out param.
1388 if (l_return_status = FND_API.G_RET_STS_ERROR) then
1389 raise FND_API.G_EXC_ERROR;
1390 elsif (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
1391 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1392 end if;
1393
1394 ------------------------------------------------------------------------------
1395 -- STEP 2: Loop through all object definitions and delete them
1396 ------------------------------------------------------------------------------
1397 for l_obj_defs_rec in l_obj_defs_cur loop
1398
1399 FEM_ENGINES_PKG.Tech_Message (
1400 p_severity => G_LOG_LEVEL_3
1401 ,p_module => G_BLOCK||'.'|| l_api_name
1402 ,p_msg_text => 'Before call DeleteObjectDefinition'
1403 );
1404
1405 DeleteObjectDefinition (
1406 p_object_type_code => p_object_type_code
1407 ,p_obj_def_id => l_obj_defs_rec.object_definition_id
1408 ,p_init_msg_list => FND_API.G_FALSE
1409 ,x_return_status => l_return_status
1410 ,x_msg_count => l_msg_count
1411 ,x_msg_data => l_msg_data
1412 ,p_process_type => p_process_type
1413 );
1414
1415 FEM_ENGINES_PKG.Tech_Message (
1416 p_severity => G_LOG_LEVEL_3
1417 ,p_module => G_BLOCK||'.'|| l_api_name
1418 ,p_msg_text => 'After call DeleteObjectDefinition'
1419 );
1420
1421 if (l_return_status = FND_API.G_RET_STS_ERROR) then
1422 raise FND_API.G_EXC_ERROR;
1423 elsif (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
1424 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1425 end if;
1426
1427 end loop;
1428
1429 ------------------------------------------------------------------------------
1430 -- STEP 3: Delete the Object
1431 ------------------------------------------------------------------------------
1432 if (IsObjectEmpty(p_obj_id)) then
1433
1434 FEM_ENGINES_PKG.Tech_Message (
1435 p_severity => G_LOG_LEVEL_3
1436 ,p_module => G_BLOCK||'.'|| l_api_name
1437 ,p_msg_text => 'Before call DeleteObjectDetailsInternal'
1438 );
1439 -- Delete any detail records of an Object if they exist
1440 DeleteObjectDetailsInternal (
1441 p_object_type_code => p_object_type_code
1442 ,p_obj_id => p_obj_id
1443 );
1444
1445 FEM_ENGINES_PKG.Tech_Message (
1446 p_severity => G_LOG_LEVEL_3
1447 ,p_module => G_BLOCK||'.'|| l_api_name
1448 ,p_msg_text => 'After call DeleteObjectDetailsInternal'
1449 );
1450 -- Delete the Object record
1451 DeleteObjectRec(p_obj_id);
1452
1453 FEM_ENGINES_PKG.Tech_Message (
1454 p_severity => G_LOG_LEVEL_3
1455 ,p_module => G_BLOCK||'.'|| l_api_name
1456 ,p_msg_text => 'After call DeleteObjectRec'
1457 );
1458
1459 end if;
1460
1461 -----------------------
1462 -- Finalize API Call --
1463 -----------------------
1464 -- Standard check of p_commit
1465 if FND_API.To_Boolean(p_commit) then
1466 commit work;
1467 end if;
1468
1469 -- Standard call to get message count and if count is 1, get message info
1470 FND_MSG_PUB.Count_And_Get (
1471 p_count => x_msg_count
1472 ,p_data => x_msg_data
1473 );
1474
1475 FEM_ENGINES_PKG.Tech_Message (
1476 p_severity => G_LOG_LEVEL_3
1477 ,p_module => G_BLOCK||'.'||l_api_name
1478 ,p_msg_text => 'END'
1479 );
1480
1481 EXCEPTION
1482
1483 when FND_API.G_EXC_ERROR then
1484 BEGIN
1485 ROLLBACK TO DeleteObject_PVT;
1486 EXCEPTION
1487 WHEN OTHERS THEN rollback;
1488 END;
1489 x_return_status := FND_API.G_RET_STS_ERROR;
1490 FND_MSG_PUB.Count_And_Get(
1491 p_count => x_msg_count
1492 ,p_data => x_msg_data
1493 );
1494
1495 when FND_API.G_EXC_UNEXPECTED_ERROR then
1496 BEGIN
1497 ROLLBACK TO DeleteObject_PVT;
1498 EXCEPTION
1499 WHEN OTHERS THEN rollback;
1500 END;
1501 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1502 FND_MSG_PUB.Count_And_Get(
1503 p_count => x_msg_count
1504 ,p_data => x_msg_data
1505 );
1506
1507 when others then
1508 BEGIN
1509 ROLLBACK TO DeleteObject_PVT;
1510 EXCEPTION
1511 WHEN OTHERS THEN rollback;
1512 END;
1513 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1514 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
1515 FND_MSG_PUB.Add_Exc_Msg (
1516 p_pkg_name => G_PKG_NAME
1517 ,p_procedure_name => l_api_name
1518 );
1519 end if;
1520 FND_MSG_PUB.Count_And_Get(
1521 p_count => x_msg_count
1522 ,p_data => x_msg_data
1523 );
1524
1525 END DeleteObject;
1526
1527
1528 --
1529 -- PROCEDURE
1530 -- DuplicateObject
1531 --
1532 -- DESCRIPTION
1536 -- NOTES:
1533 -- Duplicates an entire Object (source), including the Object Definition,
1534 -- Object Dependencies and all its detail records, into a new Object (target).
1535 --
1537 -- 1) If a null value is passed for Target Object Id and/or Target Object
1538 -- Definition Id, a new value will be obtained from their respective
1539 -- sequences.
1540 -- 2) If any of the optional parameters are omitted when calling this API,
1541 -- the corresponding values will be copied from the source record.
1542 --
1543 -- IN
1544 -- p_api_version - API Version
1545 -- p_init_msg_list - Initialize Message List Flag (Boolean)
1546 -- p_commit - Commit Work Flag (Boolean)
1547 -- p_object_type_code - Object Type Code
1548 -- p_source_obj_id - Source Object Id
1549 -- p_source_obj_def_id - Source Object Definition Id
1550 -- p_target_obj_name - Target Object Name
1551 -- p_target_obj_desc - Target Object Description (optional)
1552 -- p_target_obj_def_name - Target Object Definition Name
1553 -- p_target_obj_def_desc - Target Object Definition Description (optional)
1554 -- p_target_start_date - Target Effective Start Date (optional)
1555 -- p_target_end_date - Target Effective End Date (optional)
1556 -- p_target_approval_status_code - Target Approval Status Code (optional)
1557 -- p_target_approved_by - Target Approved By (optional)
1558 -- p_target_approval_date - Target Approval Date (optional)
1559 -- p_created_by - Created By (optional)
1560 -- p_creation_date - Creation Date (optional)
1561 --
1562 -- IN OUT
1563 -- x_target_obj_id - Target Object Id (optional)
1564 -- x_target_obj_def_id - Target Object Definition Id (optional)
1565 --
1566 -- OUT
1567 -- x_return_status - Return Status of API Call
1568 -- x_msg_count - Total Count of Error Messages in API Call
1569 -- x_msg_data - Error Message in API Call
1570 --
1571 --------------------------------------------------------------------------------
1572 PROCEDURE DuplicateObject (
1573 p_api_version in number
1574 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
1575 ,p_commit in varchar2 := FND_API.G_FALSE
1576 ,x_return_status out nocopy varchar2
1577 ,x_msg_count out nocopy number
1578 ,x_msg_data out nocopy varchar2
1579 ,p_object_type_code in varchar2
1580 ,p_source_obj_id in number
1581 ,p_source_obj_def_id in number
1582 ,x_target_obj_id in out nocopy number
1583 ,p_target_obj_name in varchar2
1584 ,p_target_obj_desc in varchar2 := FND_API.G_MISS_CHAR
1585 ,x_target_obj_def_id in out nocopy number
1586 ,p_target_obj_def_name in varchar2 := FND_API.G_MISS_CHAR
1587 ,p_target_obj_def_desc in varchar2 := FND_API.G_MISS_CHAR
1588 ,p_target_start_date in date := FND_API.G_MISS_DATE
1589 ,p_target_end_date in date := FND_API.G_MISS_DATE
1590 ,p_target_approval_status_code in varchar2 := FND_API.G_MISS_CHAR
1591 ,p_target_approved_by in number := FND_API.G_MISS_NUM
1592 ,p_target_approval_date in date := FND_API.G_MISS_DATE
1593 ,p_created_by in number := FND_API.G_MISS_NUM
1594 ,p_creation_date in date := FND_API.G_MISS_DATE
1595 )
1596 --------------------------------------------------------------------------------
1597 IS
1598
1599 -----------------------
1600 -- Declare constants --
1601 -----------------------
1602 l_api_name constant varchar2(30) := 'DuplicateObject';
1603 l_api_version constant number := 1.0;
1604
1605 -----------------------
1606 -- Declare variables --
1607 -----------------------
1608 l_target_start_date date;
1609 l_target_end_date date;
1610
1611 l_return_status t_return_status%TYPE;
1612 l_msg_count t_msg_count%TYPE;
1613 l_msg_data t_msg_data%TYPE;
1614
1615 BEGIN
1616
1617 -- Standard Start of API Savepoint
1618 savepoint DuplicateObject_PVT;
1619
1620 -- Standard call to check for call compatibility
1621 if not FND_API.Compatible_API_Call (
1622 p_current_version_number => l_api_version
1623 ,p_caller_version_number => p_api_version
1624 ,p_api_name => l_api_name
1625 ,p_pkg_name => G_PKG_NAME
1626 ) then
1627 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1628 end if;
1629
1630 -- Initialize Message Stack on FND_MSG_PUB
1631 if (FND_API.To_Boolean(p_init_msg_list)) then
1632 FND_MSG_PUB.Initialize;
1633 end if;
1634
1635 FEM_ENGINES_PKG.Tech_Message (
1636 p_severity => G_LOG_LEVEL_2
1637 ,p_module => G_BLOCK||'.'||l_api_name
1638 ,p_msg_text => 'BEGIN'
1639 );
1640
1641 ------------------------------------------------
1645 x_return_status := FND_API.G_RET_STS_SUCCESS;
1642 -- Initialize Package and Procedure Variables --
1643 ------------------------------------------------
1644 -- Initialize API return status to success
1646
1647 ------------------------------------------------------------------------------
1648 -- STEP 1: Check parameter values
1649 ------------------------------------------------------------------------------
1650 if (x_target_obj_id is null) then
1651 -- Get a new Target Object Id if none was specified
1652 x_target_obj_id := GetNewObjId();
1653 end if;
1654
1655 if (x_target_obj_def_id is null) then
1656 -- Get a new Target Object Definition Id if none was specified
1657 x_target_obj_def_id := GetNewObjDefId();
1658 else
1659
1660 -- Delete the existing Target Object Definition Id if one was specified
1661 DeleteObjectDefinition (
1662 p_object_type_code => p_object_type_code
1663 ,p_obj_def_id => x_target_obj_def_id
1664 ,p_init_msg_list => FND_API.G_FALSE
1665 ,x_return_status => l_return_status
1666 ,x_msg_count => l_msg_count
1667 ,x_msg_data => l_msg_data
1668 ,p_process_type => G_WORKFLOW
1669 );
1670
1671 if (l_return_status = FND_API.G_RET_STS_ERROR) then
1672 raise FND_API.G_EXC_ERROR;
1673 elsif (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
1674 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1675 end if;
1676
1677 end if;
1678
1679 l_target_start_date := p_target_start_date;
1680 if (l_target_start_date is null) then
1681 l_target_start_date := GetDefaultStartDate();
1682 end if;
1683
1684 l_target_end_date := p_target_end_date;
1685 if (l_target_end_date is null) then
1686 l_target_end_date := GetDefaultEndDate();
1687 end if;
1688
1689 ------------------------------------------------------------------------------
1690 -- STEP 2: Check Object Name
1691 ------------------------------------------------------------------------------
1692 CheckObjectName (
1693 p_api_version => 1.0
1694 ,p_init_msg_list => FND_API.G_FALSE
1695 ,x_return_status => l_return_status
1696 ,x_msg_count => l_msg_count
1697 ,x_msg_data => l_msg_data
1698 ,p_obj_name => p_target_obj_name
1699 ,p_obj_id => x_target_obj_id
1700 );
1701
1702 if (l_return_status = FND_API.G_RET_STS_ERROR) then
1703 raise FND_API.G_EXC_ERROR;
1704 elsif (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
1705 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1706 end if;
1707
1708 ------------------------------------------------------------------------------
1709 -- STEP 3: Copy Object Record
1710 ------------------------------------------------------------------------------
1711 CopyObjectRec (
1712 p_source_obj_id => p_source_obj_id
1713 ,p_target_obj_id => x_target_obj_id
1714 ,p_target_obj_name => p_target_obj_name
1715 ,p_target_obj_desc => p_target_obj_desc
1716 ,p_created_by => p_created_by
1717 ,p_creation_date => p_creation_date
1718 );
1719
1720 DuplicateObjectDetails (
1721 p_object_type_code => p_object_type_code
1722 ,p_source_obj_id => p_source_obj_id
1723 ,p_target_obj_id => x_target_obj_id
1724 ,x_return_status => l_return_status
1725 ,x_msg_count => l_msg_count
1726 ,x_msg_data => l_msg_data
1727 );
1728
1729 if (l_return_status = FND_API.G_RET_STS_ERROR) then
1730 raise FND_API.G_EXC_ERROR;
1731 elsif (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
1732 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1733 end if;
1734
1735 ------------------------------------------------------------------------------
1736 -- STEP 4: Copy Object Definition Record
1737 ------------------------------------------------------------------------------
1738 -- No need to check object definition as we just created a new object
1739 CopyObjectDefinitionRec (
1740 p_source_obj_def_id => p_source_obj_def_id
1741 ,p_target_obj_def_id => x_target_obj_def_id
1742 ,p_target_obj_id => x_target_obj_id
1743 ,p_target_obj_def_name => p_target_obj_def_name
1744 ,p_target_obj_def_desc => p_target_obj_def_desc
1745 ,p_target_start_date => l_target_start_date
1746 ,p_target_end_date => l_target_end_date
1747 ,p_target_copy_flag => G_CURRENT_COPY
1748 ,p_target_copy_obj_def_id => null
1749 ,p_created_by => p_created_by
1750 ,p_creation_date => p_creation_date
1751 );
1752
1753 -- Override approval status
1754 SetApprovalStatus (
1755 p_obj_def_id => x_target_obj_def_id
1756 ,p_approval_status_code => p_target_approval_status_code
1757 ,p_approver_user_id => p_target_approved_by
1758 ,p_approval_date => p_target_approval_date
1759 );
1760
1761 ------------------------------------------------------------------------------
1762 -- STEP 5: Duplicate Object Definition Details
1763 ------------------------------------------------------------------------------
1764 -- Now only copy the Detail records
1765 CopyObjectDefinitionInternal (
1766 p_copy_type_code => G_DUPLICATE
1770 ,p_target_copy_flag => G_CURRENT_COPY
1767 ,p_object_type_code => p_object_type_code
1768 ,p_source_obj_def_id => p_source_obj_def_id
1769 ,p_target_obj_def_id => x_target_obj_def_id
1771 ,p_is_full_copy => false
1772 ,p_is_new_copy => true
1773 );
1774
1775 -----------------------
1776 -- Finalize API Call --
1777 -----------------------
1778 -- Standard check of p_commit
1779 if FND_API.To_Boolean(p_commit) then
1780 commit work;
1781 end if;
1782
1783 -- Standard call to get message count and if count is 1, get message info
1784 FND_MSG_PUB.Count_And_Get (
1785 p_count => x_msg_count
1786 ,p_data => x_msg_data
1787 );
1788
1789 FEM_ENGINES_PKG.Tech_Message (
1790 p_severity => G_LOG_LEVEL_2
1791 ,p_module => G_BLOCK||'.'||l_api_name
1792 ,p_msg_text => 'END'
1793 );
1794
1795 EXCEPTION
1796
1797 when FND_API.G_EXC_ERROR then
1798 rollback to DuplicateObject_PVT;
1799 x_return_status := FND_API.G_RET_STS_ERROR;
1800 FND_MSG_PUB.Count_And_Get(
1801 p_count => x_msg_count
1802 ,p_data => x_msg_data
1803 );
1804
1805 when FND_API.G_EXC_UNEXPECTED_ERROR then
1806 rollback to DuplicateObject_PVT;
1807 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1808 FND_MSG_PUB.Count_And_Get(
1809 p_count => x_msg_count
1810 ,p_data => x_msg_data
1811 );
1812
1813 when others then
1814 rollback to DuplicateObject_PVT;
1815 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1816 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
1817 FND_MSG_PUB.Add_Exc_Msg (
1818 p_pkg_name => G_PKG_NAME
1819 ,p_procedure_name => l_api_name
1820 );
1821 end if;
1822 FND_MSG_PUB.Count_And_Get(
1823 p_count => x_msg_count
1824 ,p_data => x_msg_data
1825 );
1826
1827 END DuplicateObject;
1828
1829
1830 --
1831 -- PROCEDURE
1832 -- DuplicateObjectDetails
1833 --
1834 -- DESCRIPTION
1835 -- Duplicates only the detail records of a Business Rule (source) into
1836 -- another empty Business Rule (target). It does not duplicate any of the
1837 -- Business Rule Definition records.
1838 -- NOTE: It does not copy the Business Rule record in
1839 -- FEM_OBJECT_CATALOG_VL. That record must already exist.
1840 --
1841 -- IN
1842 -- p_api_version - API Version
1843 -- p_init_msg_list - Initialize Message List Flag (Boolean)
1844 -- p_commit - Commit Work Flag (Boolean)
1845 -- p_object_type_code - Object Type Code
1846 -- p_source_obj_id - Source Object ID
1847 -- p_target_obj_id - Target Object ID
1848 --
1849 -- OUT
1850 -- x_return_status - Return Status of API Call
1851 -- x_msg_count - Total Count of Error Messages in API Call
1852 -- x_msg_data - Error Message in API Call
1853 --
1854 --------------------------------------------------------------------------------
1855 PROCEDURE DuplicateObjectDetails (
1856 p_api_version in number := 1.0
1857 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
1858 ,p_commit in varchar2 := FND_API.G_FALSE
1859 ,x_return_status out nocopy varchar2
1860 ,x_msg_count out nocopy number
1861 ,x_msg_data out nocopy varchar2
1862 ,p_object_type_code in varchar2
1863 ,p_source_obj_id in number
1864 ,p_target_obj_id in number
1865 )
1866 --------------------------------------------------------------------------------
1867 IS
1868
1869 l_api_name constant varchar2(30) := 'DuplicateObjectDetails';
1870 l_api_version constant number := 1.0;
1871
1872 BEGIN
1873
1874 -- Standard Start of API Savepoint
1875 savepoint DuplicateObjectDetails_PVT;
1876
1877 -- Standard call to check for call compatibility
1878 if not FND_API.Compatible_API_Call (
1879 p_current_version_number => l_api_version
1880 ,p_caller_version_number => p_api_version
1881 ,p_api_name => l_api_name
1882 ,p_pkg_name => G_PKG_NAME
1883 ) then
1884 raise FND_API.G_EXC_UNEXPECTED_ERROR;
1885 end if;
1886
1887 -- Initialize Message Stack on FND_MSG_PUB
1888 if (FND_API.To_Boolean(p_init_msg_list)) then
1889 FND_MSG_PUB.Initialize;
1890 end if;
1891
1892 FEM_ENGINES_PKG.Tech_Message (
1893 p_severity => G_LOG_LEVEL_2
1894 ,p_module => G_BLOCK||'.'||l_api_name
1895 ,p_msg_text => 'BEGIN'
1896 );
1897
1898 ------------------------------------------------
1899 -- Initialize Package and Procedure Variables --
1900 ------------------------------------------------
1901 -- Initialize API return status to success
1902 x_return_status := FND_API.G_RET_STS_SUCCESS;
1903
1904 CopyObjectDetailsInternal (
1905 p_copy_type_code => G_DUPLICATE
1906 ,p_object_type_code => p_object_type_code
1907 ,p_source_obj_id => p_source_obj_id
1908 ,p_target_obj_id => p_target_obj_id
1909 );
1910
1914 -- Standard check of p_commit
1911 -----------------------
1912 -- Finalize API Call --
1913 -----------------------
1915 if FND_API.To_Boolean(p_commit) then
1916 commit work;
1917 end if;
1918
1919 -- Standard call to get message count and if count is 1, get message info
1920 FND_MSG_PUB.Count_And_Get (
1921 p_count => x_msg_count
1922 ,p_data => x_msg_data
1923 );
1924
1925 FEM_ENGINES_PKG.Tech_Message (
1926 p_severity => G_LOG_LEVEL_2
1927 ,p_module => G_BLOCK||'.'||l_api_name
1928 ,p_msg_text => 'END'
1929 );
1930
1931 EXCEPTION
1932
1933 when FND_API.G_EXC_ERROR then
1934 rollback to DuplicateObjectDetails_PVT;
1935 x_return_status := FND_API.G_RET_STS_ERROR;
1936 FND_MSG_PUB.Count_And_Get(
1937 p_count => x_msg_count
1938 ,p_data => x_msg_data
1939 );
1940
1941 when FND_API.G_EXC_UNEXPECTED_ERROR then
1942 rollback to DuplicateObjectDetails_PVT;
1943 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1944 FND_MSG_PUB.Count_And_Get(
1945 p_count => x_msg_count
1946 ,p_data => x_msg_data
1947 );
1948
1949 when others then
1950 rollback to DuplicateObjectDetails_PVT;
1951 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1952 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
1953 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1954 end if;
1955 FND_MSG_PUB.Count_And_Get(
1956 p_count => x_msg_count
1957 ,p_data => x_msg_data
1958 );
1959
1960 END DuplicateObjectDetails;
1961
1962
1963 --
1964 -- PROCEDURE
1965 -- CheckOverlapObjDefs
1966 --
1967 -- DESCRIPTION
1968 -- Checks if the specified effective dates will overlap with existing
1969 -- object definitions under the same parent object. If this check is for
1970 -- updating the effective dates of an existing object definition, this
1971 -- object definition must be excluded from the overlap check.
1972 --
1973 -- IN
1974 -- p_api_version - API Version
1975 -- p_init_msg_list - Initialize Message List Flag (Boolean)
1976 -- p_obj_id - Object ID
1977 -- p_exclude obj_def_id - Object Definition ID to exclude from check
1978 -- p_effective_start_date - The new effective start date
1979 -- p_effective_end_date - The new effective end date
1980 --
1981 -- OUT
1982 -- x_return_status - Return Status of API Call
1983 -- x_msg_count - Total Count of Error Messages in API Call
1984 -- x_msg_data - Error Message in API Call
1985 --
1986 --------------------------------------------------------------------------------
1987 PROCEDURE CheckOverlapObjDefs(
1988 p_api_version in number := 1.0
1989 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
1990 ,x_return_status out nocopy varchar2
1991 ,x_msg_count out nocopy number
1992 ,x_msg_data out nocopy varchar2
1993 ,p_obj_id in number
1994 ,p_exclude_obj_def_id in number
1995 ,p_effective_start_date in date
1996 ,p_effective_end_date in date
1997 )
1998 --------------------------------------------------------------------------------
1999 IS
2000
2001 l_api_name constant varchar2(30) := 'CheckOverlapObjDefs';
2002 l_api_version constant number := 1.0;
2003
2004 BEGIN
2005
2006 -- Standard call to check for call compatibility
2007 if not FND_API.Compatible_API_Call (
2008 p_current_version_number => l_api_version
2009 ,p_caller_version_number => p_api_version
2010 ,p_api_name => l_api_name
2011 ,p_pkg_name => G_PKG_NAME
2012 ) then
2013 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2014 end if;
2015
2016 -- Initialize Message Stack on FND_MSG_PUB
2017 if (FND_API.To_Boolean(p_init_msg_list)) then
2018 FND_MSG_PUB.Initialize;
2019 end if;
2020
2021 FEM_ENGINES_PKG.Tech_Message (
2022 p_severity => G_LOG_LEVEL_2
2023 ,p_module => G_BLOCK||'.'||l_api_name
2024 ,p_msg_text => 'BEGIN'
2025 );
2026
2027 ------------------------------------------------
2028 -- Initialize Package and Procedure Variables --
2029 ------------------------------------------------
2030 -- Initialize API return status to success
2031 x_return_status := FND_API.G_RET_STS_SUCCESS;
2032
2033 CheckOverlapObjDefsInternal(
2034 p_obj_id => p_obj_id
2035 ,p_exclude_obj_def_id => p_exclude_obj_def_id
2036 ,p_effective_start_date => p_effective_start_date
2037 ,p_effective_end_date => p_effective_end_date
2038 ,p_action_type => G_UNDEF_ACTION_TYPE
2039 );
2040
2041 -----------------------
2042 -- Finalize API Call --
2043 -----------------------
2044 -- Standard call to get message count and if count is 1, get message info
2045 FND_MSG_PUB.Count_And_Get (
2046 p_count => x_msg_count
2047 ,p_data => x_msg_data
2048 );
2049
2050 FEM_ENGINES_PKG.Tech_Message (
2051 p_severity => G_LOG_LEVEL_2
2052 ,p_module => G_BLOCK||'.'||l_api_name
2056 EXCEPTION
2053 ,p_msg_text => 'END'
2054 );
2055
2057
2058 when FND_API.G_EXC_ERROR then
2059 x_return_status := FND_API.G_RET_STS_ERROR;
2060 FND_MSG_PUB.Count_And_Get(
2061 p_count => x_msg_count
2062 ,p_data => x_msg_data
2063 );
2064
2065 when FND_API.G_EXC_UNEXPECTED_ERROR then
2066 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2067 FND_MSG_PUB.Count_And_Get(
2068 p_count => x_msg_count
2069 ,p_data => x_msg_data
2070 );
2071
2072 when others then
2073 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2074 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
2075 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
2076 end if;
2077 FND_MSG_PUB.Count_And_Get(
2078 p_count => x_msg_count
2079 ,p_data => x_msg_data
2080 );
2081
2082 END CheckOverlapObjDefs;
2083
2084
2085 --
2086 -- FUNCTION
2087 -- GetDefaultStartDate
2088 --
2089 -- DESCRIPTION
2090 -- Returns the default start date stored in the profile options table. If
2091 -- none is specified, use the defaulted value.
2092 --
2093 -- RETURN
2094 -- x_default_start_date - Default Effective Start Date
2095 --
2096 --------------------------------------------------------------------------------
2097 FUNCTION GetDefaultStartDate
2098 RETURN date
2099 --------------------------------------------------------------------------------
2100 IS
2101
2102 l_api_name constant varchar2(30) := 'GetDefaultStartDate';
2103 l_default_start_date date;
2104
2105 BEGIN
2106
2107 l_default_start_date := nvl(
2108 GetProfileOptionDateValue('FEM_EFFECTIVE_START_DATE')
2109 ,G_DEFAULT_START_DATE_NULL
2110 );
2111
2112 return l_default_start_date;
2113
2114 END GetDefaultStartDate;
2115
2116
2117 --
2118 -- FUNCTION
2119 -- GetDefaultEndDate
2120 --
2121 -- DESCRIPTION
2122 -- Returns the default end date stored in the profile options table. If
2123 -- none is specified, use the defaulted value.
2124 --
2125 -- RETURN
2126 -- x_default_end_date - Default Effective End Date
2127 --
2128 --------------------------------------------------------------------------------
2129 FUNCTION GetDefaultEndDate
2130 RETURN date
2131 --------------------------------------------------------------------------------
2132 IS
2133
2134 l_api_name constant varchar2(80) := 'GetDefaultEndDate';
2135 l_default_end_date date;
2136
2137 BEGIN
2138
2139 l_default_end_date := nvl(
2140 GetProfileOptionDateValue('FEM_EFFECTIVE_END_DATE')
2141 ,G_DEFAULT_END_DATE_NULL
2142 );
2143
2144 return l_default_end_date;
2145
2146 END GetDefaultEndDate;
2147
2148
2149 --
2150 -- PROCEDURE
2151 -- CheckObjectName
2152 --
2153 -- DESCRIPTION
2154 -- Checks that a new or updated Object does not have the same name as other
2155 -- existing Object records.
2156 --
2157 -- IN
2158 -- p_api_version - API Version
2159 -- p_init_msg_list - Initialize Message List Flag (Boolean)
2160 -- p_obj_name - Object Name
2161 -- p_obj_id - Object ID (optional)
2162 --
2163 -- OUT
2164 -- x_return_status - Return Status of API Call
2165 -- x_msg_count - Total Count of Error Messages in API Call
2166 -- x_msg_data - Error Message in API Call
2167 --
2168 --------------------------------------------------------------------------------
2169 PROCEDURE CheckObjectName (
2170 p_api_version in number
2171 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
2172 ,x_return_status out nocopy varchar2
2173 ,x_msg_count out nocopy number
2174 ,x_msg_data out nocopy varchar2
2175 ,p_obj_name in varchar2
2176 ,p_obj_id in number
2177 )
2178 --------------------------------------------------------------------------------
2179 IS
2180
2181 l_api_name constant varchar2(30) := 'CheckObjectName';
2182 l_api_version constant number := 1.0;
2183
2184 cursor l_check_obj_name_cur is
2185 select obj.object_id
2186 ,typ.object_type_name
2187 , f.folder_name
2188 , obj.object_name
2189 from fem_object_catalog_vl obj
2190 ,fem_folders_vl f
2191 ,fem_object_types_vl typ
2192 where upper(obj.object_name) = upper(p_obj_name)
2193 and obj.object_id <> nvl(p_obj_id,-1)
2194 and f.folder_id = obj.folder_id
2195 and typ.object_type_code = obj.object_type_code;
2196
2197 BEGIN
2198
2199 -- Standard call to check for call compatibility
2200 if not FND_API.Compatible_API_Call (
2201 p_current_version_number => l_api_version
2202 ,p_caller_version_number => p_api_version
2203 ,p_api_name => l_api_name
2204 ,p_pkg_name => G_PKG_NAME
2205 ) then
2206 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2207 end if;
2208
2209 -- Initialize Message Stack on FND_MSG_PUB
2210 if (FND_API.To_Boolean(p_init_msg_list)) then
2214 FEM_ENGINES_PKG.Tech_Message (
2211 FND_MSG_PUB.Initialize;
2212 end if;
2213
2215 p_severity => G_LOG_LEVEL_2
2216 ,p_module => G_BLOCK||'.'||l_api_name
2217 ,p_msg_text => 'BEGIN'
2218 );
2219
2220 ------------------------------------------------
2221 -- Initialize Package and Procedure Variables --
2222 ------------------------------------------------
2223 -- Initialize API return status to success
2224 x_return_status := FND_API.G_RET_STS_SUCCESS;
2225
2226 for l_check_obj_name_rec in l_check_obj_name_cur loop
2227
2228 -- If a record is returned in the l_check_obj_name_cur, then another
2229 -- object exists with the same name.
2230 FND_MESSAGE.set_name('FEM', 'FEM_BR_OBJ_NAME_ERR');
2231 FND_MESSAGE.set_token('OBJECT_TYPE_MEANING', l_check_obj_name_rec.object_type_name);
2232 FND_MESSAGE.set_token('FOLDER_NAME', l_check_obj_name_rec.folder_name);
2233 FND_MESSAGE.set_token('OBJECT_NAME', l_check_obj_name_rec.object_name);
2234 FND_MSG_PUB.Add;
2235
2236 raise FND_API.G_EXC_ERROR;
2237
2238 end loop;
2239
2240 -----------------------
2241 -- Finalize API Call --
2242 -----------------------
2243 -- Standard call to get message count and if count is 1, get message info
2244 FND_MSG_PUB.Count_And_Get (
2245 p_count => x_msg_count
2246 ,p_data => x_msg_data
2247 );
2248
2249 FEM_ENGINES_PKG.Tech_Message (
2250 p_severity => G_LOG_LEVEL_2
2251 ,p_module => G_BLOCK||'.'||l_api_name
2252 ,p_msg_text => 'END'
2253 );
2254
2255 EXCEPTION
2256
2257 when FND_API.G_EXC_ERROR then
2258 x_return_status := FND_API.G_RET_STS_ERROR;
2259 FND_MSG_PUB.Count_And_Get(
2260 p_count => x_msg_count
2261 ,p_data => x_msg_data
2262 );
2263
2264 when FND_API.G_EXC_UNEXPECTED_ERROR then
2265 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2266 FND_MSG_PUB.Count_And_Get(
2267 p_count => x_msg_count
2268 ,p_data => x_msg_data
2269 );
2270
2271 when others then
2272 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2273 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
2274 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
2275 end if;
2276 FND_MSG_PUB.Count_And_Get(
2277 p_count => x_msg_count
2278 ,p_data => x_msg_data
2279 );
2280
2281 END CheckObjectName;
2282
2283
2284 --
2285 -- PROCEDURE
2286 -- CheckObjectDefinitionName
2287 --
2288 -- DESCRIPTION
2289 -- Checks that a new or updated Object Definition does not have the same
2290 -- name as other existing Object Definition records that all belong to the
2291 -- same Object.
2292 --
2293 -- IN
2294 -- p_api_version - API version
2295 -- p_init_msg_list - Initialize Message List (boolean)
2296 -- p_obj_def_name - Object Definition Name
2297 -- p_obj_id - Object ID
2298 -- p_obj_def_id - Object Definition ID (optional)
2299 --
2300 -- OUT
2301 -- x_return_status - Return Status of API Call
2302 -- x_msg_count - Total Count of Error Messages in API Call
2303 -- x_msg_data - Error Message in API Call
2304 --
2305 --------------------------------------------------------------------------------
2306 PROCEDURE CheckObjectDefinitionName (
2307 p_api_version in number
2308 ,p_init_msg_list in varchar2 := FND_API.G_FALSE
2309 ,x_return_status out nocopy varchar2
2310 ,x_msg_count out nocopy number
2311 ,x_msg_data out nocopy varchar2
2312 ,p_obj_def_name in varchar2
2313 ,p_obj_id in number
2314 ,p_obj_def_id in number
2315 )
2316 --------------------------------------------------------------------------------
2317 IS
2318
2319 l_api_name constant varchar2(30) := 'CheckObjectDefinitionName';
2320 l_api_version constant number := 1.0;
2321
2322 cursor l_check_obj_def_name_cur is
2323 select def.object_definition_id as obj_def_id
2324 ,def.display_name as obj_def_name
2325 ,def.object_id
2326 ,obj.object_name
2327 from fem_object_definition_vl def
2328 ,fem_object_catalog_vl obj
2329 where upper(def.display_name) = upper(p_obj_def_name)
2330 and def.object_id = p_obj_id
2331 and def.old_approved_copy_flag = G_CURRENT_COPY
2332 and def.object_definition_id <> nvl(p_obj_def_id,-1)
2333 and obj.object_id = def.object_id;
2334
2335 BEGIN
2336
2337 -- Standard call to check for call compatibility
2338 if not FND_API.Compatible_API_Call (
2339 p_current_version_number => l_api_version
2340 ,p_caller_version_number => p_api_version
2341 ,p_api_name => l_api_name
2342 ,p_pkg_name => G_PKG_NAME
2343 ) then
2344 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2345 end if;
2346
2347 -- Initialize Message Stack on FND_MSG_PUB
2348 if (FND_API.To_Boolean(p_init_msg_list)) then
2349 FND_MSG_PUB.Initialize;
2350 end if;
2351
2352 FEM_ENGINES_PKG.Tech_Message (
2356 );
2353 p_severity => G_LOG_LEVEL_2
2354 ,p_module => G_BLOCK||'.'||l_api_name
2355 ,p_msg_text => 'BEGIN'
2357
2358 ------------------------------------------------
2359 -- Initialize Package and Procedure Variables --
2360 ------------------------------------------------
2361 -- Initialize API return status to success
2362 x_return_status := FND_API.G_RET_STS_SUCCESS;
2363
2364 for l_check_obj_def_name_rec in l_check_obj_def_name_cur loop
2365
2366 -- If a record is returned in the l_check_obj_def_name_cur, then another
2367 -- object definition exists with the same name.
2368 FND_MESSAGE.set_name('FEM', 'FEM_BR_OBJ_DEF_NAME_ERR');
2369 FND_MESSAGE.set_token('OBJECT_DEFINITION_NAME', l_check_obj_def_name_rec.obj_def_name);
2370 FND_MSG_PUB.Add;
2371
2372 raise FND_API.G_EXC_ERROR;
2373
2374 end loop;
2375
2376 -----------------------
2377 -- Finalize API Call --
2378 -----------------------
2379 -- Standard call to get message count and if count is 1, get message info
2380 FND_MSG_PUB.Count_And_Get (
2381 p_count => x_msg_count
2382 ,p_data => x_msg_data
2383 );
2384
2385 FEM_ENGINES_PKG.Tech_Message (
2386 p_severity => G_LOG_LEVEL_2
2387 ,p_module => G_BLOCK||'.'||l_api_name
2388 ,p_msg_text => 'END'
2389 );
2390
2391 EXCEPTION
2392
2393 when FND_API.G_EXC_ERROR then
2394 x_return_status := FND_API.G_RET_STS_ERROR;
2395 FND_MSG_PUB.Count_And_Get(
2396 p_count => x_msg_count
2397 ,p_data => x_msg_data
2398 );
2399
2400 when FND_API.G_EXC_UNEXPECTED_ERROR then
2401 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2402 FND_MSG_PUB.Count_And_Get(
2403 p_count => x_msg_count
2404 ,p_data => x_msg_data
2405 );
2406
2407 when others then
2408 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2409 if (FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)) then
2410 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
2411 end if;
2412 FND_MSG_PUB.Count_And_Get(
2413 p_count => x_msg_count
2414 ,p_data => x_msg_data
2415 );
2416
2417 END CheckObjectDefinitionName;
2418
2419 --
2420 -- FUNCTION
2421 -- ObjDefDataEditLockExists
2422 --
2423 -- DESCRIPTION
2424 -- Check if data lock exists for the object definition
2425 --
2426 -- IN
2427 -- p_obj_def_id - Object Definition ID
2428 --
2429 -- OUT
2430 -- l_lock_exists - Lock Exists (T - True, F - False)
2431 --
2432 --------------------------------------------------------------------------------
2433 FUNCTION ObjDefDataEditLockExists (
2434 p_obj_def_id in number
2435 ) RETURN varchar2
2436 --------------------------------------------------------------------------------
2437 IS
2438
2439 l_lock_exists varchar2(1);
2440
2441 BEGIN
2442
2443 FEM_PL_PKG.obj_def_data_edit_lock_exists (
2444 p_object_definition_id => p_obj_def_id
2445 ,x_data_edit_lock_exists => l_lock_exists
2446 );
2447
2448 return l_lock_exists;
2449
2450 EXCEPTION
2451
2452 when others then
2453 return null;
2454
2455 END ObjDefDataEditLockExists;
2456
2457
2458 --
2459 -- FUNCTION
2460 -- GetNewObjId
2461 --
2462 -- DESCRIPTION
2463 -- Getter for the FEM_OBJECT_CATALOG_ID_SEQ database sequence.
2464 --
2465 -- RETURNS
2466 -- obj_id - Object Definition ID
2467 --
2468 --------------------------------------------------------------------------------
2469 FUNCTION GetNewObjId
2470 RETURN number
2471 --------------------------------------------------------------------------------
2472 IS
2473
2474 l_obj_id number;
2475
2476 BEGIN
2477
2478 select fem_object_id_seq.NEXTVAL
2479 into l_obj_id
2480 from dual;
2481
2482 return l_obj_id;
2483
2484 END GetNewObjId;
2485
2486
2487 --
2488 -- FUNCTION
2489 -- GetNewObjDefId
2490 --
2491 -- DESCRIPTION
2492 -- Getter for the FEM_OBJECT_DEFINITION_ID_SEQ database sequence.
2493 --
2494 -- RETURNS
2495 -- obj_def_id - Object Definition ID
2496 --
2497 --------------------------------------------------------------------------------
2498 FUNCTION GetNewObjDefId
2499 RETURN number
2500 --------------------------------------------------------------------------------
2501 IS
2502
2503 l_obj_def_id number;
2504
2505 BEGIN
2506
2507 select fem_object_definition_id_seq.NEXTVAL
2508 into l_obj_def_id
2509 from dual;
2510
2511 return l_obj_def_id;
2512
2513 END GetNewObjDefId;
2514
2515
2516 --
2517 -- FUNCTION
2518 -- GetRulesetIsetupImpExpFlag
2519 --
2520 -- DESCRIPTION
2521 -- Getter for obtaining the iSetup import/export flag for the
2522 -- specified rule set object definition.
2523 --
2524 -- IN
2525 -- p_obj_def_id - Rule Set Object Definition ID
2526 --
2527 -- RETURNS
2531 FUNCTION GetRulesetIsetupImpExpFlag (
2528 -- isetup_import_export_flag - iSetup Import/Export Flag
2529 --
2530 --------------------------------------------------------------------------------
2532 p_ruleset_obj_def_id in number
2533 )
2534 RETURN varchar2
2535 --------------------------------------------------------------------------------
2536 IS
2537
2538 l_isetup_import_export_flag varchar2(1);
2539
2540 BEGIN
2541
2542 select rs_type.isetup_import_export_flag
2543 into l_isetup_import_export_flag
2544 from fem_rule_sets rs
2545 ,fem_object_types_b rs_type
2546 where rs.rule_set_obj_def_id = p_ruleset_obj_def_id
2547 and rs_type.object_type_code = rs.rule_set_object_type_code;
2548
2549 return l_isetup_import_export_flag;
2550
2551 EXCEPTION
2552
2553 when others then
2554 return null;
2555
2556 END GetRulesetIsetupImpExpFlag;
2557
2558
2559 --
2560 -- FUNCTION
2561 -- GetObjectId
2562 --
2563 -- DESCRIPTION
2564 -- Getter for obtaining the object ID of the specified object definition ID.
2565 --
2566 -- IN
2567 -- p_obj_def_id - Object Defintion ID
2568 --
2569 -- RETURNS
2570 -- obj_id - Object ID
2571 --
2572 --------------------------------------------------------------------------------
2573 FUNCTION GetObjectId(
2574 p_obj_def_id in number
2575 )
2576 RETURN number
2577 --------------------------------------------------------------------------------
2578 IS
2579
2580 l_obj_id number;
2581
2582 BEGIN
2583
2584 select object_id
2585 into l_obj_id
2586 from fem_object_definition_b
2587 where object_definition_id = p_obj_def_id;
2588
2589 return l_obj_id;
2590
2591 EXCEPTION
2592
2593 when others then
2594 return null;
2595
2596 END GetObjectId;
2597
2598
2599 --
2600 -- FUNCTION
2601 -- GetOldApprovedObjDefId
2602 --
2603 -- DESCRIPTION
2604 -- Getter for obtaining the old approved copy object definition id of the
2605 -- specified object definition.
2606 --
2607 -- IN
2608 -- p_obj_def_id - Object Definition ID
2609 --
2610 -- RETURNS
2611 -- old_approved_obj_def_id - Old Approved Object Definition ID
2612 --
2613 --------------------------------------------------------------------------------
2614 FUNCTION GetOldApprovedObjDefId(
2615 p_obj_def_id in number
2616 )
2617 RETURN number
2618 --------------------------------------------------------------------------------
2619 IS
2620
2621 l_old_approved_obj_def_id number;
2622 l_api_name constant varchar2(30) := 'GetOldApprovedObjDefId';
2623
2624 l_prg_msg VARCHAR2(2000);
2625 l_callstack VARCHAR2(2000);
2626
2627 BEGIN
2628 FEM_ENGINES_PKG.Tech_Message (
2629 p_severity => G_LOG_LEVEL_3
2630 ,p_module => G_BLOCK||'.'|| l_api_name
2631 ,p_msg_text => 'BEGIN, p_obj_def_id:' || p_obj_def_id
2632 );
2633
2634 select old_approved_copy_obj_def_id
2635 into l_old_approved_obj_def_id
2636 from fem_object_definition_b
2637 where old_approved_copy_flag = G_CURRENT_COPY
2638 and object_definition_id = p_obj_def_id;
2639
2640 FEM_ENGINES_PKG.Tech_Message (
2641 p_severity => G_LOG_LEVEL_3
2642 ,p_module => G_BLOCK||'.'|| l_api_name
2643 ,p_msg_text => 'END'
2644 );
2645
2646 return l_old_approved_obj_def_id;
2647
2648 EXCEPTION
2649
2650 when others then
2651 l_callstack := DBMS_UTILITY.Format_Call_Stack;
2652 l_prg_msg := SQLERRM;
2653 FEM_ENGINES_PKG.Tech_Message (
2654 p_severity => G_LOG_LEVEL_6
2655 ,p_module => G_BLOCK||'.'||l_api_name
2656 ,p_msg_text => 'others, l_callstack:' || l_callstack
2657 );
2658 FEM_ENGINES_PKG.Tech_Message (
2659 p_severity => G_LOG_LEVEL_6
2660 ,p_module => G_BLOCK||'.'||l_api_name
2661 ,p_msg_text => 'others 1, l_prg_msg:' || l_prg_msg
2662 );
2663 return null;
2664
2665 END GetOldApprovedObjDefId;
2666
2667
2668
2669 ------------------------
2670 -- Workflow Approvals --
2671 ------------------------
2672
2673 --
2674 -- PROCEDURE
2675 -- SetSubmittedState
2676 --
2677 -- DESCRIPTION
2678 -- Sets all the business rule definitions in a workflow request to the
2679 -- submitted state.
2680 --
2681 -- IN
2682 -- p_item_type - The workflow item type (FEMAPPR)
2683 -- p_item_key - The workflow request id (FEM_WF_REQUEST_ID_SEQ)
2684 --
2685 -- USED BY
2686 -- FEM_FEMAPPR_ITEM_TYPE SetSubmittedState()
2687 --
2688 --------------------------------------------------------------------------------
2689 PROCEDURE SetSubmittedState(
2690 p_item_type in varchar2
2691 ,p_item_key in varchar2
2692 )
2693 --------------------------------------------------------------------------------
2694 IS
2695
2696 l_api_name constant varchar2(30) := 'SetSubmittedState';
2697
2701
2698 l_request_type_code t_code%TYPE;
2699 l_request_item_code t_code%TYPE;
2700 l_request_id t_request_id%TYPE;
2702 l_approval_status_code t_approval_status_code%TYPE;
2703
2704 BEGIN
2705
2706 l_request_type_code := WF_ENGINE.GetItemAttrText(
2707 p_item_type, p_item_key, G_REQUEST_TYPE_CODE);
2708
2709 if (l_request_type_code = G_APPROVAL_TYPE) then
2710
2711 l_approval_status_code := G_SUBMIT_APPROVAL_STATUS;
2712
2713 elsif (l_request_type_code = G_DELETE_TYPE) then
2714
2715 l_approval_status_code := G_SUBMIT_DELETE_STATUS;
2716
2717 else
2718
2719 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name,
2720 'Invalid Approval Request Type: '||l_request_type_code);
2721 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2722
2723 end if;
2724
2725 l_request_id := WF_ENGINE.GetItemAttrNumber(
2726 p_item_type, p_item_key, G_REQUEST_ID);
2727
2728 l_request_item_code := WF_ENGINE.GetItemAttrText(
2729 p_item_type, p_item_key, G_REQUEST_ITEM_CODE);
2730
2731 for req_obj_def_rec in req_obj_defs_cur(
2732 l_request_id
2733 ,l_request_item_code
2734 ,l_request_type_code) loop
2735
2736 SetApprovalStatus(
2737 p_obj_def_id => req_obj_def_rec.object_definition_id
2738 ,p_approval_status_code => l_approval_status_code
2739 );
2740
2741 end loop;
2742
2743 END SetSubmittedState;
2744
2745
2746 --
2747 -- PROCEDURE
2748 -- SetApprovedState
2749 --
2750 -- DESCRIPTION
2751 -- Sets all the business rule definitions in a workflow request to the
2752 -- approved state.
2753 --
2754 -- IN
2755 -- p_item_type - The workflow item type (FEMAPPR)
2756 -- p_item_key - The workflow request id (FEM_WF_REQUEST_ID_SEQ)
2757 --
2758 -- USED BY
2759 -- FEM_FEMAPPR_ITEM_TYPE SetApprovedState()
2760 --
2761 --------------------------------------------------------------------------------
2762 PROCEDURE SetApprovedState(
2763 p_item_type in varchar2
2764 ,p_item_key in varchar2
2765 )
2766 --------------------------------------------------------------------------------
2767 IS
2768
2769 l_api_name constant varchar2(30) := 'SetApprovedState';
2770
2771 l_request_id t_request_id%TYPE;
2772 l_request_item_code t_code%TYPE;
2773 l_request_type_code t_code%TYPE;
2774 l_approver_user_id t_id%TYPE;
2775
2776 l_return_status t_return_status%TYPE;
2777 l_msg_count t_msg_count%TYPE;
2778 l_msg_data t_msg_data%TYPE;
2779
2780 BEGIN
2781
2782 l_request_id := WF_ENGINE.GetItemAttrNumber(
2783 p_item_type, p_item_key, G_REQUEST_ID);
2784
2785 l_request_item_code := WF_ENGINE.GetItemAttrText(
2786 p_item_type, p_item_key, G_REQUEST_ITEM_CODE);
2787
2788 l_request_type_code := WF_ENGINE.GetItemAttrText(
2789 p_item_type, p_item_key, G_REQUEST_TYPE_CODE);
2790
2791 l_approver_user_id := WF_ENGINE.GetItemAttrNumber(
2792 p_item_type, p_item_key, G_APPROVER_USER_ID);
2793
2794 if (l_request_type_code = G_APPROVAL_TYPE) then
2795
2796 for req_obj_def_rec in req_obj_defs_cur(
2797 l_request_id
2798 ,l_request_item_code
2799 ,l_request_type_code) loop
2800
2801 SetApprovalStatus(
2802 p_obj_def_id => req_obj_def_rec.object_definition_id
2803 ,p_approval_status_code => G_APPROVED_STATUS
2804 ,p_approver_user_id => l_approver_user_id
2805 ,p_approval_date => sysdate
2806 );
2807
2808 end loop;
2809
2810 elsif (l_request_type_code = G_DELETE_TYPE) then
2811
2812 for req_obj_def_rec in req_obj_defs_cur(
2813 l_request_id
2814 ,l_request_item_code
2815 ,l_request_type_code) loop
2816
2817 DeleteObjectDefinition(
2818 p_object_type_code => req_obj_def_rec.object_type_code
2819 ,p_obj_def_id => req_obj_def_rec.object_definition_id
2820 ,x_return_status => l_return_status
2821 ,x_msg_count => l_msg_count
2822 ,x_msg_data => l_msg_data
2823 ,p_process_type => G_WORKFLOW
2824 );
2825
2826 if (l_return_status = FND_API.G_RET_STS_ERROR) then
2827 raise FND_API.G_EXC_ERROR;
2828 elsif (l_return_status = FND_API.G_RET_STS_UNEXP_ERROR) then
2829 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2830 end if;
2831
2832 end loop;
2833
2834 else
2835
2836 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name,
2837 'Invalid Approval Request Type: '||l_request_type_code);
2838 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2839
2840 end if;
2841
2842 END SetApprovedState;
2843
2844
2845 --
2846 -- PROCEDURE
2847 -- SetRejectedState
2848 --
2849 -- DESCRIPTION
2850 -- Sets all the business rule definitions in a workflow request to the
2851 -- rejected state.
2852 --
2853 -- IN
2854 -- p_item_type - The workflow item type (FEMAPPR)
2855 -- p_item_key - The workflow request id (FEM_WF_REQUEST_ID_SEQ)
2856 --
2860 --------------------------------------------------------------------------------
2857 -- USED BY
2858 -- FEM_FEMAPPR_ITEM_TYPE SetRejectedState()
2859 --
2861 PROCEDURE SetRejectedState(
2862 p_item_type in varchar2
2863 ,p_item_key in varchar2
2864 )
2865 --------------------------------------------------------------------------------
2866 IS
2867
2868 l_api_name constant varchar2(30) := 'SetRejectedState';
2869
2870 l_request_id t_request_id%TYPE;
2871 l_request_item_code t_code%TYPE;
2872 l_request_type_code t_code%TYPE;
2873
2874 BEGIN
2875
2876 l_request_id := WF_ENGINE.GetItemAttrNumber(
2877 p_item_type, p_item_key, G_REQUEST_ID);
2878
2879 l_request_item_code := WF_ENGINE.GetItemAttrText(
2880 p_item_type, p_item_key, G_REQUEST_ITEM_CODE);
2881
2882 l_request_type_code := WF_ENGINE.GetItemAttrText(
2883 p_item_type, p_item_key, G_REQUEST_TYPE_CODE);
2884
2885 if (l_request_type_code in (G_APPROVAL_TYPE, G_DELETE_TYPE)) then
2886
2887 for req_obj_def_rec in req_obj_defs_cur(
2888 l_request_id
2889 ,l_request_item_code
2890 ,l_request_type_code) loop
2891
2892 -- Set to the previous approval status
2893 SetApprovalStatus(
2894 p_obj_def_id => req_obj_def_rec.object_definition_id
2895 ,p_approval_status_code => req_obj_def_rec.prev_approval_status_code
2896 );
2897
2898 end loop;
2899
2900 else
2901
2902 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name,
2903 'Invalid Approval Request Type: '||l_request_type_code);
2904 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2905
2906 end if;
2907
2908 END SetRejectedState;
2909
2910
2911 --
2912 -- FUNCTION
2913 -- CheckApprovalItems
2914 --
2915 -- DESCRIPTION
2916 -- Checks to see if a workflow request contains any business rule
2917 -- definitions.
2918 --
2919 -- IN
2920 -- p_item_type - The workflow item type (FEMAPPR)
2921 -- p_item_key - The workflow request id (FEM_WF_REQUEST_ID_SEQ)
2922 --
2923 -- RETURNS
2924 -- approval_items_exist - Approval Items Exist Flag (YES, NO)
2925 --
2926 -- USED BY
2927 -- FEM_FEMAPPR_ITEM_TYPE CheckApprovalItems()
2928 --
2929 --------------------------------------------------------------------------------
2930 FUNCTION CheckApprovalItems(
2931 p_item_type in varchar2
2932 ,p_item_key in varchar2
2933 )
2934 RETURN varchar2
2935 --------------------------------------------------------------------------------
2936 IS
2937
2938 l_api_name constant varchar2(30) := 'CheckApprovalItems';
2939
2940 l_request_id t_request_id%TYPE;
2941 l_request_type_code t_code%TYPE;
2942 l_request_item_code t_code%TYPE;
2943
2944 l_count number;
2945
2946 BEGIN
2947
2948 l_request_type_code := WF_ENGINE.GetItemAttrText(
2949 p_item_type, p_item_key, G_REQUEST_TYPE_CODE);
2950
2951 if (l_request_type_code in (G_APPROVAL_TYPE, G_DELETE_TYPE)) then
2952
2953 l_request_item_code := WF_ENGINE.GetItemAttrText(
2954 p_item_type, p_item_key, G_REQUEST_ITEM_CODE);
2955
2956 l_request_id := WF_ENGINE.GetItemAttrNumber(
2957 p_item_type, p_item_key, G_REQUEST_ID);
2958
2959 l_count := GetObjectDefinitionsCount(
2960 p_request_id => l_request_id
2961 ,p_request_item_code => l_request_item_code
2962 ,p_request_type_code => l_request_type_code
2963 );
2964
2965 if (l_count > 0) then
2966 return G_YES;
2967 else
2968 return G_NO;
2969 end if;
2970
2971 else
2972
2973 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name,
2974 'Invalid Approval Request Type: '||l_request_type_code);
2975 raise FND_API.G_EXC_UNEXPECTED_ERROR;
2976
2977 end if;
2978
2979 END CheckApprovalItems;
2980
2981
2982 --
2983 -- PROCEDURE
2984 -- InitApprovalItems
2985 --
2986 -- DESCRIPTION
2987 -- Initializes the workflow item attributes with information from the
2988 -- object definitions in a workflow request
2989 --
2990 -- IN
2991 -- p_item_type - The workflow item type (FEMAPPR)
2992 -- p_item_key - The workflow request id (FEM_WF_REQUEST_ID_SEQ)
2993 --
2994 -- USED BY
2995 -- FEM_FEMAPPR_ITEM_TYPE InitApprovalItems()
2996 --
2997 --------------------------------------------------------------------------------
2998 PROCEDURE InitApprovalItems(
2999 p_item_type in varchar2
3000 ,p_item_key in varchar2
3001 )
3002 --------------------------------------------------------------------------------
3003 IS
3004
3005 l_api_name constant varchar2(30) := 'InitApprovalItems';
3006
3007 l_request_id t_request_id%TYPE;
3008 l_request_type_code t_code%TYPE;
3009 l_request_item_code t_code%TYPE;
3010
3011 l_url t_url%TYPE;
3015 BEGIN
3012 l_obj_def_id t_object_definition_id%TYPE;
3013 l_old_approved_copy_obj_def_id t_object_definition_id%TYPE;
3014
3016
3017 l_request_type_code := WF_ENGINE.GetItemAttrText(
3018 p_item_type, p_item_key, G_REQUEST_TYPE_CODE);
3019
3020 l_request_item_code := WF_ENGINE.GetItemAttrText(
3021 p_item_type, p_item_key, G_REQUEST_ITEM_CODE);
3022
3023 l_request_id := WF_ENGINE.GetItemAttrNumber(
3024 p_item_type, p_item_key, G_REQUEST_ID);
3025
3026 if (l_request_type_code in (G_APPROVAL_TYPE, G_DELETE_TYPE)) then
3027
3028 for info_obj_def_rec in info_obj_defs_cur(
3029 l_request_id
3030 ,l_request_item_code
3031 ,l_request_type_code) loop
3032
3033 l_obj_def_id := info_obj_def_rec.object_definition_id;
3034
3035 WF_ENGINE.SetItemAttrNumber(
3036 p_item_type
3037 ,p_item_key
3038 ,G_OBJECT_DEFINITION_ID
3039 ,l_obj_def_id
3040 );
3041
3042 WF_ENGINE.SetItemAttrText(
3043 p_item_type
3044 ,p_item_key
3045 ,G_OBJECT_DEFINITION_NAME
3046 ,info_obj_def_rec.object_definition_name
3047 );
3048
3049 WF_ENGINE.SetItemAttrText(
3050 p_item_type
3051 ,p_item_key
3052 ,G_OBJECT_NAME
3053 ,info_obj_def_rec.object_name
3054 );
3055
3056 WF_ENGINE.SetItemAttrText(
3057 p_item_type
3058 ,p_item_key
3059 ,G_OBJECT_TYPE_CODE
3060 ,info_obj_def_rec.object_type_code
3061 );
3062
3063 WF_ENGINE.SetItemAttrText(
3064 p_item_type
3065 ,p_item_key
3066 ,G_OBJECT_TYPE
3067 ,info_obj_def_rec.object_type_name
3068 );
3069
3070 WF_ENGINE.SetItemAttrText(
3071 p_item_type
3072 ,p_item_key
3073 ,G_FOLDER_NAME
3074 ,info_obj_def_rec.folder_name
3075 );
3076
3077 l_url :=
3078 G_URL_FUNCTION || info_obj_def_rec.view_only_oa_function_name ||
3079 G_URL_PAGE_MODE_VIEW ||
3080 G_URL_FOLDER_ID || info_obj_def_rec.folder_id ||
3081 G_URL_OBJ_DEF_ID;
3082
3083 WF_ENGINE.SetItemAttrText(
3084 p_item_type
3085 ,p_item_key
3086 ,G_URL_SUBMITTED
3087 ,l_url || to_char(l_obj_def_id)
3088 );
3089
3090 WF_ENGINE.SetItemAttrText(
3091 p_item_type
3092 ,p_item_key
3093 ,G_URL_REJECTED
3094 ,l_url || to_char(l_obj_def_id)
3095 );
3096
3097 if (l_request_type_code = G_APPROVAL_TYPE) then
3098
3099 WF_ENGINE.SetItemAttrText(
3100 p_item_type
3101 ,p_item_key
3102 ,G_URL_APPROVED
3103 ,l_url || to_char(l_obj_def_id)
3104 );
3105
3106 if (info_obj_def_rec.old_approved_copy_obj_def_id is not null) then
3107
3108 WF_ENGINE.SetItemAttrText(
3109 p_item_type
3110 ,p_item_key
3111 ,G_URL_ORIGINAL
3112 ,l_url || to_char(info_obj_def_rec.old_approved_copy_obj_def_id)
3113 );
3114
3115 end if;
3116
3117 elsif (l_request_type_code = G_DELETE_TYPE) then
3118
3119 null;
3120
3121 end if;
3122
3123 end loop;
3124
3125 else
3126
3127 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name,
3128 'Invalid Approval Request Type: '||l_request_type_code);
3129 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3130
3131 end if;
3132
3133 END InitApprovalItems;
3134
3135
3136 --
3137 -- PROCEDURE
3138 -- PurgeApprovalRequest
3139 --
3140 -- DESCRIPTION
3141 -- Deletes all the appropriate approval request records from the
3142 -- FEM_WF_REQ_OBJECT_DEFS table.
3143 --
3144 -- IN
3145 -- p_item_type - The workflow item type (FEMAPPR)
3146 -- p_item_key - The workflow request id (FEM_WF_REQUEST_ID_SEQ)
3147 --
3148 -- USED BY
3149 -- FEM_FEMAPPR_ITEM_TYPE PurgeApprovalRequest()
3150 --
3151 --------------------------------------------------------------------------------
3152 PROCEDURE PurgeApprovalRequest (
3153 p_item_type in varchar2
3154 ,p_item_key in varchar2
3155 )
3156 --------------------------------------------------------------------------------
3157 IS
3158
3159 l_api_name constant varchar2(30) := 'PurgeApprovalItems';
3160
3161 l_request_id t_request_id%TYPE;
3162
3163 BEGIN
3164
3165 l_request_id := WF_ENGINE.GetItemAttrNumber(
3166 p_item_type, p_item_key, G_REQUEST_ID);
3167
3168 if (l_request_id is not null) then
3169
3170 delete from fem_wf_req_object_defs
3171 where wf_request_id = l_request_id;
3172
3173 end if;
3174
3175 END PurgeApprovalRequest;
3176
3177
3178
3179 --------------------------------------------------------------------------------
3180 -- PRIVATE BODIES
3181 --------------------------------------------------------------------------------
3185 -- SetApprovalStatus
3182
3183 --
3184 -- PROCEDURE
3186 --
3187 -- DESCRIPTION
3188 -- Sets the approval status of an object defintion id. Can also set the
3189 -- approver's user id and the approval date.
3190 --
3191 -- IN
3192 -- p_obj_def_id - Object Definition ID
3193 -- p_approval_status_code - Approval Status Code (APPROVED, NOT_APPROVED, etc)
3194 -- p_approver_user_id - FND User ID of the approver (Optional)
3195 -- p_approval_date - Approval Date (Optional)
3196 --
3197 --------------------------------------------------------------------------------
3198 PROCEDURE SetApprovalStatus (
3199 p_obj_def_id in number
3200 ,p_approval_status_code in varchar2 := FND_API.G_MISS_CHAR
3201 ,p_approver_user_id in number := FND_API.G_MISS_NUM
3202 ,p_approval_date in date := FND_API.G_MISS_DATE
3203 )
3204 --------------------------------------------------------------------------------
3205 IS
3206 l_api_name constant varchar2(30) := 'SetApprovalStatus';
3207
3208 l_prg_msg VARCHAR2(2000);
3209 l_callstack VARCHAR2(2000);
3210 BEGIN
3211
3212 FEM_ENGINES_PKG.Tech_Message (
3213 p_severity => G_LOG_LEVEL_3
3214 ,p_module => G_BLOCK||'.'|| l_api_name
3215 ,p_msg_text => 'BEGIN, p_obj_def_id:' || p_obj_def_id
3216 || ' p_approval_status_code:' || p_approval_status_code
3217 || ' p_approver_user_id:' || p_approver_user_id
3218 || ' p_approval_date:' || p_approval_date
3219 );
3220
3221 update fem_object_definition_b
3222 set approval_status_code =
3223 decode(p_approval_status_code
3224 ,FND_API.G_MISS_CHAR,approval_status_code
3225 ,p_approval_status_code)
3226 ,approved_by =
3227 decode(p_approver_user_id
3228 ,FND_API.G_MISS_NUM,approved_by
3229 ,p_approver_user_id)
3230 ,approval_date =
3231 decode(p_approval_date
3232 ,FND_API.G_MISS_DATE,approval_date
3233 ,p_approval_date)
3234 ,last_updated_by = FND_GLOBAL.user_id
3235 ,last_update_date = sysdate
3236 ,last_update_login = FND_GLOBAL.login_id
3237 where object_definition_id = p_obj_def_id;
3238
3239 FEM_ENGINES_PKG.Tech_Message (
3240 p_severity => G_LOG_LEVEL_3
3241 ,p_module => G_BLOCK||'.'|| l_api_name
3242 ,p_msg_text => 'END'
3243 );
3244
3245 EXCEPTION
3246 when others then
3247 l_callstack := DBMS_UTILITY.Format_Call_Stack;
3248 l_prg_msg := SQLERRM;
3249 FEM_ENGINES_PKG.Tech_Message (
3250 p_severity => G_LOG_LEVEL_6
3251 ,p_module => G_BLOCK||'.'||l_api_name
3252 ,p_msg_text => 'others, l_callstack:' || l_callstack
3253 );
3254 FEM_ENGINES_PKG.Tech_Message (
3255 p_severity => G_LOG_LEVEL_6
3256 ,p_module => G_BLOCK||'.'||l_api_name
3257 ,p_msg_text => 'others 1, l_prg_msg:' || l_prg_msg
3258 );
3259 RAISE;
3260
3261 END SetApprovalStatus;
3262
3263
3264 --
3265 -- FUNCTION
3266 -- GetApprovalStatus
3267 --
3268 -- DESCRIPTION
3269 -- Gets the approval status of an object defintion id.
3270 --
3271 -- IN
3272 -- p_obj_def_id - Object Definition ID
3273 --
3274 -- RETURNS
3275 -- approval_status_code - Approval Status Code (APPROVED, NOT_APPROVED, etc)
3276 --
3277 --------------------------------------------------------------------------------
3278 FUNCTION GetApprovalStatus(
3279 p_obj_def_id in number
3280 )
3281 RETURN varchar2
3282 --------------------------------------------------------------------------------
3283 IS
3284
3285 l_approval_status_code t_approval_status_code%TYPE;
3286
3287 BEGIN
3288
3289 select approval_status_code
3290 into l_approval_status_code
3291 from fem_object_definition_b
3292 where object_definition_id = p_obj_def_id;
3293
3294 return l_approval_status_code;
3295
3296 EXCEPTION
3297
3298 when others then
3299 return null;
3300
3301 END GetApprovalStatus;
3302
3303
3304 --
3305 -- FUNCTION
3306 -- GetObjectPlsqlPkgName
3307 --
3308 -- DESCRIPTION
3309 -- Gets the PL/SQL package name for a business rule with the specified
3310 -- object type code.
3311 --
3312 -- IN
3313 -- p_object_type_code - Object Type Code
3314 --
3315 -- RETURNS
3316 -- package_name - PL/SQL Package Name (FEM_BR_MAPPING_RULE_PVT, etc)
3317 --
3318 --------------------------------------------------------------------------------
3319 FUNCTION GetObjectPlsqlPkgName(
3320 p_object_type_code in varchar2
3321 )
3322 RETURN varchar2
3323 --------------------------------------------------------------------------------
3324 IS
3325
3326 l_package_name t_plsql_pkg_name%TYPE;
3327 l_api_name constant varchar2(30) := 'GetObjectPlsqlPkgName';
3328
3329 l_prg_msg VARCHAR2(2000);
3330 l_callstack VARCHAR2(2000);
3331
3332 BEGIN
3333
3334 FEM_ENGINES_PKG.Tech_Message (
3335 p_severity => G_LOG_LEVEL_3
3336 ,p_module => G_BLOCK||'.'|| l_api_name
3340 into l_package_name
3337 ,p_msg_text => 'BEGIN, p_object_type_code:' || p_object_type_code
3338 );
3339 select object_plsql_pkg_name
3341 from fem_object_types
3342 where object_type_code = p_object_type_code;
3343
3344 FEM_ENGINES_PKG.Tech_Message (
3345 p_severity => G_LOG_LEVEL_3
3346 ,p_module => G_BLOCK||'.'|| l_api_name
3347 ,p_msg_text => 'END'
3348 );
3349
3350 return l_package_name;
3351
3352 EXCEPTION
3353 when others then
3354 l_callstack := DBMS_UTILITY.Format_Call_Stack;
3355 l_prg_msg := SQLERRM;
3356 FEM_ENGINES_PKG.Tech_Message (
3357 p_severity => G_LOG_LEVEL_6
3358 ,p_module => G_BLOCK||'.'||l_api_name
3359 ,p_msg_text => 'others, l_callstack:' || l_callstack
3360 );
3361 FEM_ENGINES_PKG.Tech_Message (
3362 p_severity => G_LOG_LEVEL_6
3363 ,p_module => G_BLOCK||'.'||l_api_name
3364 ,p_msg_text => 'others 1, l_prg_msg:' || l_prg_msg
3365 );
3366 RAISE;
3367
3368 END GetObjectPlsqlPkgName;
3369
3370
3371 --
3372 -- PROCEDURE
3373 -- CopyObjectDefinitionInternal
3374 --
3375 -- DESCRIPTION
3376 -- Internal implementation for copying a source object definition into a
3377 -- target object definition. A full copy includes copying the records in
3378 -- FEM_OBJECT_DEFINITIONS_VL.
3379 --
3380 -- IN
3381 -- p_copy_type - Copy Type
3382 -- p_object_type_code - Object Type Code
3383 -- p_source_obj_def_id - Source Object Definition ID
3384 -- p_target_obj_def_id - Target Object Definition ID
3385 -- p_target_copy_flag - Target's Old Approved Copy Flag value
3386 -- p_is_full_copy - Is Full Copy (include FEM_OBJECT_DEFINITION_VL)
3387 -- p_is_new_copy - Is New Copy (indicates new info in WHO columns)
3388 --
3389 --------------------------------------------------------------------------------
3390 PROCEDURE CopyObjectDefinitionInternal (
3391 p_copy_type_code in varchar2
3392 ,p_object_type_code in varchar2
3393 ,p_source_obj_def_id in number
3394 ,p_target_obj_def_id in number
3395 ,p_target_copy_flag in varchar2
3396 ,p_is_full_copy in boolean
3397 ,p_is_new_copy in boolean
3398 )
3399 --------------------------------------------------------------------------------
3400 IS
3401
3402 l_package_name t_plsql_pkg_name%TYPE;
3403 l_dynamic_query long;
3404
3405 l_created_by number;
3406 l_creation_date date;
3407
3408 BEGIN
3409
3410 l_created_by := null;
3411 l_creation_date := null;
3412
3413 if (p_is_new_copy) then
3414 l_created_by := FND_GLOBAL.user_id;
3415 l_creation_date := sysdate;
3416 end if;
3417
3418 if (p_is_full_copy) then
3419
3420 CopyObjectDefinitionRec (
3421 p_source_obj_def_id => p_source_obj_def_id
3422 ,p_target_obj_def_id => p_target_obj_def_id
3423 ,p_target_copy_flag => p_target_copy_flag
3424 ,p_created_by => l_created_by
3425 ,p_creation_date => l_creation_date
3426 );
3427
3428 end if;
3429
3430 -- Copy the Object Dependency records (if they exist)
3431 CopyObjectDependencyRecs (
3432 p_source_obj_def_id => p_source_obj_def_id
3433 ,p_target_obj_def_id => p_target_obj_def_id
3434 ,p_created_by => l_created_by
3435 ,p_creation_date => l_creation_date
3436 );
3437
3438 -- Copy the Visual Tracing Object Definition Attribute record (if it exists)
3439 CopyVtObjDefAttrRec(
3440 p_source_obj_def_id => p_source_obj_def_id
3441 ,p_target_obj_def_id => p_target_obj_def_id
3442 ,p_created_by => l_created_by
3443 ,p_creation_date => l_creation_date
3444 );
3445
3446 l_package_name := GetObjectPlsqlPkgName(p_object_type_code);
3447 if (l_package_name is not null) then
3448
3449 -- Bug Fix 4141575: Mapping Rules need support for copying Dependent Objects
3450 -- to handle Local Conditions. This required adding the p_copy_type_code
3451 -- parameter to the CopyObjectDefinition() procedure that all Business Rules
3452 -- implement. Until all other business rules update CopyObjectDefinition(),
3453 -- only allow Mapping Rules to call this new signature.
3454 if (p_object_type_code = 'MAPPING_RULE') then
3455
3456 l_dynamic_query :=
3457 ' begin '||
3458 l_package_name||'.CopyObjectDefinition ('||
3459 ' p_copy_type_code => :b_copy_type_code'||
3460 ' ,p_source_obj_def_id => :b_source_obj_def_id'||
3461 ' ,p_target_obj_def_id => :b_target_obj_def_id'||
3462 ' ,p_created_by => :b_created_by'||
3463 ' ,p_creation_date => :b_creation_date'||
3464 ' );'||
3465 ' end;';
3466
3467 execute immediate l_dynamic_query
3468 using p_copy_type_code
3469 ,p_source_obj_def_id
3470 ,p_target_obj_def_id
3471 ,l_created_by
3472 ,l_creation_date;
3473
3474 else
3475
3476 l_dynamic_query :=
3477 ' begin '||
3478 l_package_name||'.CopyObjectDefinition ('||
3482 ' ,p_creation_date => :b_creation_date'||
3479 ' p_source_obj_def_id => :b_source_obj_def_id'||
3480 ' ,p_target_obj_def_id => :b_target_obj_def_id'||
3481 ' ,p_created_by => :b_created_by'||
3483 ' );'||
3484 ' end;';
3485
3486 execute immediate l_dynamic_query
3487 using p_source_obj_def_id
3488 ,p_target_obj_def_id
3489 ,l_created_by
3490 ,l_creation_date;
3491
3492 end if;
3493
3494 end if;
3495
3496 END CopyObjectDefinitionInternal;
3497
3498
3499 --
3500 -- PROCEDURE
3501 -- DeleteObjectDefinitionInternal
3502 --
3503 -- DESCRIPTION
3504 -- Internal implementation for deleting an object definition.
3505 --
3506 -- IN
3507 -- p_object_type_code - Object Type Code
3508 -- p_obj_def_id - Object Definition ID
3509 --
3510 --------------------------------------------------------------------------------
3511 PROCEDURE DeleteObjectDefinitionInternal(
3512 p_object_type_code in varchar2
3513 ,p_obj_def_id in number
3514 )
3515 --------------------------------------------------------------------------------
3516 IS
3517
3518 l_package_name t_plsql_pkg_name%TYPE;
3519 l_dynamic_query varchar2(2000);
3520
3521 l_api_name constant varchar2(30) := 'DeleteObjectDefinitionInternal';
3522
3523 l_prg_msg VARCHAR2(2000);
3524 l_callstack VARCHAR2(2000);
3525
3526 BEGIN
3527
3528 FEM_ENGINES_PKG.Tech_Message (
3529 p_severity => G_LOG_LEVEL_3
3530 ,p_module => G_BLOCK||'.'|| l_api_name
3531 ,p_msg_text => 'BEGIN, p_object_type_code:' || p_object_type_code || ' p_obj_def_id:' || p_obj_def_id
3532 );
3533
3534 -- NMARTINE -- Bug Fix 4141575 -- Must delete Object Dependencies before
3535 -- calling delete on Detail Records, otherwise Backup/Revert will not be
3536 -- able to delete a Local Condition.
3537 DeleteObjectDependencyRecs(p_obj_def_id);
3538
3539 FEM_ENGINES_PKG.Tech_Message (
3540 p_severity => G_LOG_LEVEL_3
3541 ,p_module => G_BLOCK||'.'|| l_api_name
3542 ,p_msg_text => 'BEGIN1'
3543 );
3544
3545 l_package_name := GetObjectPlsqlPkgName(p_object_type_code);
3546
3547 FEM_ENGINES_PKG.Tech_Message (
3548 p_severity => G_LOG_LEVEL_3
3549 ,p_module => G_BLOCK||'.'|| l_api_name
3550 ,p_msg_text => 'BEGIN2, l_package_name:' || l_package_name
3551 );
3552
3553
3554 if (l_package_name is not null) then
3555
3556 l_dynamic_query :=
3557 ' begin '||
3558 l_package_name||'.DeleteObjectDefinition(:p_obj_def_id);'||
3559 ' end;';
3560
3561 FEM_ENGINES_PKG.Tech_Message (
3562 p_severity => G_LOG_LEVEL_3
3563 ,p_module => G_BLOCK||'.'|| l_api_name
3564 ,p_msg_text => 'BEGIN3, l_dynamic_query:' || l_dynamic_query
3565 );
3566 execute immediate l_dynamic_query
3567 using p_obj_def_id;
3568
3569 end if;
3570
3571 FEM_ENGINES_PKG.Tech_Message (
3572 p_severity => G_LOG_LEVEL_3
3573 ,p_module => G_BLOCK||'.'|| l_api_name
3574 ,p_msg_text => 'BEGIN4'
3575 );
3576 -- Delete the Visual Tracing Object Definition Attribute record (if it exists)
3577 DeleteVtObjDefAttrRec(p_obj_def_id);
3578
3579 FEM_ENGINES_PKG.Tech_Message (
3580 p_severity => G_LOG_LEVEL_3
3581 ,p_module => G_BLOCK||'.'|| l_api_name
3582 ,p_msg_text => 'BEGIN5'
3583 );
3584
3585 DeleteObjectDefinitionRec(p_obj_def_id);
3586 FEM_ENGINES_PKG.Tech_Message (
3587 p_severity => G_LOG_LEVEL_3
3588 ,p_module => G_BLOCK||'.'|| l_api_name
3589 ,p_msg_text => 'END'
3590 );
3591 EXCEPTION
3592 when others then
3593 l_callstack := DBMS_UTILITY.Format_Call_Stack;
3594 l_prg_msg := SQLERRM;
3595 FEM_ENGINES_PKG.Tech_Message (
3596 p_severity => G_LOG_LEVEL_6
3597 ,p_module => G_BLOCK||'.'||l_api_name
3598 ,p_msg_text => 'others, l_callstack:' || l_callstack
3599 );
3600 FEM_ENGINES_PKG.Tech_Message (
3601 p_severity => G_LOG_LEVEL_6
3602 ,p_module => G_BLOCK||'.'||l_api_name
3603 ,p_msg_text => 'others 1, l_prg_msg:' || l_prg_msg
3604 );
3605 RAISE;
3606
3607 END DeleteObjectDefinitionInternal;
3608
3609
3610 --
3611 -- PROCEDURE
3612 -- CopyObjectDetailsInternal
3613 --
3614 -- DESCRIPTION
3615 -- Internal implementation for copying only the detail records of a source
3616 -- object into a target object.
3617 --
3618 -- IN
3619 -- p_copy_type - Copy Type
3620 -- p_object_type_code - Object Type Code
3621 -- p_source_obj_id - Source Object ID
3622 -- p_target_obj_id - Target Object ID
3623 --
3624 --------------------------------------------------------------------------------
3625 PROCEDURE CopyObjectDetailsInternal (
3626 p_copy_type_code in varchar2
3627 ,p_object_type_code in varchar2
3628 ,p_source_obj_id in number
3629 ,p_target_obj_id in number
3630 )
3631 --------------------------------------------------------------------------------
3635 l_dynamic_query long;
3632 IS
3633
3634 l_package_name t_plsql_pkg_name%TYPE;
3636 l_sql_err_code number;
3637
3638 l_created_by number;
3639 l_creation_date date;
3640
3641 BEGIN
3642
3643 l_created_by := FND_GLOBAL.user_id;
3644 l_creation_date := sysdate;
3645
3646 l_package_name := GetObjectPlsqlPkgName(p_object_type_code);
3647 if (l_package_name is not null) then
3648
3649 l_dynamic_query :=
3650 ' begin '||
3651 l_package_name||'.CopyObjectDetails ('||
3652 ' p_copy_type_code => :b_copy_type_code'||
3653 ' ,p_source_obj_id => :b_source_obj_id'||
3654 ' ,p_target_obj_id => :b_target_obj_id'||
3655 ' ,p_created_by => :b_created_by'||
3656 ' ,p_creation_date => :b_creation_date'||
3657 ' );'||
3658 ' end;';
3659
3660 begin
3661 execute immediate l_dynamic_query
3662 using p_copy_type_code
3663 ,p_source_obj_id
3664 ,p_target_obj_id
3665 ,l_created_by
3666 ,l_creation_date;
3667 exception
3668 -- If the CopyObjectDetails API has not been implemented by a
3669 -- Business Rule, then catch the exception and do nothing.
3670 when G_PLSQL_COMPILATION_ERROR then null;
3671 end;
3672
3673 end if;
3674
3675 END CopyObjectDetailsInternal;
3676
3677
3678 --
3679 -- PROCEDURE
3680 -- DeleteObjectDetailsInternal
3681 --
3682 -- DESCRIPTION
3683 -- Internal implementation for deleting only the detail records of an object.
3684 --
3685 -- IN
3686 -- p_object_type_code - Object Type Code
3687 -- p_obj_id - Object ID
3688 --
3689 --------------------------------------------------------------------------------
3690 PROCEDURE DeleteObjectDetailsInternal(
3691 p_object_type_code in varchar2
3692 ,p_obj_id in number
3693 )
3694 --------------------------------------------------------------------------------
3695 IS
3696
3697 l_package_name t_plsql_pkg_name%TYPE;
3698 l_dynamic_query varchar2(2000);
3699
3700 BEGIN
3701 FEM_ENGINES_PKG.Tech_Message (
3702 p_severity => G_LOG_LEVEL_3
3703 ,p_module => G_BLOCK||'.'|| 'DeleteObjectDetailsInternal'
3704 ,p_msg_text => 'BEGIN, p_object_type_code:' || p_object_type_code || ' p_obj_id:' || p_obj_id
3705 );
3706
3707 l_package_name := GetObjectPlsqlPkgName(p_object_type_code);
3708
3709 FEM_ENGINES_PKG.Tech_Message (
3710 p_severity => G_LOG_LEVEL_3
3711 ,p_module => G_BLOCK||'.'|| 'DeleteObjectDetailsInternal'
3712 ,p_msg_text => 'l_package_name:' || l_package_name
3713 );
3714 if (l_package_name is not null) then
3715
3716 l_dynamic_query :=
3717 ' begin '||
3718 l_package_name||'.DeleteObjectDetails(:p_obj_id);'||
3719 ' end;';
3720
3721 FEM_ENGINES_PKG.Tech_Message (
3722 p_severity => G_LOG_LEVEL_3
3723 ,p_module => G_BLOCK||'.'|| 'DeleteObjectDetailsInternal'
3724 ,p_msg_text => 'l_dynamic_query:' || l_dynamic_query
3725 );
3726 begin
3727 execute immediate l_dynamic_query
3728 using p_obj_id;
3729 exception
3730 -- If the DeleteObjectDetails API has not been implemented by a
3731 -- Business Rule, then catch the exception and do nothing.
3732 when G_PLSQL_COMPILATION_ERROR then null;
3733 end;
3734
3735 -- Bug#6496686 -- Begin
3736 l_dynamic_query :=
3737 ' begin '||
3738 l_package_name||'.DeleteTuningOptionDetails(:p_obj_id);'||
3739 ' end;';
3740
3741 begin
3742 execute immediate l_dynamic_query
3743 using p_obj_id;
3744 exception
3745 -- If the DeleteTuningOptionDetails API has not been implemented by a
3746 -- Business Rule, then catch the exception and do nothing.
3747 when G_PLSQL_COMPILATION_ERROR then null;
3748 end;
3749 -- Bug#6496686 -- End
3750
3751 end if;
3752
3753 END DeleteObjectDetailsInternal;
3754
3755
3756 --
3757 -- PROCEDURE
3758 -- CopyObjectRec
3759 --
3760 -- DESCRIPTION
3761 -- Creates a new Object by copying records in the FEM_OBJECT_CATALOG_VL
3762 -- table.
3763 --
3764 -- IN
3765 -- p_source_obj_id - Source Object ID
3766 -- p_target_obj_id - Target Object ID
3767 -- p_target_obj_name - Target Object Name
3768 -- p_target_obj_desc - Target Object Description
3769 -- p_created_by - Created By (FND User ID).
3770 -- p_creation_date - Creation Date.
3771 --
3772 --------------------------------------------------------------------------------
3773 PROCEDURE CopyObjectRec (
3774 p_source_obj_id in number
3775 ,p_target_obj_id in number
3776 ,p_target_obj_name in varchar2
3777 ,p_target_obj_desc in varchar2 := FND_API.G_MISS_CHAR
3778 ,p_created_by in number
3779 ,p_creation_date in date
3780 )
3781 --------------------------------------------------------------------------------
3782 IS
3783
3787 l_rowid rowid;
3784 l_api_name constant varchar2(30) := 'CopyObjectRec';
3785
3786 l_obj_vl_rec fem_object_catalog_vl%ROWTYPE;
3788
3789 BEGIN
3790
3791 select p_target_obj_id
3792 ,object_type_code
3793 ,folder_id
3794 ,local_vs_combo_id
3795 ,object_access_code
3796 ,object_origin_code
3797 ,p_target_obj_name
3798 ,decode(p_target_obj_desc,FND_API.G_MISS_CHAR,description,p_target_obj_desc)
3799 ,nvl(p_creation_date,creation_date)
3800 ,nvl(p_created_by,created_by)
3801 ,sysdate
3802 ,FND_GLOBAL.user_id
3803 ,FND_GLOBAL.login_id
3804 ,object_version_number
3805 into l_obj_vl_rec.object_id
3806 ,l_obj_vl_rec.object_type_code
3807 ,l_obj_vl_rec.folder_id
3808 ,l_obj_vl_rec.local_vs_combo_id
3809 ,l_obj_vl_rec.object_access_code
3810 ,l_obj_vl_rec.object_origin_code
3811 ,l_obj_vl_rec.object_name
3812 ,l_obj_vl_rec.description
3813 ,l_obj_vl_rec.creation_date
3814 ,l_obj_vl_rec.created_by
3815 ,l_obj_vl_rec.last_update_date
3816 ,l_obj_vl_rec.last_updated_by
3817 ,l_obj_vl_rec.last_update_login
3818 ,l_obj_vl_rec.object_version_number
3819 from fem_object_catalog_vl
3820 where object_id = p_source_obj_id;
3821
3822 FEM_OBJECT_CATALOG_PKG.Insert_Row (
3823 x_rowid => l_rowid
3824 ,x_object_id => l_obj_vl_rec.object_id
3825 ,x_object_type_code => l_obj_vl_rec.object_type_code
3826 ,x_folder_id => l_obj_vl_rec.folder_id
3827 ,x_local_vs_combo_id => l_obj_vl_rec.local_vs_combo_id
3828 ,x_object_access_code => l_obj_vl_rec.object_access_code
3829 ,x_object_origin_code => l_obj_vl_rec.object_origin_code
3830 ,x_object_name => l_obj_vl_rec.object_name
3831 ,x_description => l_obj_vl_rec.description
3832 ,x_creation_date => l_obj_vl_rec.creation_date
3833 ,x_created_by => l_obj_vl_rec.created_by
3834 ,x_last_update_date => l_obj_vl_rec.last_update_date
3835 ,x_last_updated_by => l_obj_vl_rec.last_updated_by
3836 ,x_last_update_login => l_obj_vl_rec.last_update_login
3837 ,x_object_version_number => l_obj_vl_rec.object_version_number
3838 );
3839
3840 END CopyObjectRec;
3841
3842
3843 --
3844 -- PROCEDURE
3845 -- CopyObjectDefinitionRec
3846 --
3847 -- DESCRIPTION
3848 -- Creates a new Object Definition by copying records in the
3849 -- FEM_OBJECT_DEFINITION_VL table.
3850 --
3851 -- IN
3852 -- p_source_obj_def_id - Source Object Definition ID
3853 -- p_target_obj_def_id - Target Object Definition ID
3854 -- p_target_copy_flag - Target's Old Approved Copy Flag value
3855 -- p_created_by - Created By (FND User ID).
3856 -- p_creation_date - Creation Date.
3857 --
3858 --------------------------------------------------------------------------------
3859 PROCEDURE CopyObjectDefinitionRec (
3860 p_source_obj_def_id in number
3861 ,p_target_obj_def_id in number
3862 ,p_target_obj_id in number := FND_API.G_MISS_NUM
3863 ,p_target_obj_def_name in varchar2 := FND_API.G_MISS_CHAR
3864 ,p_target_obj_def_desc in varchar2 := FND_API.G_MISS_CHAR
3865 ,p_target_start_date in date := FND_API.G_MISS_DATE
3866 ,p_target_end_date in date := FND_API.G_MISS_DATE
3867 ,p_target_copy_flag in varchar2
3868 ,p_target_copy_obj_def_id in number := FND_API.G_MISS_NUM
3869 ,p_created_by in number
3870 ,p_creation_date in date
3871 )
3872 --------------------------------------------------------------------------------
3873 IS
3874
3875 l_api_name constant varchar2(30) := 'CopyObjectDefinitionRec';
3876
3877 l_obj_def_vl_rec fem_object_definition_vl%ROWTYPE;
3878 l_rowid rowid;
3879
3880 BEGIN
3881
3882 if (p_target_copy_flag in (G_CURRENT_COPY, G_OLD_APPROVED_COPY)) then
3883
3884
3885 select p_target_obj_def_id
3886 ,decode(p_target_obj_id,FND_API.G_MISS_NUM,object_id,p_target_obj_id)
3887 ,decode(p_target_start_date,FND_API.G_MISS_DATE,effective_start_date,p_target_start_date)
3888 ,decode(p_target_end_date,FND_API.G_MISS_DATE,effective_end_date,p_target_end_date)
3889 ,object_origin_code
3890 ,approval_status_code
3891 ,approved_by
3892 ,approval_date
3893 ,p_target_copy_flag
3894 ,decode(p_target_copy_obj_def_id,FND_API.G_MISS_NUM,old_approved_copy_obj_def_id,p_target_copy_obj_def_id)
3895 ,decode(p_target_obj_def_name,FND_API.G_MISS_CHAR,display_name,p_target_obj_def_name)
3896 ,decode(p_target_obj_def_desc,FND_API.G_MISS_CHAR,description,p_target_obj_def_desc)
3897 ,nvl(p_creation_date,creation_date)
3898 ,nvl(p_created_by,created_by)
3899 ,sysdate
3900 ,FND_GLOBAL.user_id
3901 ,FND_GLOBAL.login_id
3902 ,object_version_number
3903 into l_obj_def_vl_rec.object_definition_id
3904 ,l_obj_def_vl_rec.object_id
3905 ,l_obj_def_vl_rec.effective_start_date
3906 ,l_obj_def_vl_rec.effective_end_date
3907 ,l_obj_def_vl_rec.object_origin_code
3911 ,l_obj_def_vl_rec.old_approved_copy_flag
3908 ,l_obj_def_vl_rec.approval_status_code
3909 ,l_obj_def_vl_rec.approved_by
3910 ,l_obj_def_vl_rec.approval_date
3912 ,l_obj_def_vl_rec.old_approved_copy_obj_def_id
3913 ,l_obj_def_vl_rec.display_name
3914 ,l_obj_def_vl_rec.description
3915 ,l_obj_def_vl_rec.creation_date
3916 ,l_obj_def_vl_rec.created_by
3917 ,l_obj_def_vl_rec.last_update_date
3918 ,l_obj_def_vl_rec.last_updated_by
3919 ,l_obj_def_vl_rec.last_update_login
3920 ,l_obj_def_vl_rec.object_version_number
3921 from fem_object_definition_vl
3922 where object_definition_id = p_source_obj_def_id;
3923
3924 FEM_OBJECT_DEFINITION_PKG.Insert_Row (
3925 x_rowid => l_rowid
3926 ,x_object_definition_id => l_obj_def_vl_rec.object_definition_id
3927 ,x_object_id => l_obj_def_vl_rec.object_id
3928 ,x_effective_start_date => l_obj_def_vl_rec.effective_start_date
3929 ,x_effective_end_date => l_obj_def_vl_rec.effective_end_date
3930 ,x_object_origin_code => l_obj_def_vl_rec.object_origin_code
3931 ,x_approval_status_code => l_obj_def_vl_rec.approval_status_code
3932 ,x_approved_by => l_obj_def_vl_rec.approved_by
3933 ,x_approval_date => l_obj_def_vl_rec.approval_date
3934 ,x_old_approved_copy_flag => l_obj_def_vl_rec.old_approved_copy_flag
3935 ,x_old_approved_copy_obj_def_id => l_obj_def_vl_rec.old_approved_copy_obj_def_id
3936 ,x_display_name => l_obj_def_vl_rec.display_name
3937 ,x_description => l_obj_def_vl_rec.description
3938 ,x_creation_date => l_obj_def_vl_rec.creation_date
3939 ,x_created_by => l_obj_def_vl_rec.created_by
3940 ,x_last_update_date => l_obj_def_vl_rec.last_update_date
3941 ,x_last_updated_by => l_obj_def_vl_rec.last_updated_by
3942 ,x_last_update_login => l_obj_def_vl_rec.last_update_login
3943 ,x_object_version_number => l_obj_def_vl_rec.object_version_number
3944 );
3945
3946 else
3947
3948 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name,
3949 'Invalid Old Approved Copy Flag: '||p_target_copy_flag);
3950 raise FND_API.G_EXC_UNEXPECTED_ERROR;
3951
3952 end if;
3953
3954 END CopyObjectDefinitionRec;
3955
3956
3957 --
3958 -- PROCEDURE
3959 -- CopyObjectDependencyRecs
3960 --
3961 -- DESCRIPTION
3962 -- Creates new Object Dependencies by inserting records in the
3963 -- FEM_OBJECT_DEPENDENCIES table.
3964 --
3965 -- IN
3966 -- p_source_obj_def_id - Source Object Definition ID
3967 -- p_target_obj_def_id - Target Object Definition ID
3968 -- p_created_by - Created By (FND User ID).
3969 -- p_creation_date - Creation Date.
3970 --
3971 --------------------------------------------------------------------------------
3972 PROCEDURE CopyObjectDependencyRecs(
3973 p_source_obj_def_id in number
3974 ,p_target_obj_def_id in number
3975 ,p_created_by in number
3976 ,p_creation_date in date
3977 )
3978 --------------------------------------------------------------------------------
3979 IS
3980 BEGIN
3981
3982 insert into fem_object_dependencies (
3983 object_definition_id
3984 ,required_object_id
3985 ,created_by
3986 ,creation_date
3987 ,last_updated_by
3988 ,last_update_date
3989 ,last_update_login
3990 ,object_version_number
3991 ) select
3992 p_target_obj_def_id
3993 ,required_object_id
3994 ,nvl(p_created_by,created_by)
3995 ,nvl(p_creation_date,creation_date)
3996 ,FND_GLOBAL.user_id
3997 ,sysdate
3998 ,FND_GLOBAL.login_id
3999 ,object_version_number
4000 from fem_object_dependencies
4001 where object_definition_id = p_source_obj_def_id;
4002
4003 END CopyObjectDependencyRecs;
4004
4005
4006 --
4007 -- PROCEDURE
4008 -- CopyVtObjDefAttrRec
4009 --
4010 -- DESCRIPTION
4011 -- Creates new Visual Tracing Object Definition Attributes by inserting a
4012 -- record in the FEM_VT_OBJ_DEF_ATTRIBS table.
4013 --
4014 -- IN
4015 -- p_source_obj_def_id - Source Object Definition ID
4016 -- p_target_obj_def_id - Target Object Definition ID
4017 -- p_created_by - Created By (FND User ID).
4018 -- p_creation_date - Creation Date.
4019 --
4020 --------------------------------------------------------------------------------
4021 PROCEDURE CopyVtObjDefAttrRec(
4022 p_source_obj_def_id in number
4023 ,p_target_obj_def_id in number
4024 ,p_created_by in number
4025 ,p_creation_date in date
4026 )
4027 --------------------------------------------------------------------------------
4028 IS
4029 BEGIN
4030
4031 insert into fem_vt_obj_def_attribs (
4032 object_definition_id
4033 ,source_enabled_flg
4034 ,driver_enabled_flg
4035 ,trace_contribution_enabled_flg
4036 ,created_by
4037 ,creation_date
4038 ,last_updated_by
4039 ,last_update_date
4040 ,last_update_login
4041 ,object_version_number
4042 ) select
4043 p_target_obj_def_id
4044 ,source_enabled_flg
4045 ,driver_enabled_flg
4046 ,trace_contribution_enabled_flg
4047 ,nvl(p_created_by,created_by)
4048 ,nvl(p_creation_date,creation_date)
4049 ,FND_GLOBAL.user_id
4050 ,sysdate
4051 ,FND_GLOBAL.login_id
4052 ,object_version_number
4053 from fem_vt_obj_def_attribs
4054 where object_definition_id = p_source_obj_def_id;
4055
4056 END CopyVtObjDefAttrRec;
4057
4058
4059 --
4060 -- PROCEDURE
4061 -- DeleteObjectRec
4062 --
4063 -- DESCRIPTION
4064 -- Deletes an Object by performing deletes on records in the
4065 -- FEM_OBJECT_CATALOG_VL table.
4066 --
4067 -- IN
4068 -- p_obj_id - Object ID
4069 --
4070 --------------------------------------------------------------------------------
4071 PROCEDURE DeleteObjectRec(
4072 p_obj_id in number
4073 )
4074 --------------------------------------------------------------------------------
4075 IS
4076
4077 l_count number;
4078
4079 BEGIN
4080
4081 FEM_OBJECT_CATALOG_PKG.Delete_Row (
4082 x_object_id => p_obj_id
4083 );
4084
4085 EXCEPTION
4086
4087 when no_data_found then null;
4091
4088
4089 END DeleteObjectRec;
4090
4092 --
4093 -- PROCEDURE
4094 -- DeleteObjectDefinitionRec
4095 --
4096 -- DESCRIPTION
4097 -- Deletes a Business Rule Definition by performing deletes on records
4098 -- in the FEM_OBJECT_DEFINITIONS table.
4099 --
4100 -- IN
4101 -- p_obj_def_id - Object Definition ID
4102 --
4103 --------------------------------------------------------------------------------
4104 PROCEDURE DeleteObjectDefinitionRec(
4105 p_obj_def_id in number
4106 )
4107 --------------------------------------------------------------------------------
4108 IS
4109 BEGIN
4110
4111 FEM_OBJECT_DEFINITION_PKG.Delete_Row (
4112 x_object_definition_id => p_obj_def_id
4113 );
4114
4115 EXCEPTION
4116
4117 when no_data_found then null;
4118
4119 END DeleteObjectDefinitionRec;
4120
4121
4122 --
4123 -- PROCEDURE
4124 -- DeleteObjectDependencyRecs
4125 --
4126 -- DESCRIPTION
4127 -- Deletes Object Dependencies by performing deletes on records
4128 -- in the FEM_OBJECT_DEPENDENCIES table.
4129 --
4130 -- IN
4131 -- p_obj_def_id - Object Definition ID
4132 --
4133 --------------------------------------------------------------------------------
4134 PROCEDURE DeleteObjectDependencyRecs(
4135 p_obj_def_id in number
4136 )
4137 --------------------------------------------------------------------------------
4138 IS
4139 BEGIN
4140
4141 delete from fem_object_dependencies
4142 where object_definition_id = p_obj_def_id;
4143
4144 END DeleteObjectDependencyRecs;
4145
4146
4147 --
4148 -- PROCEDURE
4149 -- DeleteVtObjDefAttrRec
4150 --
4151 -- DESCRIPTION
4152 -- Deletes Visual Tracing Object Definition Attributes by performing deletes
4153 -- on records in the FEM_VT_OBJ_DEF_ATTRIBS table.
4154 --
4155 -- IN
4156 -- p_obj_def_id - Object Definition ID
4157 --
4158 --------------------------------------------------------------------------------
4159 PROCEDURE DeleteVtObjDefAttrRec(
4160 p_obj_def_id in number
4161 )
4162 --------------------------------------------------------------------------------
4163 IS
4164 BEGIN
4165
4166 delete from fem_vt_obj_def_attribs
4167 where object_definition_id = p_obj_def_id;
4168
4169 END DeleteVtObjDefAttrRec;
4170
4171
4172 --
4173 -- PROCEDURE
4174 -- SetOldApprovedObjDefId
4175 --
4176 -- DESCRIPTION
4177 -- Sets the old approved copy object definition id of the specified
4178 -- object definition.
4179 --
4180 -- IN
4181 -- p_obj_def_id - Object Definition ID
4182 -- p_old_approved_obj_def_id - Old Approved Object Definition ID
4183 --
4184 --------------------------------------------------------------------------------
4185 PROCEDURE SetOldApprovedObjDefId(
4186 p_obj_def_id in number
4187 ,p_old_approved_obj_def_id in number
4188 )
4189 --------------------------------------------------------------------------------
4190 IS
4191 BEGIN
4192
4193 update fem_object_definition_b
4194 set old_approved_copy_obj_def_id = p_old_approved_obj_def_id
4195 where old_approved_copy_flag = G_CURRENT_COPY
4196 and object_definition_id = p_obj_def_id;
4197
4198 END SetOldApprovedObjDefId;
4199
4200
4201 --
4202 -- PROCEDURE
4203 -- ObjectDefinitionExists
4204 --
4205 -- DESCRIPTION
4206 -- Checks to see if an object definition exists.
4207 --
4208 -- IN
4209 -- p_obj_def_id - Object Definition ID
4210 --
4211 -- RETURNS
4212 -- obj_def_exists - Object Definition Exists Flag (boolean)
4213 --
4214 --------------------------------------------------------------------------------
4215 FUNCTION ObjectDefinitionExists (
4216 p_obj_def_id in number
4217 )
4218 RETURN boolean
4219 --------------------------------------------------------------------------------
4220 IS
4221
4222 l_count number;
4223
4224 BEGIN
4225
4226 select count(object_definition_id)
4227 into l_count
4228 from fem_object_definition_b
4229 where object_definition_id = p_obj_def_id;
4230
4231 return (l_count > 0);
4232
4233 END ObjectDefinitionExists;
4234
4235
4236 --
4237 -- PROCEDURE
4238 -- IsObjectEmpty
4239 --
4240 -- DESCRIPTION
4241 -- Checks to see if an object can be deleted because there are no
4242 -- remaining object definitions.
4243 --
4244 -- IN
4245 -- p_obj_id - Object ID
4249 -- object_empty - Object Empty Flag (boolean)
4246 -- p_exclude obj_def_id - Object Definition ID to exclude from check
4247 --
4248 -- RETURNS
4250 --
4251 --------------------------------------------------------------------------------
4252 FUNCTION IsObjectEmpty(
4253 p_obj_id in number
4254 ,p_exclude_obj_def_id in number default null
4255 )
4256 RETURN boolean
4257 --------------------------------------------------------------------------------
4258 IS
4259
4260 l_count number;
4261
4262 BEGIN
4263
4264 select count(object_definition_id)
4265 into l_count
4266 from fem_object_definition_b
4267 where old_approved_copy_flag = G_CURRENT_COPY
4268 and object_id = p_obj_id
4269 and object_definition_id <> nvl(p_exclude_obj_def_id, -1);
4270
4271 return (l_count = 0);
4272
4273 END IsObjectEmpty;
4274
4275
4276 --
4277 -- PROCEDURE
4278 -- CreateWfReqObjectDefRow
4279 --
4280 -- DESCRIPTION
4281 -- PL/SQL API for creating a row in the FEM_WF_REQ_OBJECT_DEFS table.
4282 -- Used for raising FEM Business Rule Events.
4283 --
4284 -- IN
4285 -- p_wf_request_id - Workflow Request Id
4286 -- p_obj_def_id - Object Definition Id
4287 -- p_object_type_code - Object Type Code
4288 -- p_prev_approval_status_code - Previous Approval Status Code
4289 --
4290 --------------------------------------------------------------------------------
4291 PROCEDURE CreateWfReqObjectDefRow (
4292 p_wf_request_id in number
4293 ,p_obj_def_id in number
4294 ,p_object_type_code in varchar2
4295 ,p_prev_approval_status_code in varchar2
4296 )
4297 --------------------------------------------------------------------------------
4298 IS
4299 l_api_name constant varchar2(30) := 'CreateWfReqObjectDefRow';
4300
4301 l_prg_msg VARCHAR2(2000);
4302 l_callstack VARCHAR2(2000);
4303 BEGIN
4304 FEM_ENGINES_PKG.Tech_Message (
4305 p_severity => G_LOG_LEVEL_3
4306 ,p_module => G_BLOCK||'.'|| l_api_name
4307 ,p_msg_text => 'BEGIN, p_wf_request_id:' || p_wf_request_id
4308 || ' p_obj_def_id:' || p_obj_def_id || ' p_object_type_code:'
4309 || p_object_type_code || ' p_prev_approval_status_code:' || p_prev_approval_status_code
4310 );
4311
4312 insert into fem_wf_req_object_defs (
4313 wf_request_id
4314 ,object_definition_id
4315 ,prev_approval_status_code
4316 ,object_type_code
4317 ,creation_date
4318 ,created_by
4322 ,object_version_number
4319 ,last_updated_by
4320 ,last_update_date
4321 ,last_update_login
4323 ) values (
4324 p_wf_request_id
4325 ,p_obj_def_id
4326 ,p_prev_approval_status_code
4327 ,p_object_type_code
4328 ,sysdate
4329 ,FND_GLOBAL.User_Id
4330 ,FND_GLOBAL.User_Id
4331 ,sysdate
4332 ,FND_GLOBAL.Login_Id
4333 ,1
4334 );
4335
4336 FEM_ENGINES_PKG.Tech_Message (
4337 p_severity => G_LOG_LEVEL_3
4338 ,p_module => G_BLOCK||'.'|| l_api_name
4339 ,p_msg_text => 'END'
4340 );
4341 EXCEPTION
4342 when others then
4343 l_callstack := DBMS_UTILITY.Format_Call_Stack;
4344 l_prg_msg := SQLERRM;
4345 FEM_ENGINES_PKG.Tech_Message (
4346 p_severity => G_LOG_LEVEL_6
4347 ,p_module => G_BLOCK||'.'||l_api_name
4348 ,p_msg_text => 'others, l_callstack:' || l_callstack
4349 );
4350 FEM_ENGINES_PKG.Tech_Message (
4351 p_severity => G_LOG_LEVEL_6
4352 ,p_module => G_BLOCK||'.'||l_api_name
4353 ,p_msg_text => 'others 1, l_prg_msg:' || l_prg_msg
4354 );
4355 RAISE;
4356
4357 END CreateWfReqObjectDefRow;
4358
4359
4360 --
4361 -- FUNCTION
4362 -- GetObjectDefinitionsCount
4363 --
4364 -- DESCRIPTION
4365 -- Returns the number of object definition records based on the
4366 -- requires approval flag value.
4367 --
4368 -- IN
4369 -- p_request_id - Workflow Request ID
4370 -- p_request_item_code - Request Item Code (BUSINESS_RULE, etc)
4371 -- p_request_type_code - Approval Request Type (APPROVAL, DELETE, etc)
4372 --
4373 -- RETURNS
4374 -- count - Number of object defs in a workflow request
4375 --
4376 --------------------------------------------------------------------------------
4377 FUNCTION GetObjectDefinitionsCount(
4378 p_request_id in number
4379 ,p_request_item_code in varchar2
4380 ,p_request_type_code in varchar2
4381 )
4382 RETURN number
4383 --------------------------------------------------------------------------------
4384 IS
4385
4386 l_count number;
4387
4388 BEGIN
4389
4390 select count(*)
4391 into l_count
4392 from fem_wf_requests req
4393 ,fem_wf_req_object_defs req_def
4394 ,fem_object_definition_b def
4395 ,fem_object_catalog_b obj
4396 ,fem_object_types typ
4397 where req.wf_request_id = p_request_id
4398 and req.wf_request_item_code = p_request_item_code
4399 and req.wf_request_type_code = p_request_type_code
4400 and req_def.wf_request_id = req.wf_request_id
4401 and def.object_definition_id = req_def.object_definition_id
4402 and def.old_approved_copy_flag = G_CURRENT_COPY
4403 and obj.object_id = def.object_id
4404 and typ.object_type_code = obj.object_type_code
4405 and typ.workflow_enabled_flag = 'Y';
4406
4407 return l_count;
4408
4409 END GetObjectDefinitionsCount;
4410
4411
4412 --
4413 -- PROCEDURE
4414 -- CheckOverlapObjDefsInternal
4415 --
4416 -- DESCRIPTION
4417 -- Checks if the specified effective dates will overlap with existing
4418 -- object definitions under the same parent object. If this check is for
4419 -- updating the effective dates of an existing object definition, this
4420 -- object definition must be excluded from the overlap check.
4421 -- If an overlap exists the appropriate FND message is set and an exception
4422 -- is raised.
4423 --
4424 -- IN
4425 -- p_obj_id - Object ID
4426 -- p_exclude obj_def_id - Object Definition ID to exclude from check
4427 -- p_effective_start_date - The new effective start date
4428 -- p_effective_end_date - The new effective end date
4429 -- p_action_type - Action Type
4430 --
4431 --------------------------------------------------------------------------------
4432 PROCEDURE CheckOverlapObjDefsInternal(
4433 p_obj_id in number
4434 ,p_exclude_obj_def_id in number
4435 ,p_effective_start_date in date
4436 ,p_effective_end_date in date
4437 ,p_action_type in number
4438 )
4439 --------------------------------------------------------------------------------
4440 IS
4441
4442 overlapping_obj_def_rec overlapping_obj_defs_cur%ROWTYPE;
4443
4444 BEGIN
4445
4446 -- First check that the end date is not smaller than the start date.
4447 if (p_effective_end_date < p_effective_start_date) then
4448
4449 FND_MESSAGE.set_name('FEM', 'FEM_BR_END_LT_START_DATE_ERR');
4450 FND_MESSAGE.set_token('START_DATE',FND_DATE.date_to_chardate(p_effective_start_date));
4451 FND_MESSAGE.set_token('END_DATE',FND_DATE.date_to_chardate(p_effective_end_date));
4452 FND_MSG_PUB.Add;
4453 raise FND_API.G_EXC_ERROR;
4454
4455 end if;
4456
4457 if (p_obj_id is not null) then
4458
4459 for overlapping_obj_def_rec in overlapping_obj_defs_cur(
4460 p_obj_id => p_obj_id
4461 ,p_exclude_obj_def_id => p_exclude_obj_def_id
4462 ,p_effective_start_date => p_effective_start_date
4463 ,p_effective_end_date => p_effective_end_date
4464 ) loop
4465
4466 -- If any records are returned in the overlapping_obj_defs_cur, then
4467 -- an overlap exists with at least one object definition.
4468 if (p_action_type = G_REVERT_ACTION_TYPE) then
4469 FND_MESSAGE.set_name('FEM', 'FEM_BR_RVRT_OVRLP_OBJ_DEF_ERR');
4470 else
4471 FND_MESSAGE.set_name('FEM', 'FEM_BR_OVRLP_OBJ_DEF_ERR');
4472 end if;
4473
4474 FND_MESSAGE.set_token('VERSION_NAME', overlapping_obj_def_rec.object_definition_name);
4475 FND_MESSAGE.set_token('START_DATE',FND_DATE.date_to_chardate(overlapping_obj_def_rec.effective_start_date));
4476 FND_MESSAGE.set_token('END_DATE',FND_DATE.date_to_chardate(overlapping_obj_def_rec.effective_end_date));
4477 FND_MSG_PUB.Add;
4478
4479 raise FND_API.G_EXC_ERROR;
4480
4481 end loop;
4482
4483 end if;
4484
4485 END CheckOverlapObjDefsInternal;
4486
4487
4488 --
4489 -- PROCEDURE
4490 -- GetEffectiveDates
4491 --
4492 -- DESCRIPTION
4493 -- Returns the Start and End Effective Dates of the specified Object
4494 -- Definition.
4495 --
4496 -- IN
4497 -- p_obj_def_id - Object Definition ID
4498 --
4499 -- OUT
4500 -- x_effective_start_date - Effective Start Date
4501 -- x_effective_end_date - Effective End Date
4502 --
4503 --------------------------------------------------------------------------------
4504 PROCEDURE GetEffectiveDates(
4505 p_obj_def_id in number
4506 ,x_effective_start_date out nocopy date
4507 ,x_effective_end_date out nocopy date
4508 )
4509 --------------------------------------------------------------------------------
4510 IS
4511 BEGIN
4512
4513 select effective_start_date, effective_end_date
4514 into x_effective_start_date, x_effective_end_date
4515 from fem_object_definition_b
4516 where object_definition_id = p_obj_def_id;
4517
4518 END GetEffectiveDates;
4519
4520
4521 --
4522 -- PROCEDURE
4523 -- GetProfileOptionDateValue
4524 --
4525 -- DESCRIPTION
4526 -- Returns the date value of the specified profile option. All profile
4527 -- option values are stored as string values, so we must convert the string
4528 -- value into a date value by using ICX_DATE_FORMAT_MASK.
4529 --
4530 -- IN
4531 -- p_profile_option_name - Profile Option Name
4532 --
4533 -- RETURN
4534 -- x_date_value - Date Value
4535 --
4536 --------------------------------------------------------------------------------
4537 FUNCTION GetProfileOptionDateValue (
4538 p_profile_option_name in varchar2
4539 )
4540 RETURN date
4541 --------------------------------------------------------------------------------
4542 IS
4543
4544 l_api_name constant varchar2(80) := 'GetProfileOptionDateValue';
4545
4546 l_date_value date;
4547 l_date_format_mask varchar2(240);
4548 l_date_string varchar2(240);
4549
4550
4551 BEGIN
4552
4553 l_date_value := null;
4554
4555 --l_date_string := FND_PROFILE.value(p_profile_option_name);
4556 --Bug#5604779
4557 l_date_string := FND_PROFILE.Value_Specific(p_profile_option_name);
4558
4559 if (l_date_string is not null) then
4560
4561 -- Bug 5508120 -- NMARTINE -- 01-SEP-2006
4562 -- Effective End Date profile option is now stored in Canonical format
4563 l_date_value := FND_DATE.Canonical_To_Date(l_date_string);
4564
4565 -- Remove the time component.
4566 l_date_value := trunc(l_date_value);
4567
4568 end if;
4569
4570 return l_date_value;
4571
4572 END GetProfileOptionDateValue;
4573
4574
4575
4576 END FEM_BUSINESS_RULE_PVT;