DBA Data[Home] [Help]

PACKAGE BODY: APPS.EGO_ITEM_CATALOG_PVT

Source


1 PACKAGE BODY EGO_ITEM_CATALOG_PVT AS
2 /* $Header: EGOVCAGB.pls 120.5 2011/04/26 18:42:45 sreharih ship $ */
3 
4 
5 --
6 -- Bug 9972194. Not able to update ICC with versions. It is due to fix for 8471604,
7 -- which was trying to prevent update of parent if multiple version exists for
8 -- child.
9 -- Added below functions to check existence of versions.
10 -- sreharih. Wed Apr 13 17:53:34 PDT 2011
11 --
12 FUNCTION check_versions_exists (p_catalog_group_id IN NUMBER)  RETURN BOOLEAN IS
13 
14   CURSOR c IS
15     SELECT 1
16       FROM dual
17       WHERE EXISTS (SELECT NULL
18                       FROM ego_mtl_catalog_grp_vers_b ver
19                      WHERE ver.item_catalog_group_id = p_catalog_group_id
20                        AND version_seq_id > 0);
21   l_temp NUMBER(10);
22 BEGIN
23     OPEN c;
24     FETCH c INTO l_temp;
25     CLOSE c;
26 
27    IF l_temp = 1 THEN
28     RETURN true;
29    ELSE
30     RETURN false;
31    END IF;
32 
33 END check_versions_exists;
34 
35 --
36 -- Bug 9972194. Not able to update ICC with versions. It is due to fix for 8471604,
37 -- which was trying to prevent update of parent if multiple version exists for
38 -- child.
39 -- Added below functions to check whether udpate of parent ICC col allowed
40 -- sreharih. Wed Apr 13 17:53:34 PDT 2011
41 --
42 
43 FUNCTION is_parent_update_allowed (p_catalog_group_id IN NUMBER) RETURN BOOLEAN IS
44    l_p4t_enabled fnd_profile_option_values.profile_option_value%TYPE;
45 
46 BEGIN
47 
48   l_p4t_enabled := fnd_profile.value('EGO_ENABLE_P4T');
49 
50   IF l_p4t_enabled = 'Y' THEN
51     IF check_versions_exists(p_catalog_group_id) THEN
52      RETURN false;
53     END IF;
54   END IF;
55 
56   return true;
57 END is_parent_update_allowed;
58 
59 --
60 -- Bug 12394675. Issue #3: New method to check whether parent
61 -- is updated or not.
62 -- sreharih. Mon Apr 25 16:27:38 PDT 2011
63 --
64 FUNCTION is_parent_updated (p_catalog_group_id   IN NUMBER,
65                             p_parent_group_id    IN NUMBER,
66                             p_parent_group_name  IN VARCHAR2) RETURN BOOLEAN IS
67 
68  l_parent_group_id    mtl_item_catalog_groups_b.parent_catalog_group_id%TYPE;
69  l_parent_group_name  mtl_item_catalog_groups_v.catalog_concat_segs%TYPE;
70 
71  CURSOR c IS
72   SELECT parent.item_catalog_group_id, parent.catalog_concat_segs
73     FROM mtl_item_catalog_groups_b cat,
74          mtl_item_catalog_groups_v parent
75    WHERE cat.item_catalog_group_id   = p_catalog_group_id
76      AND cat.parent_catalog_group_id = parent.item_catalog_group_id ;
77 
78 BEGIN
79  OPEN c;
80  FETCH c INTO l_parent_group_id, l_parent_group_name;
81  CLOSE c;
82 
83  IF (p_parent_group_id = l_parent_group_id)     OR
84     (p_parent_group_name = l_parent_group_name) OR
85     ( (l_parent_group_id IS NULL)
86       AND (p_parent_group_id IS NULL   OR p_parent_group_id = FND_API.G_MISS_NUM)
87       AND (p_parent_group_name IS NULL OR p_parent_group_name = FND_API.G_MISS_CHAR)
88     )   THEN
89    RETURN false;
90  ELSE
91    RETURN true;
92  END IF;
93 
94 END is_parent_updated;
95 
96 
97 /* Private API for processing catalog groups
98 ** Applications should not call this catalog group api directly.
99 ** return_status: this is returned by the api to indicate the success/failure of the call
100 ** msg_count: this is returned by the api to indicate the number of message logged for this
101 ** call.
102 **
103 */
104 
105 	Procedure Process_Catalog_Groups
106 	(  x_return_status           OUT NOCOPY VARCHAR2
107 	 , x_msg_count               OUT NOCOPY NUMBER
108 	 )
109 	IS
110 		l_Table_Index NUMBER;
111 		l_Mesg_Token_Tbl        Error_Handler.Mesg_Token_Tbl_Type;
112 		l_other_token_tbl       Error_Handler.Token_Tbl_Type;
113 		l_other_message         VARCHAR2(2000);
114 		l_err_text              VARCHAR2(2000);
115 		l_valid                 BOOLEAN := TRUE;
116 		l_Return_Status         VARCHAR2(1);
117 		l_bo_return_status      VARCHAR2(1);
118 
119 
120 	BEGIN
121 
122 		-- Business Object starts with a status of Success
123 
124 		l_bo_return_status := 'S';
125 
126 		Error_Handler.Write_Debug('Starting PVT processing in Process_Catalog_Groups ');
127 		-- dbms_output.put_line('Starting PVT processing in Process_Catalog_Groups ');
128 
129 		-- begin processing the catalog group table
130 
131 		--
132 		-- all references to the input data must be made from the global reference.
133 		-- That must be maintained as the source of truth for all data.
134 		--
135 
136 		-- Every catalog group record is a business object.
137 
138 		-- dbms_output.Put_Line('Records to Process: ' || EGO_Globals.G_Catalog_Group_Tbl.COUNT);
139 
140 		FOR l_Table_Index IN 1..EGO_Globals.G_Catalog_Group_Tbl.COUNT
141 		LOOP
142 		BEGIN
143 
144 			l_return_status	   := 'S';
145 
146 			EGO_Globals.G_Catalog_Group_Rec := EGO_Globals.G_Catalog_Group_Tbl(l_Table_Index);
147 
148 /*
149 		      -- CHECHAND - changes for pim for telco - bug # 8471604 - START
150 
151 		      if profile_value = 'Y' AND EGO_Globals.G_Catalog_Group_Rec.transaction_type =	Ego_Globals.G_OPR_UPDATE THEN
152 			  SELECT Count(*) INTO version_count FROM EGO_MTL_CATALOG_GRP_VERS_B
153 			  WHERE
154 			    item_catalog_group_id = (SELECT item_catalog_group_id FROM mtl_item_catalog_groups_b WHERE segment1=EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Name)
155 			    AND version_seq_id>0;
156 			  --dbms_output.put_line('Processing catalog group id: '||EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Name ||' version count: ' || version_count);
157 			  if VERSION_COUNT <> 0 THEN
158 			    x_return_status	   := 'U';
159 			    RETURN;
160 			  END IF;
161 		      end if;
162 		      -- CHECHAND - changes for pim for telco - bug # 8471604 - END
163 */
164 
165                      --
166                      -- Bug 9972194. Not able to update ICC with versions. It is due to fix for 8471604,
167                      -- which was trying to prevent update of parent if multiple version exists for
168                      -- child.
169                      -- Commented code for 8471604 above and checking for versions only if user is
170                      -- passing parent catalog values.
171                      -- sreharih. Wed Apr 13 17:53:34 PDT 2011
172                      -- Bug 12394675. Issue #3. Check the condition only if parent is actually getting updated.
173                      -- sreharih. Mon Apr 25 16:27:38 PDT 2011.
174                      --
175 
176                       IF EGO_Globals.G_Catalog_Group_Rec.transaction_type = Ego_Globals.G_OPR_UPDATE THEN
177 
178                          IF (EGO_Globals.G_Catalog_Group_Rec.Parent_Catalog_Group_Name IS NOT NULL OR
179                              EGO_Globals.G_Catalog_Group_Rec.Parent_Catalog_Group_Name <> FND_API.G_MISS_CHAR) OR
180                             (EGO_Globals.G_Catalog_Group_Rec.Parent_Catalog_Group_Id IS NOT NULL OR
181                              EGO_Globals.G_Catalog_Group_Rec.Parent_Catalog_Group_Id <> FND_API.G_MISS_NUM) THEN
182 
183                             IF is_parent_updated (p_catalog_group_id  => EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Id,
184                                                   p_parent_group_id   => EGO_Globals.G_Catalog_Group_Rec.Parent_Catalog_Group_Id,
185                                                   p_parent_group_name => EGO_Globals.G_Catalog_Group_Rec.Parent_Catalog_Group_Name) THEN
186 
187                                   IF (NOT is_parent_update_allowed(EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Id)) THEN
188 
189                                      l_return_status := FND_API.G_RET_STS_ERROR;
190                                      Error_Handler.Write_Debug('Raising exception as parent update is not allowed. . .QUIT_RECORD');
191                                      l_other_message := 'EGO_ICC_DIS_UPD';
192                                      RAISE EGO_Globals.G_EXC_SEV_QUIT_RECORD;
193 
194                                  END IF; -- parent update allowed
195 
196                             END IF;  -- parent updated
197 
198                          END IF; -- parent id not null
199 
200                       END IF; -- update
201 
202 			EGO_Item_Catalog_Pub.G_KF_Segment_Values(1) :=
203 							EGO_Globals.G_Catalog_Group_Rec.Segment1;
204                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(2) :=
205 							EGO_Globals.G_Catalog_Group_Rec.Segment2;
206                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(3) :=
207 							EGO_Globals.G_Catalog_Group_Rec.Segment3;
208                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(4) :=
209 							EGO_Globals.G_Catalog_Group_Rec.Segment4;
210                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(5) :=
211 							EGO_Globals.G_Catalog_Group_Rec.Segment5;
212                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(6) :=
213 							EGO_Globals.G_Catalog_Group_Rec.Segment6;
214                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(7) :=
215 							EGO_Globals.G_Catalog_Group_Rec.Segment7;
216                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(8) :=
217 							EGO_Globals.G_Catalog_Group_Rec.Segment8;
218                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(9) :=
219 							EGO_Globals.G_Catalog_Group_Rec.Segment9;
220                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(10) :=
221 							EGO_Globals.G_Catalog_Group_Rec.Segment10;
222                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(11) :=
223 							EGO_Globals.G_Catalog_Group_Rec.Segment11;
224                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(12) :=
225 							EGO_Globals.G_Catalog_Group_Rec.Segment12;
226                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(13) :=
227 							EGO_Globals.G_Catalog_Group_Rec.Segment13;
228                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(14) :=
229 							EGO_Globals.G_Catalog_Group_Rec.Segment14;
230                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(15) :=
231 							EGO_Globals.G_Catalog_Group_Rec.Segment15;
232                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(16) :=
233 							EGO_Globals.G_Catalog_Group_Rec.Segment16;
234                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(17) :=
235 							EGO_Globals.G_Catalog_Group_Rec.Segment17;
236                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(18) :=
237 							EGO_Globals.G_Catalog_Group_Rec.Segment18;
238                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(19) :=
239 							EGO_Globals.G_Catalog_Group_Rec.Segment19;
240                 	EGO_Item_Catalog_Pub.G_KF_Segment_Values(20) :=
241 							EGO_Globals.G_Catalog_Group_Rec.Segment20;
242 
243 
244 
245 			/* Assign null to the segments that are not used */
246 
247                 	FOR i in 1..20
248                 	LOOP
249 				IF EGO_Item_Catalog_Pub.G_KF_Segment_Values(i) = FND_API.G_MISS_CHAR
250 				THEN
251                     			EGO_Item_Catalog_Pub.G_KF_Segment_Values(i) := null;
252 				END IF;
253                 	END LOOP;
254 
255 			--
256 			-- Transaction Type Validity
257 			--
258 
259 			Error_Handler.Write_Debug('Performing trasaction type validity ');
260 			-- dbms_output.put_line('Performing trasaction type validity ');
261 
262 			EGO_Globals.Transaction_Type_Validity
263 			(   p_Entity_Id		=> EGO_Globals.G_ITEM_CATALOG_GROUP
264 			  , p_Entity	        => EGO_Globals.G_ITEM_CATALOG_GROUP
265 			  , p_transaction_type	=> EGO_Globals.G_Catalog_Group_Rec.Transaction_Type
266 			  , x_valid		=> l_valid
267 			  , x_mesg_token_tbl	=> l_mesg_token_tbl
268 			 );
269 
270 
271 			IF l_valid <> true
272            		THEN
273 			    -- quit since the record does not have a valid transaction type.
274 			    l_return_status := FND_API.G_RET_STS_ERROR;
275                 	    RAISE EGO_Globals.G_EXC_SEV_QUIT_RECORD;
276            		END IF;
277 
278 
279 			--
280 			-- Process Flow step 4.a - User Unique Index to Unique index conversion - I
281 			--
282 			Error_Handler.Write_Debug('Performing UUI-UI conversion ');
283 			-- dbms_output.put_line('Performing UUI-UI conversion ');
284 			EGO_ItemCat_Val_To_Id.EGO_ItemCatalog_UUI_To_UI
285 			(  x_return_status	=> l_return_status
286 			 , x_mesg_token_tbl	=> l_mesg_token_tbl
287 			);
288 
289 			Error_Handler.Write_Debug('UUI conversion returned . . .');
290 			IF l_return_status = Error_Handler.G_STATUS_ERROR
291 			THEN
292 				Error_Handler.Write_Debug('Raising exception . . .QUIT_RECORD');
293 				-- dbms_output.put_line('Raising exception . . .QUIT_RECORD');
294                 		RAISE EGO_Globals.G_EXC_SEV_QUIT_RECORD;
295            		ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
296            		THEN
297                 		l_other_message := 'EGO_CATG_UUI_UNEXP_SKIP';
298                 		l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
299                 		l_other_token_tbl(1).token_value :=
300                         		EGO_Globals.G_Catalog_Group_Rec.catalog_group_name;
301                 		RAISE EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT;
302            		END IF;
303 
304 			--
305 			-- Process Flow step 4.b - User Unique index to Unique Index conversion II
306 			--
307 
308 			-- This is not required for catalog groups
309 
310 			--
311            		-- Process Flow step 5: Verify existence
312            		--
313 			Error_Handler.Write_Debug('Performing check existence ');
314 			-- dbms_output.put_line('Performing check existence ');
315            		Ego_Validate_Catalog_Group.Check_Existence
316                 	(  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
317                 	,  x_return_status              => l_Return_Status
318                 	 );
319 
320 			IF l_return_status = Error_Handler.G_STATUS_ERROR
321            		THEN
322                 		RAISE EGO_Globals.G_EXC_SEV_QUIT_RECORD;
323            		ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
324            		THEN
325                 		l_other_message := 'EGO_CATGRP_EXS_UNEXP_SKIP';
326                 		l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
327                 		l_other_token_tbl(1).token_value :=
328                         		Ego_globals.G_Catalog_Group_Rec.Catalog_Group_Name;
329                 		RAISE EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT;
330            		END IF;
331 
332 			--
333 			-- To support SYNC, copy the transaction type from the old record which will
334 			-- be set in check existence
335 			--
336 			IF Ego_Globals.G_Catalog_Group_Rec.transaction_type = 'SYNC'
337 			THEN
338              			Ego_Globals.G_Catalog_Group_Rec.transaction_type :=
339                  		Ego_Globals.G_Old_Catalog_Group_Rec.transaction_type;
340            		END IF;
341 
342 			--
343 			-- Process Flow Step 7: Check Lineage not required for Catalog Groups
344 			--
345 
346 			--
347 			-- Process Flow Step 8: Check Access.
348 			-- Check if the user has access to create the catalog group.
349 			--
350 
351 			Error_Handler.Write_Debug('Performing check access');
352 			-- dbms_output.put_line('Performing check access');
353 
354 			Ego_Validate_Catalog_Group.Check_Access
355 			(  x_return_status	=> l_return_status
356 			 , x_mesg_token_tbl	=> l_mesg_token_tbl
357 			 );
358 
359 			IF l_return_status = Error_Handler.G_STATUS_ERROR
360                 	THEN
361                         	l_other_message := 'EGO_CATGRP_ACC_FAT_FATAL';
362                         	l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
363                         	l_other_token_tbl(1).token_value :=
364                                 	Ego_Globals.G_Catalog_Group_rec.Catalog_Group_Name;
365                         	l_return_status := 'F';
366                         	RAISE EGO_Globals.G_EXC_FAT_QUIT_SIBLINGS;
367                 	ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
368                 	THEN
369                         	l_other_message := 'BOM_CATGRP_ACC_UNEXP_SKIP';
370 				l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
371                         	l_other_token_tbl(1).token_value :=
372                                 	Ego_Globals.G_Catalog_Group_rec.Catalog_Group_Name;
373 
374                         	RAISE EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT;
375                 	END IF;
376 
377 			--
378 			-- Process Flow step 9: Check Attributes
379 			--
380 
381 			IF EGO_Globals.G_Catalog_Group_Rec.transaction_type IN
382                 		(Ego_Globals.G_OPR_UPDATE, Ego_Globals.G_OPR_CREATE)
383         		THEN
384 				Error_Handler.Write_Debug('Performing check attributes');
385 				-- dbms_output.put_line('Performing check attributes');
386 				EGO_Validate_Catalog_Group.Check_Attributes
387 				(  x_return_status	=> l_return_status
388 				 , x_mesg_token_tbl	=> l_mesg_token_tbl
389 				 );
390 
391 				IF l_return_status = Error_Handler.G_STATUS_ERROR
392                 		THEN
393                         		RAISE EGO_Globals.G_EXC_SEV_QUIT_RECORD;
394                 		ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
395                 		THEN
396                         		RAISE EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT;
397                 		END IF;
398 
399 			END IF;
400 
401 			--
402 			-- Process Flow step 10: Populate null columns for UPDATE
403 			-- OR Perform attribute defaulting for CREATE
404 			--
405 
406 			IF EGO_Globals.G_Catalog_Group_Rec.transaction_type IN
407                 		(EGO_Globals.G_OPR_UPDATE, EGO_Globals.G_OPR_DELETE)
408             		THEN
409                     		Error_Handler.Write_Debug('Populate NULL columns . . .');
410 
411                     		Ego_Default_Catalog_Group.Populate_Null_Columns;
412 
413 -- Bug 3324531
414 -- changed the global Bom_Globals.G_OPR_CREATE to EGO_Globals.G_OPR_CREATE
415 			ELSIF EGO_Globals.G_Catalog_Group_Rec.transaction_type = EGO_Globals.G_OPR_CREATE
416 			THEN
417                     		Error_Handler.Write_Debug('Attribute Defaulting . . .');
418 
419 				Ego_Default_Catalog_Group.Attribute_Defaulting
420 				(  x_return_status	=> l_return_status
421 				 , x_mesg_token_tbl	=> l_mesg_token_tbl
422 				 );
423 
424 				IF l_return_status = Error_Handler.G_STATUS_ERROR
425                 		THEN
426                         		l_other_message := 'EGO_CATGRP_ATTDEF_CSEV_SKIP';
427                         		l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
428                         		l_other_token_tbl(1).token_value :=
429                                 		EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Name;
430                         		RAISE EGO_Globals.G_EXC_SEV_SKIP_BRANCH;
431                 		ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
432                 		THEN
433                         		l_other_message := 'EGO_CATGRP_ATTDEF_UNEXP_SKIP';
434                         		l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
435                         		l_other_token_tbl(1).token_value :=
436                                 		EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Name;
437                         		RAISE EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT;
438                 		END IF;
439 			END IF;
440 
441 			Error_Handler.write_debug('Finished with attribute defaulting . . .');
442 			Error_Handler.write_debug('Proceeding with entity validations . . .');
443 			-- dbms_output.put_line('Proceeding with entity validations . . .');
444 
445 			IF EGO_Globals.G_Catalog_Group_Rec.transaction_type <> EGO_Globals.G_OPR_DELETE
446            		THEN
447                 		Ego_Validate_Catalog_Group.Check_Entity
448                 		(  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
449                 		,  x_return_status              => l_Return_Status
450                 		);
451 
452 				IF l_return_status = Error_Handler.G_STATUS_ERROR
453            			THEN
454                 			RAISE EGO_Globals.G_EXC_SEV_QUIT_RECORD;
455            			ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
456            			THEN
457                 			l_other_message := 'EGO_CATGRP_ENTVAL_UNEXP_SKIP';
458                 			l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
459                 			l_other_token_tbl(1).token_value :=
460                         			EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Name;
461                 			RAISE EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT;
462            			END IF;
463 			ELSIF EGO_Globals.G_Catalog_Group_Rec.transaction_type = EGO_Globals.G_OPR_DELETE
464                         THEN
465                                 Ego_Validate_Catalog_Group.Check_Entity_Delete
466                                 (  x_Mesg_Token_Tbl             => l_Mesg_Token_Tbl
467                                 ,  x_return_status              => l_Return_Status
468                                 );
469 
470 				-- dbms_output.put_line('Return Status is . . .'||l_return_status);
471 
472                                 IF l_return_status = Error_Handler.G_STATUS_ERROR
473                                 THEN
474 					-- dbms_output.put_line('Raising exception in delete');
475                                         RAISE EGO_Globals.G_EXC_SEV_QUIT_RECORD;
476                                 ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
477                                 THEN
478                                         l_other_message := 'EGO_CATGRP_ENTVAL_UNEXP_SKIP';
479                                         l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
480                                         l_other_token_tbl(1).token_value :=
481                                                 EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Name;
482                                         RAISE EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT;
483                                 END IF;
484 
485            		END IF ;
486 
487 
488 			--
489            		-- Process Flow step 13 : Database Writes
490            		--
491 
492            		Error_Handler.Write_Debug('Writing to the database');
493            		-- dbms_output.put_line('Writing to the database');
494 
495            		Ego_Catalog_Group_Util.Perform_Writes
496                 	(  x_Mesg_Token_Tbl         => l_Mesg_Token_Tbl
497                 	 , x_return_status          => l_return_status
498                 	);
499 
500 			IF l_return_status = Error_Handler.G_STATUS_ERROR
501                         THEN
502                                 RAISE EGO_Globals.G_EXC_SEV_QUIT_RECORD;
503                         ELSIF l_return_status = Error_Handler.G_STATUS_UNEXPECTED
504                         THEN
505                                 l_other_message := 'EGO_CATGRP_ENTVAL_UNEXP_SKIP';
506                                 l_other_token_tbl(1).token_name := 'CATALOG_GROUP_NAME';
507                                 l_other_token_tbl(1).token_value :=
508                                       EGO_Globals.G_Catalog_Group_Rec.Catalog_Group_Name;
509                                 RAISE EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT;
510                         END IF;
511 
512 			-- return the record back to the table after processing
513 
514 			EGO_Globals.G_Catalog_Group_Tbl(l_Table_Index) := EGO_Globals.G_Catalog_Group_Rec;
515 
516 			x_return_status  := l_bo_return_status;
517 
518 			Error_Handler.Write_Debug('Process Completed');
519 
520 		    EXCEPTION
521 				WHEN EGO_Globals.G_EXC_SEV_QUIT_RECORD THEN
522 					Error_Handler.Write_Debug('Handling exception G_EXC_SEV_QUIT_RECORD');
523 					-- dbms_output.put_line('Handling exception G_EXC_SEV_QUIT_RECORD');
524 					EGO_Catalog_Group_Err_Handler.Log_Error
525                 			(  p_mesg_token_tbl     => l_mesg_token_tbl
526                 			,  p_error_status       => Error_Handler.G_STATUS_ERROR
527                 			,  p_error_scope        => Error_Handler.G_SCOPE_RECORD
528                 			,  p_error_level        => EGO_Globals.G_ITEM_CATALOG_GROUP_LEVEL
529                 			,  p_entity_index       => l_Table_Index
530                 			);
531 
532 					IF l_bo_return_status = 'S'
533 					THEN
534 						l_bo_return_status     := l_return_status;
535 					END IF;
536 
537 					x_return_status := l_bo_return_status;
538 
539 				WHEN EGO_Globals.G_EXC_SEV_QUIT_BRANCH THEN
540 					EGO_Catalog_Group_Err_Handler.Log_Error
541                                         (  p_mesg_token_tbl     => l_mesg_token_tbl
542                                         ,  p_error_status       => Error_Handler.G_STATUS_ERROR
543                                         ,  p_error_scope        => Error_Handler.G_SCOPE_CHILDREN
544                                         ,  p_error_level        => EGO_Globals.G_ITEM_CATALOG_GROUP_LEVEL
545                                         ,  p_entity_index       => l_Table_Index
546                                         );
547 
548 					IF l_bo_return_status = 'S'
549 					THEN
550 						l_bo_return_status     := l_return_status;
551 					END IF;
552 
553 					x_return_status := l_bo_return_status;
554 
555 				WHEN EGO_Globals.G_EXC_SEV_QUIT_SIBLINGS THEN
556 					EGO_Catalog_Group_Err_Handler.Log_Error
557                                         (  p_mesg_token_tbl     => l_mesg_token_tbl
558                                         ,  p_error_status       => Error_Handler.G_STATUS_ERROR
559                                         ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
560                                         ,  p_error_level        => EGO_Globals.G_ITEM_CATALOG_GROUP_LEVEL
561                                         ,  p_entity_index       => l_Table_Index
562                                         );
563 
564 					IF l_bo_return_status = 'S'
565 					THEN
566 						l_bo_return_status     := l_return_status;
567 					END IF;
568 
569 					x_return_status := l_bo_return_status;
570 
571 				WHEN EGO_Globals.G_EXC_FAT_QUIT_SIBLINGS THEN
572 					EGO_Catalog_Group_Err_Handler.Log_Error
573                                         (  p_mesg_token_tbl     => l_mesg_token_tbl
574                                         ,  p_error_status       => Error_Handler.G_STATUS_FATAL
575                                         ,  p_error_scope        => Error_Handler.G_SCOPE_SIBLINGS
576                                         ,  p_error_level        => EGO_Globals.G_ITEM_CATALOG_GROUP_LEVEL
577                                         ,  p_entity_index       => l_Table_Index
578                                         );
579 
580 					IF l_bo_return_status = 'S'
581 					THEN
582 						l_bo_return_status     := l_return_status;
583 					END IF;
584 
585 					x_return_status := l_bo_return_status;
586 
587 				WHEN EGO_Globals.G_EXC_FAT_QUIT_OBJECT THEN
588 					EGO_Catalog_Group_Err_Handler.Log_Error
589                                         (  p_mesg_token_tbl     => l_mesg_token_tbl
590                                         ,  p_error_status       => Error_Handler.G_STATUS_FATAL
591                                         ,  p_error_scope        => Error_Handler.G_SCOPE_ALL
592                                         ,  p_error_level        => EGO_Globals.G_ITEM_CATALOG_GROUP_LEVEL
593                                         ,  p_entity_index       => l_Table_Index
594                                         );
595 
596 					IF l_bo_return_status = 'S'
597 					THEN
598 						l_bo_return_status     := l_return_status;
599 					END IF;
600 
601 					x_return_status := l_bo_return_status;
602 
603 				WHEN EGO_Globals.G_EXC_UNEXP_SKIP_OBJECT THEN
604 					EGO_Catalog_Group_Err_Handler.Log_Error
605                                         (  p_mesg_token_tbl     => l_mesg_token_tbl
606                                         ,  p_error_status       => Error_Handler.G_STATUS_UNEXPECTED
607 					,  p_other_status	=> Error_Handler.G_STATUS_NOT_PICKED
608 					,  p_other_message      => l_other_message
609                 			,  p_other_token_tbl    => l_other_token_tbl
610                                         ,  p_error_scope        => Error_Handler.G_SCOPE_ALL
611                                         ,  p_error_level        => EGO_Globals.G_ITEM_CATALOG_GROUP_LEVEL
612                                         ,  p_entity_index       => l_Table_Index
613                                         );
614 
615 					IF l_bo_return_status = 'S'
616 					THEN
617 						l_bo_return_status     := l_return_status;
618 					END IF;
619 
620 					x_return_status := l_bo_return_status;
621 		END;
622 
623 		   /* End of the loop block */
624 
625 		IF l_return_status in ('Q', 'U')
626         	THEN
627                 	x_return_status := l_return_status;
628                 	RETURN;
629         	END IF;
630 	     END LOOP; /* End For Loop - processing of catalog group tbl */
631 
632 		/* End Processing all the catalog groups */
633 	     -- dbms_output.put_line('End of Private API');
634 	END;
635 
636 END EGO_ITEM_CATALOG_PVT;