[Home] [Help]
PACKAGE BODY: APPS.PER_RI_PRE_DATAPUMP
Source
1 package body per_ri_pre_datapump as
2 /* $Header: perripmp.pkb 120.1 2006/05/03 09:42:10 nkkrishn noship $ */
3 --------------------------------------------------------------------------------
4 /*
5 +==============================================================================+
6 | Copyright (c) 1998 Oracle Corporation |
7 | Redwood Shores, California, USA |
8 | All rights reserved. |
9 +==============================================================================+
10 --
11 Name
12 Enrollment Process
13 Purpose
14 This is a wrapper procedure for Data pump functionality from workbench.
15 History
16 Date Who Version What?
17 ---- --- ------- -----
18 16 Jan 06 ikasire 115.0 Created
19 23 Mar 06 ikasire 115.1 Added Process beneficiaries
20 02 May 06 nkkrishn 115.11 Fixed Beneficiary upload
21 */
22 --
23 --Globals
24 --
25 g_debug boolean := hr_utility.debug_enabled;
26 --
27 --
28 procedure check_slaves_status
29 (p_request_id in number
30 ,p_slave_errored out nocopy boolean
31 )
32 is
33 --
34 l_package varchar2(80) := 'per_ri_pre_datapump.check_slaves_status';
35 --
36 l_no_slaves boolean;
37 l_poll_loops pls_integer;
38 l_slave_errored boolean := false ;
39 --
40 cursor c_slaves
41 (c_request_id number
42 )
43 is
44 select phase_code,
45 status_code
46 from fnd_concurrent_requests fnd
47 where fnd.request_id = c_request_id;
48 --
49 l_slaves c_slaves%rowtype;
50 --
51 begin
52 --
53 hr_utility.set_location ('Entering '||l_package,10);
54 --
55 --
56 l_no_slaves := true;
57 --
58 while l_no_slaves loop
59 --
60 l_no_slaves := false;
61 --
62 --
63 open c_slaves
64 (p_request_id);
65 fetch c_slaves into l_slaves;
66 if l_slaves.phase_code <> 'C'
67 then
68 --
69 l_no_slaves := true;
70 --
71 end if;
72 --
73 if l_slaves.status_code = 'E' then
74 --
75 l_slave_errored := true;
76 --
77 end if;
78 --
79 close c_slaves;
80 --
81 -- Loop to avoid over polling of fnd_concurrent_requests
82 --
83 l_poll_loops := 100000;
84 --
85 for i in 1..l_poll_loops
86 loop
87 --
88 null;
89 --
90 end loop;
91 --
92 end loop;
93 --
94 p_slave_errored := l_slave_errored ;
95 --
96 hr_utility.set_location ('Leaving '||l_package,10);
97 --
98 commit;
99 --
100 end check_slaves_status;
101 --
102 --
103 procedure pre_datapump_process
104 (errbuf out nocopy varchar2,
105 retcode out nocopy number,
106 p_batch_id in number default null,
107 p_validate in varchar2 default 'N'
108 ) is
109 l_retcode number;
110 l_errbuf varchar2(1000);
111 l_package varchar2(80) := 'per_ri_pre_datapump.pre_datapump_process';
112 --
113 cursor c_api is
114 select distinct module_name
115 from hr_pump_batch_lines lines,
116 hr_api_modules api
117 where lines.batch_id = p_batch_id
118 and lines.api_module_id = api.api_module_id ;
119 --
120 l_api c_api%ROWTYPE;
121 l_request_id NUMBER ;
122 l_slave_errored boolean := false ;
123 --
124 begin
125 --Find out the HRDPP information from batch_id
126 --Now call the appropriate procedure.
127 --once the call is completed, successfully, submit DATAPUMP request
128 --
129 hr_utility.set_location ('Entering '||l_package,10);
130 savepoint pre_datapump_process;
131 --
132 --
133 fnd_file.put_line
134 (which => fnd_file.log,
135 buff => 'Before Pre Process call ');
136 --
137 FOR l_rec in c_api LOOP
138 --
139 fnd_file.put_line
140 (which => fnd_file.log,
141 buff => 'module_name :'||l_rec.module_name );
142 --
143 IF l_rec.module_name = 'CREATE_ENROLLMENT' THEN
144 --
145 ben_pre_datapump_process.pre_create_enrollment(
146 p_batch_id => p_batch_id
147 ,p_validate => p_validate
148 );
149 --
150 ELSIF l_rec.module_name = 'PROCESS_DEPENDENT' THEN
151 --
152 ben_pre_datapump_process.pre_process_dependent(
153 p_batch_id => p_batch_id
154 ,p_validate => p_validate
155 );
156 --
157 ELSIF l_rec.module_name = 'PROCESS_BENEFICIARY' THEN
158 --
159 ben_pre_datapump_process.pre_process_beneficiary(
160 p_batch_id => p_batch_id
161 ,p_validate => p_validate
162 );
163 --
164 END IF;
165 --
166 fnd_file.put_line
167 (which => fnd_file.log,
168 buff => 'After Call - module_name :'||l_rec.module_name );
169 --
170 END LOOP;
171 --
172 -- Now lets call Data pump Process
173 --
174 hr_utility.set_location ('Before Submit Request '||l_package,20);
175 --
176 fnd_file.put_line
177 (which => fnd_file.log,
178 buff => 'Before Datapump Call');
179 --
180 l_request_id := fnd_request.submit_request
181 (application => 'PER'
182 ,program => 'DATAPUMP'
183 ,description => NULL
184 ,sub_request => FALSE
185 ,argument1 => p_batch_id
186 ,argument2 => p_validate );
187 --
188 hr_utility.set_location ('After Submit Request '||l_package,30);
189 --
190 commit;
191 --
192 fnd_file.put_line
193 (which => fnd_file.log,
194 buff => 'After Datapump Call');
195 --
196 check_slaves_status(p_request_id => l_request_id
197 ,p_slave_errored => l_slave_errored);
198 --
199 if l_slave_errored then
200 --
201 fnd_file.put_line
202 (which => fnd_file.log,
203 buff => 'Datapump Request '||l_request_id||' completed with error.');
204 fnd_file.put_line
205 (which => fnd_file.log,
206 buff => 'Check the request log for error details.');
207 --
208 else
209 --
210 fnd_file.put_line
211 (which => fnd_file.log,
212 buff => 'Datapump Request '||l_request_id||' completed successfully.');
213 --
214 end if;
215 --
216 hr_utility.set_location ('Leaving '||l_package,40);
217 --
218 exception when others then
219 raise ;
220 end pre_datapump_process ;
221 --
222 end per_ri_pre_datapump;