[Home] [Help]
PACKAGE BODY: APPS.CSF_AUTO_COMMIT_PVT
Source
1 package body csf_auto_commit_pvt as
2 /* $Header: CSFVCMTB.pls 120.0 2005/05/24 17:47:23 appldev noship $ */
3
4 --================================================--
5 -- private constants, types, variables and cursors --
6 --================================================--
7
8 g_errbuf_success constant varchar2(250) :=
9 'Program completed successfully. ';
10 g_errbuf_warning constant varchar2(250) :=
11 'Program completed with exceptions. ';
12 g_errbuf_error constant varchar2(250) :=
13 'Program terminated with exceptions. ';
14
15 g_retcode_success constant number := 0;
16 g_retcode_warning constant number := 1;
17 g_retcode_error constant number := 2;
18
19 --=============================================--
20 -- private procedure and function declarations --
21 --=============================================--
22
23 procedure print ( p_data varchar2 );
24
25 --===========================================--
26 -- public procedure and function definitions --
27 --===========================================--
28
29 ------------------------------------------
30 -- procedure update_planned_task_status --
31 ------------------------------------------
32 procedure update_planned_task_status
33 ( x_errbuf out nocopy varchar2
34 , x_retcode out nocopy varchar2
35 , p_query_id varchar2 default null
36 )
37 is
38
39 --
40 -- variables for API output parameters
41 --
42 l_return_status varchar2(2000);
43 l_msg_data varchar2(2000);
44 l_msg_count number;
45 l_task_ovn number;
46 l_task_status_name varchar2(2000);
47 l_task_status_id number;
48 l1 Number;
49 --
50 --
51 l_query_id number;
52 --
53 --
54 begin
55 --
56 -- initialise
57 --
58 l_query_id := fnd_profile.value('CSF_DEFAULT_AUTO_COMMIT_QUERY');
59 fnd_message.set_name('CSF', 'CSF_AUTO_COMMIT_STARTED');
60 print(fnd_message.get);
61 --
62 x_errbuf := g_errbuf_success;
63 x_retcode := g_retcode_success;
64 fnd_msg_pub.Initialize;
65 --
66 If p_query_id is not null then
67 l_query_id := p_query_id;
68 end if;
69 --
70 csf_tasks_pub.commit_schedule(
71 p_api_version => 1.0
72 , p_init_msg_list => fnd_api.g_false
73 , p_commit => fnd_api.g_true
74 , x_return_status => l_return_status
75 , x_msg_count => l_msg_count
76 , x_msg_data => l_msg_data
77 , p_query_id => l_query_id
78 );
79
80 if l_return_status <> fnd_api.g_ret_sts_success
81 then
82 raise fnd_api.g_exc_unexpected_error;
83 end if;
84 --
85 --
86 if l_msg_count > 0 then
87 FOR counter IN REVERSE 1..l_msg_count
88 LOOP
89 fnd_msg_pub.get(counter,FND_API.G_FALSE,l_msg_data,l1);
90 print(l_msg_data);
91 end loop;
92 end if;
93 fnd_message.set_name('CSF', 'CSF_AUTO_COMMIT_DONE');
94 print(fnd_message.get);
95 --
96 exception
97 when fnd_api.g_exc_unexpected_error then
98 x_errbuf := g_errbuf_warning;
99 x_retcode := g_retcode_warning;
100 if l_msg_count > 0 then
101 FOR counter IN REVERSE 1..l_msg_count
102 LOOP
103 fnd_msg_pub.get(counter,FND_API.G_FALSE,l_msg_data,l1);
104 print(l_msg_data);
105 end loop;
106 end if;
107 when others then
108 x_errbuf := g_errbuf_error;
109 x_retcode := g_retcode_error;
110
111 if l_msg_count > 0 then
112 FOR counter IN REVERSE 1..l_msg_count
113 LOOP
114 fnd_msg_pub.get(counter,FND_API.G_FALSE,l_msg_data,l1);
115 print(l_msg_data);
116 end loop;
117 end if;
118 fnd_message.set_name('CSF', 'CSF_AUTO_COMMIT_EXCEPTION');
119 fnd_message.set_token('P_MESSAGE', sqlerrm);
120 print(fnd_message.get);
121 fnd_message.set_name('CSF', 'CSF_AUTO_COMMIT_ABORT');
122 print(fnd_message.get);
123 end update_planned_task_status;
124
125 --============================================--
126 -- private procedure and function definitions --
127 --============================================--
128
129 -----------------------------------------------------
130 -- print a message to the output and the log file ---
131 -----------------------------------------------------
132 procedure print ( p_data varchar2 )
133 is
134 begin
135 fnd_file.put_line(fnd_file.output, p_data);
136 fnd_file.put_line(fnd_file.log, p_data);
137 end print;
138
139 end csf_auto_commit_pvt;