DBA Data[Home] [Help]

PACKAGE BODY: APPS.EGO_CATALOG_GROUP_ERR_HANDLER

Source


1 PACKAGE BODY EGO_Catalog_Group_Err_Handler AS
2 /* $Header: EGOCGEHB.pls 115.1 2002/12/12 19:21:16 rfarook noship $ */
3 /*************************************************************************
4 --
5 --  Copyright (c) 1996 Oracle Corporation, Redwood Shores, CA, USA
6 --  All rights reserved.
7 --
8 --  FILENAME
9 --
10 --      EGOCGEHB.pls
11 --
12 --  DESCRIPTION
13 --
14 --      Body of package EGO_Catalog_Group_Err_Handler
15 --
16 --  NOTES
17 --
18 --  HISTORY
19 --
20 --  21-SEP-2002 Rahul Chitko        Initial Creation
21 --
22 *************************************************************************/
23 
24 
25         /******************************************************************
26         * Procedure     : Log_Error
27         * Parameters IN : Message Token Table
28         *                 Other Message Table
29         *                 Other Status
30         *                 Entity Index
31         *                 Error Level
32         *                 Error Scope
33         *                 Error Status
34         * Parameters OUT:
35         * Purpose       : Log Error will take the Message Token Table and
36         *                 seperate the message and their tokens, get the
37         *                 token substitute messages from the message dictionary
38         *                 and put in the error stack.
39         *                 Log Error will also make sure that the error
40         *                 propogates to the right level's of the business object
41         *                 and that the rest of the entities get the appropriate
42         *                 status and message.
43         ******************************************************************/
44 
45         PROCEDURE Log_Error
46 	(  p_Mesg_Token_tbl          IN  Error_Handler.Mesg_Token_Tbl_Type
47                                           := Error_Handler.G_MISS_MESG_TOKEN_TBL
48          , p_error_status            IN  VARCHAR2
49          , p_error_scope             IN  VARCHAR2 := NULL
50          , p_other_message           IN  VARCHAR2 := NULL
51          , p_other_mesg_appid        IN  VARCHAR2 := 'EGO'
52          , p_other_status            IN  VARCHAR2 := NULL
53          , p_other_token_tbl         IN  Error_Handler.Token_Tbl_Type
54                                           := Error_Handler.G_MISS_TOKEN_TBL
55          , p_error_level             IN  NUMBER
56          , p_entity_index            IN  NUMBER := 1 -- := NULL
57          )
58         IS
59                 l_message_name          VARCHAR2(30);
60                 l_other_message         VARCHAR2(2000);
61                 l_message_text          VARCHAR2(2000);
62                 l_LoopIndex             NUMBER;
63                 l_Error_Level           NUMBER      := p_Error_Level;
64                 l_error_scope           VARCHAR2(1) := p_error_scope;
65                 l_error_status          VARCHAR2(1) := p_error_status;
66                 l_application_id        VARCHAR2(3);
67         BEGIN
68 
69                 l_application_id :=  p_other_mesg_appid;
70 
71 
72                 /*************************************************
73                 --
74                 -- Seperate message and their tokens, get the
75                 -- token substituted messages and put it in the
76                 -- Error Table.
77                 --
78                 **************************************************/
79 
80 		Error_Handler.Write_Debug('Within the Log Error Procedure . . .');
81 		Error_Handler.Write_Debug('Scope: ' || l_error_scope);
82 		Error_Handler.Write_Debug('Entity Index: ' || to_char(p_entity_index));
83 		Error_Handler.Write_Debug('Error Level: ' || to_char(p_error_level));
84 		Error_Handler.Write_Debug('Error Status: ' || l_error_status);
85 		Error_Handler.Write_Debug('Other Status: ' || p_other_status);
86 		Error_Handler.Write_Debug('Other Message: ' || p_other_message);
87 
88                 Error_Handler.Translate_And_Insert_Messages
89                 (  p_mesg_token_Tbl     => p_mesg_token_tbl
90                  , p_error_level        => p_error_level
91                  , p_entity_index       => p_entity_index
92                 );
93 
94 		Error_Handler.Write_Debug('Finished logging messages . . . ');
95 
96                 /**********************************************************
97                 --
98                 -- Get the other message text and token and retrieve the
99                 -- token substituted message.
100                 --
101                 ***********************************************************/
102 
103                 IF p_other_token_tbl.COUNT <> 0
104                 THEN
105                         fnd_message.set_name
106                         (  application  => l_application_id
107                          , name         => p_other_message
108                          );
109 
110                         FOR l_LoopIndex IN 1 .. p_other_token_tbl.COUNT
111                         LOOP
112                                 IF p_other_token_tbl(l_LoopIndex).token_name IS
113                                    NOT NULL
114                                 THEN
115                                    fnd_message.set_token
116                                    ( token  =>
117                                       p_other_token_tbl(l_LoopIndex).token_name
118                                     , value =>
119                                       p_other_token_tbl(l_LoopIndex).token_value
120                                     , translate   =>
121                                       p_other_token_tbl(l_LoopIndex).translate
122                                     );
123                                 END IF;
124                         END LOOP;
125 
126                         l_other_message := fnd_message.get;
127 
128                 ELSE
129                         fnd_message.set_name
130                         (  application  => l_application_id
131                          , name         => p_other_message
132                          );
133 
134                         l_other_message := fnd_message.get;
135 
136                 END IF; -- Other Token Tbl Count <> 0 Ends
137 
138 		Error_Handler.Write_Debug('Finished extracting other message . . . ');
139 		Error_Handler.Write_Debug('Other Message generated: ' || l_other_message);
140 
141 
142                 /**********************************************************
143                 --
144                 -- If the Error Level is Business Object
145                 -- then set the Error Level = Catalog Group
146                 --
147                 ************************************************************/
148                 IF l_error_level = Error_Handler.G_BO_LEVEL
149                 THEN
150                         l_error_level := EGO_Globals.G_ITEM_CATALOG_GROUP_LEVEL;
151 
152 			Error_Handler.Write_Debug('Error Level is Business Object . . . ');
153 
154                 END IF;
155                 /**********************************************************
156                 --
157                 -- If the error_status is UNEXPECTED then set the error scope
158                 -- to ALL, if WARNING then set the scope to RECORD.
159                 --
160                 ************************************************************/
161                 IF l_error_status = Error_Handler.G_STATUS_UNEXPECTED
162                 THEN
163 			Error_Handler.Write_Debug('Status unexpected and scope is All . . .');
164                         l_error_scope := Error_Handler.G_SCOPE_ALL;
165                 ELSIF l_error_status = Error_Handler.G_STATUS_WARNING
166                 THEN
167                         l_error_scope := Error_Handler.G_SCOPE_RECORD;
168                         l_error_status := FND_API.G_RET_STS_SUCCESS;
169                         Error_Handler.Write_Debug('Status is warning . . .');
170 
171                 END IF;
172 
173                 --
174                 -- If the Error Level is Bill Header, then the scope can be
175                 -- ALL/CHILDREN OR RECORD.
176                 --
177                 /*************************************************************
178                 --
179                 -- If the Error Level is CATALOG_GROUP
180                 --
181                 *************************************************************/
182                 IF l_error_level = EGO_Globals.G_ITEM_CATALOG_GROUP_LEVEL
183                 THEN
184 
185                        Error_Handler.Write_Debug('Error Level is Catalog Group. . .');
186 
187                         --
188                         -- Set the Bill Header record status to p_error_status
189                         -- This will also take care of the scope RECORD.
190                         --
191 
192 			EGO_Globals.G_Catalog_Group_Rec.return_status := l_error_status;
193 
194                         IF l_error_scope = error_handler.G_SCOPE_ALL OR
195                            l_error_scope = error_handler.G_SCOPE_CHILDREN OR
196 			   l_error_scope = error_handler.G_SCOPE_SIBLINGS
197                         THEN
198                                 --
199                                 -- Since catalog group entity does not have children all error scopes will
200 				-- affect only the current record.
201 				--
202 				null;
203                         END IF;
204 		END IF;
205 
206 		Error_Handler.Write_To_DebugFile;
207 
208         END Log_Error;
209 
210 
211 END EGO_Catalog_Group_Err_Handler;