DBA Data[Home] [Help]

PACKAGE BODY: APPS.MSD_CONC_LOG_UTIL

Source


1 package body MSD_CONC_LOG_UTIL as
2 /* $Header: msdclutb.pls 115.4 2002/11/06 22:59:44 pinamati ship $ */
3 --
4      --
5     -- variables
6     --
7     g_last_msg_type varchar2(30);
8     g_ret_code      number;
9     g_result        varchar2(30);
10     g_output_to     varchar2(30);
11     --
12     -- Local Procedure and Packages
13     --
14     Procedure calc_result ( p_msg_type in varchar2);
15     --
16 
17 Procedure calc_result ( p_msg_type in varchar2) is
18 Begin
19     --
20     if p_msg_type = C_FATAL_ERROR then
21         g_ret_code := 4;
22         g_result := C_FATAL_ERROR;
23     elsif p_msg_type = C_ERROR then
24         g_ret_code := 2;
25         g_result   := p_msg_type;
26     elsif p_msg_type = C_WARNING then
27             g_ret_code := 1;
28             g_result := p_msg_type;
29     end if;
30 End;
31 --
32 Procedure show_message(p_text in varchar2) is
33 Begin
34     --
35     -- Output to FNDFILE or SERVER depending on the user settings
36     --
37 --    if g_output_to = C_OUTPUT_TO_FNDFILE then
38         fnd_file.put_line(fnd_file.log, p_text);
39 --    else
40 --        dbms_output.put_line(p_text);
41 --    end if;
42 end;
43 --
44 Procedure Initilize is
45 Begin
46     --
47     g_last_msg_type := null;
48     g_ret_code      := null;
49     g_result        := C_SUCCESS;
50     g_output_to     := C_OUTPUT_TO_FNDFILE;
51     --
52 End;
53 --
54 Procedure Initilize(p_output_to in varchar2) is
55 Begin
56     --
57     Initilize;
58     --
59     if p_output_to in (C_OUTPUT_TO_FNDFILE, C_OUTPUT_TO_SERVER) then
60         g_output_to := p_output_to;
61     end if;
62 End;
63 Procedure display_message(p_text varchar2, msg_type varchar2) is
64     l_tab           varchar2(4):='    ';
65     L_MAX_LENGTH    number:=90;
66 Begin
67     if msg_type = C_SECTION then
68         if nvl(g_last_msg_type, 'xx') <> C_SECTION then
69             show_message('');
70         end if;
71         --
72         show_message( substr(p_text, 1, L_MAX_LENGTH) );
73         --
74     elsif msg_type in (C_INFORMATION, C_HEADING) then
75         show_message( l_tab || substr(p_text, 1, L_MAX_LENGTH));
76     else
77         show_message( l_tab || rpad(p_text, L_MAX_LENGTH) || ' ' || msg_type );
78     end if;
79     --
80     if msg_type in (C_ERROR, C_WARNING, C_FATAL_ERROR) then
81         calc_result (msg_type);
82     end if;
83     --
84     if msg_type = C_FATAL_ERROR then
85         show_message(' ');
86         show_message( l_tab || 'Exiting Demand Plan validation process with FATAL ERROR');
87         raise   EX_FATAL_ERROR;
88     end if;
89     --
90     g_last_msg_type := msg_type;
91 End;
92 --
93 Function Result return varchar2 is
94 Begin
95     return g_result;
96 End;
97 --
98 Function retcode return number is
99 Begin
100     return g_ret_code;
101 End;
102 
103 End;