DBA Data[Home] [Help]

PACKAGE: APPS.ERROR_HANDLER

Source


1 PACKAGE Error_Handler AUTHID CURRENT_USER AS
2 /* $Header: BOMBOEHS.pls 120.4.12020000.2 2012/07/05 09:26:15 ntungare ship $ */
3 /*#
4  * You can use this API for  logging/retrieving Error or Warning messages.This API should be used along with
5  * the other business object APIs like the BOM Business Object API for retrieving of errors
6  * or warning logged during processing.This API also retrieves the translated error/warning messages
7  * for a business object. The sequence in which the user needs to use the Error Handler is described below.
8  *
9  * <li>1.Initialize the Error Handler through Initialize procedure.</li>
10  * <li>2.If the debug flag is set to Y then valid values should be given for Output Directory and Output File otherwise it turns off the
11  *   debug and logs the error to Error Handler.</li>
12  * <li>3.Open a Debug Session using the Open_Debug_Session procedure</li>
13  * <li>4.If the return status is Success then set the debug to Y otherwise set it to N</li>
14  * <li>5.If the debug status is Y then write to the error handler the entities as they are passed.</li>
15  * <li>6.After all the validation and processing of business entities,if the return status is not sucesss
16  *   then Log error to the Error handler and write the error to Interface Table or Concurrent Log or Debug File
17  *   based on the values of their respective flags.</li>
18  * The different record types used in this packages are given below.<BR>
19  *
20  *
21  * --------------------
22  *    Error Record
23  * --------------------
24  *
25  *<code><pre>
26  * TYPE Error_Rec_Type IS RECORD
27  *   (   organization_id               NUMBER
28  *   ,   entity_id                     VARCHAR2(30)
29  *   ,   table_name                    VARCHAR2(30)
30  *   ,   message_name		       VARCHAR2(30)
31  *   ,   message_text                  VARCHAR2(2000)
32  *   ,   entity_index                  NUMBER
33  *   ,   message_type                  VARCHAR2(1)
34  *   ,   row_identifier                NUMBER
35  *   ,   bo_identifier                 VARCHAR2(30) := 'ECO'
36  *   );
37  *</pre></code>
38  *
39  * ------------------
40  *   Parameters
41  * ------------------
42  *<pre>
43  * organization_id           -- Organization Id
44  * entity_id                 -- A constant which indicates the entity for which the error is logged
45  *                              The possible values are
46  *                              1.G_BO_LEVEL  - Business Object      - 0
47  *                              2.G_ECO_LEVEL - Eng Change Order     - 1
48  *                              3.G_REV_LEVEL - Revision Level       - 2
49  *                              4.G_RI_LEVEL  - Revised Item         - 3
50  *                              5.G_RC_LEVEL  - Revised Component    - 4
51  *                              6.G_RD_LEVEL  - Reference Designator - 5
52  *                              7.G_SC_LEVEL  - Substitute Component - 6
53  *                              8.G_BH_LEVEL  - Bill Header          - 7
54  * table_name                -- Production table name where the data goes in. This is useful when the same logical entity deals
55  *                              with multiple tables.A typical example would be extensible attributes for an
56  *                              entity. Logically, the entity is same but the data is going into two tables (ex: BOM_BILL_OF_MATERIALS and
57  *                              BOM_BILL_OF_MATERIALS_EXT)
58  * message_text              -- Free Text in case of Unexpected Errors
59  * entity_index              -- The order of the entity record within the entity table
60  * message_type              -- W -> Warning  E -> Error
61  * row_identifier            -- Any unique identifier value for the entity record.In case of bulk load from interface table this can
62  *                              be used to store the transaction_id
63  * bo_identifier             -- Business Object Identifier
64  *</pre>
65  *
66  * ---------------------------
67  *   Message Token Record
68  * ---------------------------
69  *<code><pre>
70  * TYPE Mesg_Token_Rec_Type IS RECORD
71  *   (  message_name VARCHAR2(30)   := NULL
72  *    , application_id VARCHAR2(3)  := NULL
73  *    , message_text VARCHAR2(2000) := NULL
74  *    , token_name   VARCHAR2(30)   := NULL
75  *    , token_value  VARCHAR2(700)   := NULL
76  *    , translate    BOOLEAN        := FALSE
77  *    , message_type VARCHAR2(1)    := NULL
78  *   )
79  *</pre></code>
80  *
81  * --------------------
82  *    Parameters
83  * --------------------
84  *
85  *<pre>
86  * message_name             -- FND Message Name
87  * application_id           -- Application Short Name under which message is defined
88  * message_text             -- Free Text in case off unexpected records
89  * token_name               -- Token name for messages need to be translated
90  * token_value              -- Token value for messages need to be translated
91  * translate                -- Flag to decide whether message needs to be translated
92  * message_type             -- E -> Error W -> Warning
93  *</pre>
94  *
95  * @rep:scope public
96  * @rep:product BOM
97  * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
98  * @rep:displayname Error Handler
99  * @rep:lifecycle active
100  * @rep:compatibility S
101  */
102     G_PKG_NAME      CONSTANT VARCHAR2(30)   := 'Error_Handler';
103     G_BO_LEVEL      CONSTANT NUMBER         := 0;
104     G_ECO_LEVEL     CONSTANT NUMBER         := 1;
105     G_REV_LEVEL     CONSTANT NUMBER         := 2;
106     G_RI_LEVEL      CONSTANT NUMBER         := 3;
107     G_RC_LEVEL      CONSTANT NUMBER         := 4;
108     G_RD_LEVEL      CONSTANT NUMBER         := 5;
109     G_SC_LEVEL      CONSTANT NUMBER         := 6;
110     G_BH_LEVEL      CONSTANT NUMBER         := 7;
111     G_CL_LEVEL      CONSTANT NUMBER         := 21;
112     G_ATCH_LEVEL    CONSTANT NUMBER         := 22;
113 
114     /* One to many operations support */
115     G_COP_LEVEL     CONSTANT NUMBER         := 13;
116     /*******************************************************
117     -- Followings are for Routing BO
118     ********************************************************/
119     G_RTG_LEVEL     CONSTANT NUMBER         := 8;
120     G_OP_LEVEL      CONSTANT NUMBER         := 9;
121     G_RES_LEVEL     CONSTANT NUMBER         := 10;
122     G_SR_LEVEL      CONSTANT NUMBER         := 11;
123     G_NWK_LEVEL     CONSTANT NUMBER         := 12;
124     -- Added by MK on 08/23/2000
125 
126     G_STATUS_WARNING    CONSTANT VARCHAR2(1)    := 'W';
127     G_STATUS_UNEXPECTED CONSTANT VARCHAR2(1)    := 'U';
128     G_STATUS_ERROR      CONSTANT VARCHAR2(1)    := 'E';
129     G_STATUS_FATAL      CONSTANT VARCHAR2(1)    := 'F';
130     G_STATUS_NOT_PICKED CONSTANT VARCHAR2(1)    := 'N';
131 
132     G_SCOPE_ALL         CONSTANT VARCHAR2(1)    := 'A';
133     G_SCOPE_RECORD      CONSTANT VARCHAR2(1)    := 'R';
134     G_SCOPE_SIBLINGS    CONSTANT VARCHAR2(1)    := 'S';
135     G_SCOPE_CHILDREN    CONSTANT VARCHAR2(1)    := 'C';
136     G_IS_BOM_OI                   BOOLEAN       := FALSE;
137     Debug_File      UTL_FILE.FILE_TYPE;
138 
139     --  Error record type
140     TYPE Error_Rec_Type IS RECORD
141     (   organization_id               NUMBER
142     ,   entity_id                     VARCHAR2(30)
143     ,   table_name                    VARCHAR2(30)
144     ,   message_name		      VARCHAR2(30)
145     ,   message_text                  VARCHAR2(2000)
146     ,   entity_index                  NUMBER
147     ,   message_type                  VARCHAR2(1)
148     ,   row_identifier                NUMBER
149     ,   bo_identifier                 VARCHAR2(30) := 'ECO'
150     );
151 
152    /* Fix for bug 4661753  - Added message_name to Error_Rec_Type record above */
153 
154     TYPE Error_Tbl_Type IS TABLE OF Error_Rec_Type
155             INDEX BY BINARY_INTEGER;
156 
157     TYPE Mesg_Token_Rec_Type IS RECORD
158     (  message_name VARCHAR2(30)   := NULL
159      , application_id VARCHAR2(3)  := NULL
160      , message_text VARCHAR2(2000) := NULL
161      , token_name   VARCHAR2(30)   := NULL
162      , token_value  VARCHAR2(700)   := NULL
163      , translate    BOOLEAN        := FALSE
164      , message_type VARCHAR2(1)    := NULL
165     );
166 
167     TYPE Mesg_Token_Tbl_Type IS TABLE OF Mesg_Token_Rec_Type
168             INDEX BY BINARY_INTEGER;
169 
170     /*******************************************************
171      -- Increased token_value length to VARCHAR2(100) from
172      -- VARCHAR2(30). This is because revised item and
173      -- revised component names can be as long as 81
174      -- characters.
175      -- By AS on 10/22/99
176     ********************************************************/
177     TYPE Token_Rec_Type IS RECORD
178     (  token_value VARCHAR2(700) := NULL
179     ,  token_name  VARCHAR2(30)  := NULL
180     ,  translate   BOOLEAN       := FALSE
181     );
182 
183     TYPE Token_Tbl_Type IS TABLE OF Token_Rec_Type INDEX BY BINARY_INTEGER;
184 
185     G_MISS_TOKEN_TBL             Token_Tbl_Type;
186     G_MISS_MESG_TOKEN_TBL        Mesg_Token_Tbl_Type;
187 G_UTL_FILE_DIR VARCHAR2(2000);
188 G_HAS_UTL_FILE_DIR VARCHAR2(1) := 'N';
189 
190      /*#
191       * You can use this method to initialize the global message list and reset the index variables to 0.
192       * User must initialize the message list before using it.
193       * @rep:scope public
194       * @rep:lifecycle active
195       * @rep:compatibility S
196       * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
197       * @rep:displayname Initialize
198       */
199     PROCEDURE Initialize;
200 
201 	 /*#
202 	 * You can use this method to reset the message index to the start of the list,as well as begin reading the
203          * messages again from the start.
204          * @rep:scope public
205          * @rep:lifecycle active
206          * @rep:compatibility S
207          * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
208          * @rep:displayname Reset
209          */
210     PROCEDURE Reset;
211 
212   /* Get procedures to access the errors in the PL/SQL stack*/
213    /*#
214     * You can use this method to retrieve individual messages from the message list.The method returns a
215     * copy of the message list. The procedure will return a
216     * the message list for the entire Business Object with the error status of the Business Object as well as
217     * the error status of the Business Object for each record in the table.
218     * @param x_message_list IN OUT NOCOPY  processed Message List
219     * @rep:scope public
220     * @rep:lifecycle active
221     * @rep:compatibility S
222     * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
223     * @rep:displayname Get Message List
224     */
225     PROCEDURE Get_Message_List
226     ( x_message_list    IN OUT NOCOPY Error_Handler.Error_Tbl_Type);
227 
228    /*#
229     * You can use this method to return all the messages for a specific Entity and retrieve the error
230     * or warning messages,the error type,scope of the error and Other Messages which will give the
231     * error status of other records due to the error in the current record.The user can get the message for
232     * Bill Header,Component,Reference Desigantor or Substitute Components based on the value of entity_id
233     * @param p_entity_id IN Entity for which the message to be returned
234     * @param x_message_list IN OUT NOCOPY Error Message List for the Entity
235     * @rep:scope public
236     * @rep:lifecycle active
237     * @rep:compatibility S
238     * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
239     * @rep:displayname Get Entity Message
240     */
241     PROCEDURE Get_Entity_Message
242     (  p_entity_id      IN  VARCHAR2
243      , x_message_list   IN OUT NOCOPY Error_Handler.Error_Tbl_Type
244     );
245 
246 	/*#
247      * This method will return the messages for an entity and the mesages can be specified through the
248      * entity index which gives the location of the messsage in the entity array. This will give the error or warning
249      * text,the error type,Other Message and the scope of the error.The user can get the messsages at any specific index
250      * as specified for Bill Header,Component,Reference Designator or Substitute Component.
251      * @param p_entity_id IN  Entity for which the message to be returned
252      * @param p_entity_index IN Index of the Message to be returned
253      * @param x_message_list IN OUT NOCOPY Error Message List for the Entity at the index
254      * @rep:scope public
255      * @rep:lifecycle active
256      * @rep:compatibility S
257      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
258      * @rep:displayname Get Message List
259      */
263      , x_message_list   IN OUT NOCOPY Error_Handler.Error_Tbl_Type
260     PROCEDURE Get_Entity_Message
261     (  p_entity_id      IN  VARCHAR2
262      , p_entity_index   IN  NUMBER
264      );
265 
266 	 /*#
267      * This method will return all the  messages for an entity and its row identifier.
268      * Row Identifier is any unique identifier value for the entity record.
269      * In case of bulk load from interface table this can
270      * be used to store the transaction_id.
271      * @param p_entity_id IN Entity for which the message to be returned
272      * @param p_row_identifier IN Row Identifier for the entity
273      * @param x_message_list IN OUT NOCOPY Error Message List for the Entity identified by the Row Id
274      * @rep:scope public
275      * @rep:lifecycle active
276      * @rep:compatibility S
277      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
278      * @rep:displayname Get Entity Message
279      */
280     PROCEDURE Get_Entity_Message
281     (  p_entity_id      IN  VARCHAR2
282      , p_row_identifier IN  NUMBER
283      , x_message_list   IN OUT NOCOPY Error_Handler.Error_Tbl_Type
284      );
285 
286 	/*#
287      * This method will return all the  messages for  an entity and its row identifier.
288      * Row Identifier is any unique identifier value for the entity record.
289      * In case of bulk load from interface table this can
290      * be used to store the transaction_id.
291      * @param p_entity_id IN  Entity for which the message to be returned
292      * @param p_row_identifier IN Row Identifier for the entity
293      * @param p_table_name IN Table Name
294      * @param x_message_list IN OUT NOCOPY Error Message List for the Entity identified by the Row Id
295      * @rep:scope public
296      * @rep:lifecycle active
297      * @rep:compatibility S
298      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
299      * @rep:displayname Get Entity Message
300      */
301     PROCEDURE Get_Entity_Message
302     (  p_entity_id      IN  VARCHAR2
303      , p_table_name     IN  VARCHAR2
304      , p_row_identifier IN  NUMBER
305      , x_message_list   IN OUT NOCOPY Error_Handler.Error_Tbl_Type
306      );
307 
308 
309   /*#
310     * You can use this method to  return the message at the current message index and  advance the pointer to the
311     * next number. On retrieving the messages beyond the size of the message list,the message index
312     * will be reset to the start position irrespective of the message type(like Warning,Error).
313     * @param x_message_text IN OUT NOCOPY processed Message Text
314     * @param x_entity_index IN OUT NOCOPY Entity Index of the message retrieved
315     * @param x_entity_id IN OUT NOCOPY Entity for which the Message was retrieved
316     * @param x_message_type IN OUT NOCOPY Type of the Message W-Warning/Debug,E-Standard Error/Severe Error,F-Fatal Error,U-Unexpected Error
317     * @rep:scope public
318     * @rep:lifecycle active
319     * @rep:compatibility S
320     * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
321     * @rep:displayname Get Message
322     */
323     PROCEDURE Get_Message
324     (  x_message_text   IN OUT NOCOPY VARCHAR2
325      , x_entity_index   IN OUT NOCOPY NUMBER
326      , x_entity_id      IN OUT NOCOPY VARCHAR2
327      , x_message_type   IN OUT NOCOPY VARCHAR2
328      );
329 
330 	 /*#
331      * This function returns the current number of records in the message list.The user can
332      * use this function to get the current size of the message list.
333      * @return Number of messages in the List
334      * @rep:scope public
335      * @rep:lifecycle active
336      * @rep:compatibility S
337      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
338      * @rep:displayname Get Message Count
339      */
340 
341     FUNCTION Get_Message_Count RETURN NUMBER;
342 
343 	   /*#
344      * This method will delete a message for the particular entity specified.The entity index
345      * gives the location of entity array list and the entity id will provide the specific entity object.
346      * @param p_entity_id IN Entity of which the message is to be deleted
347      * @param p_entity_index IN Index of the message to be deleted
348      * @rep:scope public
349      * @rep:lifecycle active
350      * @rep:compatibility S
351      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
352      * @rep:displayname Delete Message
353      */
354 
355     PROCEDURE Delete_Message
356     (  p_entity_id          IN  VARCHAR2
357       , p_entity_index       IN  NUMBER
358     );
359 
360     /*#
361      * This method will delete  all the messages for the particular entity.The
362      * entity is specified by the entity id.
363      * @param p_entity_id IN Entity of which the message is to be deleted
364      * @rep:scope public
365      * @rep:lifecycle active
366      * @rep:compatibility S
367      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
368      * @rep:displayname Delete Message
369      */
370 
371     PROCEDURE Delete_Message
372     (  p_entity_id          IN  VARCHAR2 );
373 
374     /*#
375      * This method will generate a dump of the message list using dbms_output.This in
376      * turn calls the Write_Debug method to write the Message for an entity
377      * @rep:scope public
378      * @rep:displayname Dump Message List
379      * @rep:compatibility S
380      * @rep:lifecycle active
381      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
382      */
383 
384     PROCEDURE Dump_Message_List;
385 
386      /*#
387       * This method will open a debug session with the debug file name in the supplied output directory as destination.
388       * It will also check the validity of the output directory and the debug file name given as input.
392       * @param x_error_mesg IN OUT NOCOPY Error Message
389       * @param p_debug_filename IN Name of the file to write the debug message
390       * @param p_output_dir IN Output Directory
391       * @param x_return_status IN OUT NOCOPY Return Status of the Business Object
393       * @rep:displayname Open Debug Session
394       * @rep:compatibility S
395       * @rep:lifecycle active
396       * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
397       */
398     PROCEDURE Open_Debug_Session
399         (  p_debug_filename     IN  VARCHAR2
400          , p_output_dir         IN  VARCHAR2
401          , x_return_status      IN OUT NOCOPY VARCHAR2
402          , x_error_mesg         IN OUT NOCOPY VARCHAR2
403          );
404 
405      /*#
406       * This method will open a debug session with the debug file name in the supplied output directory as destination.
407       * It will also check the validity of the output directory and the debug file name given as input
408       * @param p_debug_filename IN Name of the file to write the debug message
409       * @param p_output_dir IN Output Directory
410       * @param x_return_status IN OUT NOCOPY Return Status of the Business Object
411       * @param p_mesg_token_tbl IN Message Token Table as input
412       * @param x_mesg_token_tbl IN OUT NOCOPY processed Message Token Table
413       * @rep:scope public
414       * @rep:displayname Open Debug Session
415       * @rep:compatibility S
416       * @rep:lifecycle active
417       * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
418       */
419 
420     PROCEDURE Open_Debug_Session
421     (  p_debug_filename IN  VARCHAR2
422      , p_output_dir     IN  VARCHAR2
423      , x_return_status  IN OUT NOCOPY VARCHAR2
424      , p_mesg_token_tbl IN  Error_Handler.Mesg_Token_Tbl_Type
425      , x_mesg_token_tbl IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
426      );
427 
428      /*#
429       * This method will close the debug session currently in the open state
430       * @rep:scope public
431       * @rep:displayname Close Debug Session
432       * @rep:compatibility S
433       * @rep:lifecycle active
434       * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
435       */
436     PROCEDURE Close_Debug_Session;
437     /*#
438      * This method is used by the error handler to put appropriate debug comments
439      * @param p_debug_message IN Debug Message to be added
440      * @rep:scope public
441      * @rep:displayname Write Debug
442      * @rep:compatibility S
443      * @rep:lifecycle active
444      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
445      */
446 
447     PROCEDURE Write_Debug
448     (  p_debug_message  IN  VARCHAR2
449      );
450 
451 	/*#
452      * This method will write the errors to the Interface Table
453      * This  will be effective only if the write to concurrent_log flag is properly set.
454      * @rep:scope public
455      * @rep:displayname Write to Interface Table
456      * @rep:compatibility S
457      * @rep:lifecycle active
458      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
459      */
460     PROCEDURE Write_To_InterfaceTable;
461 
462 
463     /*#
464      * This method will write the errors to the Concurrent Log.This
465      * will be effective only if the write to concurrent_log flag is properly set.
466      * @rep:scope public
467      * @rep:displayname Write to Concurrent Log
468      * @rep:compatibility S
469      * @rep:lifecycle active
470      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
471      */
472     PROCEDURE Write_To_ConcurrentLog;
473 
474 
475      /*#
476      * This method will write the errors to the Debug File.This
477      * will be effective only if the write to dbug_file flag is properly set.
478      * @rep:scope public
479      * @rep:displayname Write to Debug File
480      * @rep:compatibility S
481      * @rep:lifecycle active
482      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
483      */
484     PROCEDURE Write_To_DebugFile;
485 
486 
487     /*#
488      * This method will write the errors to Interface table or Concurrent Log or Debug File based on the Flag for each of these.
489      * This will take the messages already written to the Error Handler and then will log that based on the value of the
490      * flags passed.This method is useful when the user wants to Log all the errors irrespective of any particular entity.
491      * @param p_write_err_to_inttable IN Flag to write error to Interface Table
492      * @param p_write_err_to_conclog IN Flag to write error to Concurrent Log
493      * @param p_write_err_to_debugfile IN Flag to write error to Debug File
494      * @rep:scope public
495      * @rep:displayname Log Error
496      * @rep:compatibility S
497      * @rep:lifecycle active
498      * @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
499      */
500     PROCEDURE Log_Error(p_write_err_to_inttable   IN  VARCHAR2 := 'N'
501          		,p_write_err_to_conclog   IN  VARCHAR2 := 'N'
502          		,p_write_err_to_debugfile IN  VARCHAR2 := 'N');
503 
504 	      /*#
505 	* This method takes the Message Token Table and seperates the message and their tokens, gets the
506         * token substitute messages from the message dictionary and puts in the error stack.
507         * Log Error will also make sure that the error propogates to the right levels of the business object
508         * and that the rest of the entities get the appropriate status and message.This will log the error based on the
509         * error level whether its Bill Header,Revision,Revised Components,Reference Designator,Substitute Components etc.
510 	* @param p_bom_header_rec IN BOM Header Exposed Column Record
511 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Head_Rec_Type}
512 	* @param p_bom_revision_tbl IN Revision Exposed Column Table
516 	* @param p_bom_ref_Designator_tbl IN Reference Designator Exposed Column Table
513 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Revision_Tbl_Type}
514 	* @param p_bom_component_tbl IN Components Exposed Column Table
515 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Comps_Tbl_Type}
517 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type}
518 	* @param p_bom_sub_component_tbl IN Substitute Components Exposed Column Table
519 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type}
520 	* @param p_Mesg_Token_tbl IN Message Token Table
521 	* @rep:paraminfo {@rep:innertype Error_Handler.Mesg_Token_Tbl_Type}
522 	* @param p_error_status IN S-Success,E-Error,F-Fatal Error,U-Enexpected Error
523 	* @param p_error_scope 	IN R-error affects Current Record,S-error affects Sibling and Child Records,C-error affects
524 	* 			Child Records,A-error affects All reords in the Business Object
525 	* @param p_other_message IN An Other Message is a message that is logged for all records that are affected by an
526 	* 			 error in a particular record.This message essentially mentions:
527 	*			 1. How the error has affected this record, that is, it has been errored out to
528 	*    			 with a severe or fatal error status, or that it has not been processed.
529 	* 			 2. Which record caused this record to be affected.
530 	* 			 3. What process flow step in the offending record caused this record to be affected.
531 	* 			 4. What transaction type in the offending record caused this record to be affected
532 	* @param p_other_mesg_appid IN Other Message Application Id
533 	* @param p_other_status IN Status the other affected records should be set to.
534 	* @param p_other_token_tbl IN Other Message Token table
535 	* @param p_error_level IN Business Object hierarchy level that current record is an instance of.
536 	* 		       That is, the entity that the record in error belongs to
537 	* @param p_entity_index IN The index of the entity array this record belongs to.
538 	* @param p_row_identifier IN Any unique identifier value for the entity record.
539         * 			  In case of bulk load from interface table this can
540         * 			  be used to store the transaction_id
541 	* @param x_bom_header_rec IN OUT NOCOPY processed BOM Header Exposed Column Record
542 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Bo_Pub.Bom_Head_Rec_Type}
543 	* @param x_bom_revision_tbl IN OUT NOCOPY processed Revision Exposed Column Table
544 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Revision_Tbl_Type}
545 	* @param x_bom_component_tbl IN OUT NOCOPY processed Components Exposed Column Table
546 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Comps_Tbl_Type}
547 	* @param x_bom_ref_Designator_tbl IN OUT NOCOPY processed Reference Designator Exposed Column Table
548 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type}
549 	* @param x_bom_sub_component_tbl IN OUT NOCOPY processed Substitute Components Exposed Column Table
550 	* @rep:paraminfo {@rep:innertype Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type}
551 	* @rep:scope public
552 	* @rep:lifecycle active
553 	* @rep:compatibility S
554 	* @rep:category BUSINESS_ENTITY BOM_BILL_OF_MATERIAL
555 	* @rep:displayname Log Error Message
556 	 */
557 
558 
559         PROCEDURE Log_Error
560     (  p_bom_header_rec          IN  Bom_Bo_Pub.Bom_Head_Rec_Type :=
561                                          Bom_Bo_Pub.G_MISS_BOM_HEADER_REC
562      , p_bom_revision_tbl        IN  Bom_Bo_Pub.Bom_Revision_Tbl_Type :=
563                                          Bom_Bo_Pub.G_MISS_BOM_REVISION_TBL
564      , p_bom_component_tbl       IN  Bom_Bo_Pub.Bom_Comps_Tbl_Type :=
565                                          Bom_Bo_Pub.G_MISS_BOM_COMPONENT_TBL
566      , p_bom_ref_Designator_tbl  IN  Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
567                                      :=  Bom_Bo_Pub.G_MISS_BOM_REF_DESIGNATOR_TBL
568      , p_bom_sub_component_tbl   IN  Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
569                                      :=  Bom_Bo_Pub.G_MISS_BOM_SUB_COMPONENT_TBL
570 
571      , p_Mesg_Token_tbl          IN  Error_Handler.Mesg_Token_Tbl_Type
572                                      := Error_Handler.G_MISS_MESG_TOKEN_TBL
573      , p_error_status            IN  VARCHAR2
574      , p_error_scope             IN  VARCHAR2 := NULL
575      , p_other_message           IN  VARCHAR2 := NULL
576      , p_other_mesg_appid        IN  VARCHAR2 := 'BOM'
577      , p_other_status            IN  VARCHAR2 := NULL
578      , p_other_token_tbl         IN  Error_Handler.Token_Tbl_Type
579                                      := Error_Handler.G_MISS_TOKEN_TBL
580      , p_error_level             IN  NUMBER
581      , p_entity_index            IN  NUMBER := 1  -- := NULL
582      , x_bom_header_rec          IN OUT NOCOPY Bom_Bo_Pub.Bom_Head_Rec_Type
583      , x_bom_revision_tbl        IN OUT NOCOPY Bom_Bo_Pub.Bom_Revision_Tbl_Type
584      , x_bom_component_tbl       IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Tbl_Type
585      , x_bom_ref_Designator_tbl  IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
586      , x_bom_sub_component_tbl   IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
587      , p_row_identifier           IN NUMBER := NULL
588     );
589 
590 
591 
592 
593 
594         /****************************************************************
595         * Procedure     : Add_Message
596         *
597         * Paramaters IN : Message Text
598         *                 For explanation on entity id, entity index,
599         *                 message type,row identifier, table name,
600         *                 entity code parameters please refer to
601         *                 Add_Error_Message API
602         *
603         * Parameters OUT: None
604         * Purpose       : Add_Message will push a message on the message
605         *                 stack and will convert the numeric entity id to
606         *                 character which will be easier for the user to
607         *                 understand. eg. Entity Id = 1 which will be ECO
608         *****************************************************************/
609 
613          , p_entity_index       IN  NUMBER
610     PROCEDURE Add_Message
611         (  p_mesg_text          IN  VARCHAR2
612          , p_entity_id          IN  NUMBER
614          , p_message_type       IN  VARCHAR2
615          , p_row_identifier     IN  NUMBER := NULL
616          , p_table_name         IN  VARCHAR2 := NULL
617          , p_entity_code        IN  VARCHAR2 := NULL
618          , p_mesg_name		IN  VARCHAR2 := NULL
619     );
620 
621    /* Fix for bug 4661753 - Added a new parameter p_mesg_name to both the Add_message procedure declarations above and below.*/
622 
623   -- Bug 3458584  added new method
624 
625 
626     PROCEDURE Add_Message
627         (  p_mesg_text          IN  VARCHAR2
628          , p_entity_id          IN  NUMBER
629          , p_entity_index       IN  NUMBER
630          , p_message_type       IN  VARCHAR2
631          , p_row_identifier     IN  NUMBER := NULL
632          , p_table_name         IN  VARCHAR2 := NULL
633          , p_entity_code        IN  VARCHAR2 := NULL
634          , p_mesg_name		IN  VARCHAR2 := NULL
635          , p_bom_header_rec          IN OUT NOCOPY Bom_Bo_Pub.Bom_Head_Rec_Type
636          , p_bom_revision_tbl        IN OUT NOCOPY Bom_Bo_Pub.Bom_Revision_Tbl_Type
637          , p_bom_component_tbl       IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Tbl_Type
638          , p_bom_ref_Designator_tbl  IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
639          , p_bom_sub_component_tbl   IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
640          , p_bom_comp_ops_tbl   IN OUT NOCOPY Bom_Bo_Pub.Bom_Comp_ops_Tbl_Type
641     );
642 
643 
644 
645         /*********************************************************************
646         * Procedure     : Translate_And_Insert_Messages
647         * Returns       : None
648         * Parameters IN : Message Token Table
649         *                 Error Level
650         *                       The entity level at which the error has
651         *                       occured.This is same as entity id in the
652         *                       other procedures (Add_Message, Add_Error_Message)
653         *                 For explanation on entity id, entity index,
654         *                 message type,row identifier, table name,
655         *                 entity code parameters please refer to
656         *                 Add_Error_Message API
657         * Parameters OUT: Non
658         * Purpose       : This procedure will read through the message token
659         *                 table and insert them into the message table with
660         *                 the proper business object context.
661         **********************************************************************/
662 
663     PROCEDURE Translate_And_Insert_Messages
664     (  p_mesg_token_tbl IN Error_Handler.Mesg_Token_Tbl_Type
665      , p_error_level    IN NUMBER := NULL
666      , p_entity_index   IN NUMBER := NULL
667      , p_application_id IN VARCHAR2 := 'ENG'
668      , p_row_identifier IN NUMBER := NULL
669      , p_table_name     IN VARCHAR2 := NULL
670      , p_entity_code    IN VARCHAR2 := NULL
671     );
672 
673  -- Bug 3458584  added new method
674 
675     PROCEDURE Translate_And_Insert_Messages
676     (  p_mesg_token_tbl IN Error_Handler.Mesg_Token_Tbl_Type
677      , p_error_level    IN NUMBER := NULL
678      , p_entity_index   IN NUMBER := NULL
679      , p_application_id IN VARCHAR2 := 'ENG'
680      , p_row_identifier IN NUMBER := NULL
681      , p_table_name     IN VARCHAR2 := NULL
682      , p_entity_code    IN VARCHAR2 := NULL
683      , p_bom_header_rec          IN OUT NOCOPY Bom_Bo_Pub.Bom_Head_Rec_Type
684      , p_bom_revision_tbl        IN OUT NOCOPY Bom_Bo_Pub.Bom_Revision_Tbl_Type
685      , p_bom_component_tbl       IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Tbl_Type
686      , p_bom_ref_Designator_tbl  IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
687      , p_bom_sub_component_tbl   IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
688      , p_bom_comp_ops_tbl        IN OUT NOCOPY Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type
689     );
690 
691 
692 
693         /*********************************************************************
694         * Function      : Translate_Message
695         * Returns       : VARCHAR2 (Translated Message)
696         * Parameters IN : Application id
697         *                 Message Name
698         *                 Token Table
699         * Parameters OUT: Translated Message
700         **********************************************************************/
701 
702     FUNCTION Translate_Message (p_application_id  IN VARCHAR2
703                                ,p_message_name    IN VARCHAR2
704                                ,p_token_tbl       IN Error_Handler.Token_Tbl_Type :=
705 							Error_Handler.G_MISS_TOKEN_TBL)
706     RETURN VARCHAR2;
707 
708         /**********************************************************************
709         * Procedure     : Add_Error_Token
710         * Parameters IN : Message Text (in case of unexpected errors)
711         *                 Message Name
712         *                 Mesg Token Tbl
713         *                 Token Table
714         * Parameters OUT: Mesg Token Table
715         * Purpose       : This procedure will add the message to the
716         *                 message token table.
717         **********************************************************************/
718 
719     PROCEDURE Add_Error_Token
720         (  p_message_name      IN  VARCHAR2 := NULL
721          , p_application_id    IN  VARCHAR2 := 'ENG'
722          , p_message_text      IN  VARCHAR2 := NULL
723          , x_Mesg_Token_tbl    IN OUT NOCOPY Error_Handler.Mesg_Token_Tbl_Type
724          , p_Mesg_Token_Tbl    IN  Error_Handler.Mesg_Token_Tbl_Type :=
725                    Error_Handler.G_MISS_MESG_TOKEN_TBL
726          , p_token_tbl         IN  Error_Handler.Token_Tbl_Type :=
727                    Error_Handler.G_MISS_TOKEN_TBL
728          , p_message_type      IN  VARCHAR2 := 'E'
729     );
730 
731         /**********************************************************************
732         * Procedure     : Add_Error_Message
733         * Parameters IN : Message Text (in case of unexpected errors)
734         *                       Free text
735         *                 Message Name
736         *                       FND message name
737         *                 Application Id
738         *                       Applicaion short name under which the
739         *                       message is defined
740         *                 Token Table
741         *                       Token Table of type TOKEN_TBL_TYPE
742         *                 Message Type
743         *                       W -> Warning
744         *                       E -> Error
745         *                 Entity Id
746         *                       Entity identifier which is defined as a
747         *                       constant in the error handler
748         *                 Entity Index
749         *                       The order of the entity record within
750         *                       the entity table
751         *                 Entity Code
752         *                       Replacement for entity id. This can be
753         *                       used when there is no constant defined
754         *                       in the error handler for the entity.
755         *                       When both are passed entity code will be
756         *                       used as entity identifier.
757         *                 Row Identifier
758         *                       Any unique identifier value for the entity record.
759         *                       In case of bulk load from interface table this can
760         *                       be used to store the transaction_id
761         *                 Table Name
762         *                       Production table name where the data goes in.
763         *                       This is useful when the same logical entity deals
764         *                       with multiple tables.
765         *                       A typical example would be extensible attributes for an
766         *                       entity. Logically, the entity is same but the data is
767         *                       going into two tables (ex: BOM_BILL_OF_MATERIALS and
768         *                       BOM_BILL_OF_MATERIALS_EXT)
769         *
770         * Parameters OUT: None
771         * Purpose       : This procedure will translate and add the message directly into
772         *                 the error stack with all the context information.
773         **********************************************************************/
774 
775     PROCEDURE Add_Error_Message
776         (  p_message_name      IN  VARCHAR2 := NULL
777          , p_application_id    IN  VARCHAR2 := 'BOM'
778          , p_message_text      IN  VARCHAR2 := NULL
779          , p_token_tbl         IN  Error_Handler.Token_Tbl_Type :=
780                    Error_Handler.G_MISS_TOKEN_TBL
781          , p_message_type      IN  VARCHAR2 := 'E'
782 	 , p_row_identifier    IN  NUMBER := NULL
783 	 , p_entity_id         IN  NUMBER := NULL
784  	 , p_entity_index      IN  NUMBER := NULL
785 	 , p_table_name        IN  VARCHAR2 := NULL
786 	 , p_entity_code       IN  VARCHAR2 := NULL
787 	 , p_addto_fnd_stack   IN  VARCHAR2 := 'N'
788     );
789 
790  -- Bug 3458584  added new method
791 
792 
793  PROCEDURE Add_Error_Message
794         (  p_message_name      IN  VARCHAR2 := NULL
795          , p_application_id    IN  VARCHAR2 := 'BOM'
796          , p_message_text      IN  VARCHAR2 := NULL
797          , p_token_tbl         IN  Error_Handler.Token_Tbl_Type :=
798                    Error_Handler.G_MISS_TOKEN_TBL
799          , p_message_type      IN  VARCHAR2 := 'E'
800          , p_row_identifier    IN  NUMBER := NULL
801          , p_entity_id         IN  NUMBER := NULL
802          , p_entity_index      IN  NUMBER := NULL
803          , p_table_name        IN  VARCHAR2 := NULL
804          , p_entity_code       IN  VARCHAR2 := NULL
805          , p_addto_fnd_stack   IN  VARCHAR2 := 'N'
806          , p_bom_header_rec          IN OUT NOCOPY Bom_Bo_Pub.Bom_Head_Rec_Type
807          , p_bom_revision_tbl        IN OUT NOCOPY Bom_Bo_Pub.Bom_Revision_Tbl_Type
808          , p_bom_component_tbl       IN OUT NOCOPY Bom_Bo_Pub.Bom_Comps_Tbl_Type
809          , p_bom_ref_Designator_tbl  IN OUT NOCOPY Bom_Bo_Pub.Bom_Ref_Designator_Tbl_Type
810          , p_bom_sub_component_tbl   IN OUT NOCOPY Bom_Bo_Pub.Bom_Sub_Component_Tbl_Type
811          , p_bom_comp_ops_tbl         IN OUT NOCOPY Bom_Bo_Pub.Bom_Comp_Ops_Tbl_Type
812        );
813 
814 
815 
816 
817 
818 
819     PROCEDURE Get_Entity_Message
820     (  p_entity_id      IN  VARCHAR2
821      , p_entity_index   IN  NUMBER
822      , x_message_text   IN OUT NOCOPY /* file.sql.39 change */ VARCHAR2
823      );
824 
825     PROCEDURE Set_Bo_Identifier(p_bo_identifier	IN VARCHAR2);
826     FUNCTION  Get_Bo_Identifier RETURN VARCHAR2;
827 
828     /* One to many operations support */
829 
830     PROCEDURE Set_Bom_Specific( p_bom_comp_ops_tbl IN  Bom_Bo_Pub.Bom_Comp_Ops_Tbl_type);
831 
832     PROCEDURE Get_Bom_Specific( x_bom_comp_ops_tbl IN OUT NOCOPY Bom_Bo_Pub.Bom_Comp_Ops_Tbl_type);
833 
834 
835     PROCEDURE Set_Debug (p_debug_flag IN VARCHAR2 := 'N');
836 
837    FUNCTION Get_Debug RETURN VARCHAR2;
838 
839    PROCEDURE Set_BOM_OI;
840    PROCEDURE UnSet_BOM_OI;
841 
842 END Error_Handler;