[Home] [Help]
PACKAGE BODY: APPS.OKL_CNTRCT_FIN_EXT_MASTER_PVT
Source
1 PACKAGE BODY OKL_CNTRCT_FIN_EXT_MASTER_PVT AS
2 /* $Header: OKLRFECB.pls 120.0.12010000.6 2009/01/13 23:49:53 sechawla noship $*/
3
4 -- -------------------------------------------------
5 -- To print log messages
6 -- -------------------------------------------------
7
8
9 PROCEDURE write_to_log(
10 p_message IN VARCHAR2
11 ) IS
12 BEGIN
13
14 fnd_file.put_line(fnd_file.log, p_message);
15 END write_to_log;
16
17
18 PROCEDURE write_to_output(
19 p_message IN VARCHAR2
20 ) IS
21 BEGIN
22
23 fnd_file.put_line(fnd_file.output, p_message);
24 END write_to_output;
25
26
27 /*========================================================================
28 | PUBLIC PROCEDURE Process_Spawner
29 |
30 | DESCRIPTION
31 | This procedure identifies contracts for Contract Financial Report, based
32 | upon a few primary input paramaters, inserts these contracts into a temp table and
33 | assigns a worker to each contract. It then spawns child request(s), based upon
34 | the parameter 'p_num_processes'. Once child requests complete, it launches
35 | request for Contract Financial Report
36 |
37 | CALLED FROM
38 | Concurrent Program "Master Program -- Contract Financial Report"
39 |
40 | CALLS PROCEDURES/FUNCTIONS
41 |
42 | KNOWN ISSUES
43 |
44 | NOTES
45 |
46 |
47 | MODIFICATION HISTORY
48 | Date Author Description of Changes
49 | 19-Sep-2008 SECHAWLA Created
50 *=======================================================================*/
51
52 PROCEDURE Process_Spawner (
53
54 errbuf OUT NOCOPY VARCHAR2,
55 retcode OUT NOCOPY NUMBER,
56 P_OPERATING_UNIT IN NUMBER,
57 P_REPORT_DATE IN VARCHAR2,
58 P_DATA_SOURCE_CODE IN VARCHAR2,
59 P_REPORT_TEMPLATE_NAME IN VARCHAR2,
60 P_REPORT_LANGUAGE IN VARCHAR2,
61 P_REPORT_FORMAT IN VARCHAR2,
62 P_START_DATE_FROM IN VARCHAR2,
63 P_START_DATE_TO IN VARCHAR2,
64 P_AR_INFO_YN IN VARCHAR2,
65 P_BOOK_CLASS IN VARCHAR2,
66 P_LEASE_PRODUCT IN VARCHAR2,
67 P_CONTRACT_STATUS IN VARCHAR2,
68 P_CUSTOMER_NUMBER IN VARCHAR2,
69 P_CUSTOMER_NAME IN VARCHAR2,
70 P_SIC_CODE IN VARCHAR2,
71 P_VENDOR_NUMBER IN VARCHAR2,
72 P_VENDOR_NAME IN VARCHAR2,
73 P_SALES_CHANNEL IN VARCHAR2,
74 P_GEN_ACCRUAL IN VARCHAR2,
75 P_END_DATE_FROM IN VARCHAR2,
76 P_END_DATE_TO IN VARCHAR2,
77 P_TERMINATE_DATE_FROM IN VARCHAR2,
78 P_TERMINATE_DATE_TO IN VARCHAR2,
79 P_DELETE_DATA_YN IN VARCHAR2,
80 p_num_processes IN NUMBER
81
82
83 ) IS
84
85
86 CURSOR l_parallel_worker_csr(cp_assigned_process IN VARCHAR2) IS
87 SELECT object_value, khr_id, assigned_process
88 FROM OKL_PARALLEL_PROCESSES
89 WHERE object_type = 'CONTRACT_FIN_EXTRACT'
90 AND assigned_process = cp_assigned_process
91 AND process_status = 'PENDING_ASSIGNMENT';
92
93 CURSOR parent_sts_csr(p_request_id NUMBER) IS
94 SELECT count(*)
95 from fnd_concurrent_requests req,
96 fnd_concurrent_programs pgm
97 where req.PRIORITY_REQUEST_ID = p_request_id
98 and req.concurrent_program_id = pgm.concurrent_program_id
99 and req.PHASE_CODE = 'C'
100 and request_id <> p_request_id
101 and STATUS_CODE = 'E';
102
103 CURSOR parent_warn_sts_csr(p_request_id NUMBER) IS
104 SELECT count(*)
105 from fnd_concurrent_requests req,
106 fnd_concurrent_programs pgm
107 where req.priority_request_id = p_request_id
108 and req.concurrent_program_id = pgm.concurrent_program_id
109 and req.phase_code = 'C'
110 and request_id <> p_request_id
111 and status_code = 'G';
112
113 l_int_counter INTEGER;
114 l_init_loop BOOLEAN := TRUE;
115 l_seq_next NUMBER;
116 l_char_seq_num VARCHAR2(30);
117 l_data_found BOOLEAN := FALSE;
118 lp_k_start_date_from DATE;
119 lp_k_start_date_to DATE;
120 lp_k_end_date_from DATE;
121 lp_k_end_date_to DATE;
122 l_req_data VARCHAR2(10);
123 l_req_counter NUMBER;
124 request_id NUMBER := 0;
125 l_last_worker_used NUMBER;
126 TYPE parallel_worker_tbl_type IS TABLE OF l_parallel_worker_csr%ROWTYPE INDEX BY BINARY_INTEGER;
127
128 l_parallel_worker_tbl parallel_worker_tbl_type;
129 l_parallel_worker_temp_tbl parallel_worker_tbl_type;
130
131 l_fetch_size NUMBER := 10000;
132 l_total_rows NUMBER := 0;
133 l_this_row NUMBER;
134 l_max_worker_used NUMBER;
135
136 -- Org Id and standard who columns
137 l_last_updated_by okl_parallel_processes.last_updated_by%TYPE := Fnd_Global.USER_ID;
138 l_last_update_login okl_parallel_processes.last_update_login%TYPE := Fnd_Global.LOGIN_ID;
139 l_request_id okl_parallel_processes.request_id%TYPE := Fnd_Global.CONC_REQUEST_ID;
140 l_program_id okl_parallel_processes.program_id%TYPE := Fnd_Global.CONC_PROGRAM_ID;
141 l_org_id okl_parallel_processes.org_id%type;
142
143 l_child_in_error NUMBER;
144 l_child_in_warn NUMBER;
145
146 i NUMBER;
147 report_request_id NUMBER := 0;
148 l_row_count NUMBER;
149 p_ret_add_layout BOOLEAN := true;
150 lp_report_date DATE;
151
152 begin
153
154
155 -- The following block is added to control the sub-request program
156 -- submission. It ensures that this program is not executed recurrsively.
157 l_req_data := fnd_conc_global.request_data;
158 -- If l_req_data has a value within this session, the program is attempting to
159 -- run again, therefore break out of the loop.
160
161
162 -- Add couple of blank lines
163 fnd_file.new_line(fnd_file.log,2);
164 fnd_file.new_line(fnd_file.output,2);
165
166
167 write_to_log('l_req_data : '||l_req_data);
168
169 MO_GLOBAL.set_policy_context('S',p_operating_unit);
170
171 if l_req_data is not null and l_req_data = '1' then
172
173
174 l_child_in_error := 0;
175 OPEN parent_sts_csr( l_request_id );
176 FETCH parent_sts_csr INTO l_child_in_error;
177 CLOSE parent_sts_csr;
178
179 write_to_log('l_child_in_error : '||l_child_in_error);
180 l_child_in_warn := 0;
181 OPEN parent_warn_sts_csr( l_request_id );
182 FETCH parent_warn_sts_csr INTO l_child_in_warn;
183 CLOSE parent_warn_sts_csr;
184
185 write_to_log('l_child_in_warn : '||l_child_in_warn);
186
187 if l_child_in_error > 0 then
188 errbuf := 'Done, but with error!';
189 retcode := 2;
190 return;
191 end if;
192
193 if l_child_in_warn > 0 then
194 errbuf := 'Done, but with warning(s)!';
195 retcode := 1;
196 return;
197 end if;
198
199
200
201 FND_REQUEST.set_org_id(mo_global.get_current_org_id); --MOAC- Concurrent request
202
203 --P_REPORT_TEMPLATE_NAME <-> value set 'OKL_XDO_REP_TEMPLATE' <-> stores the template code (in ID column)
204 --P_REPORT_LANGUAGE <-> value set 'OKL_XDO_REP_LANGUAGE' <-> stores language code e.g 'en' (in ID column)
205 --P_REPORT_FORMAT <-> value set 'OKL_XDO_REP_FORMAT' <-> stores format code e.g 'RTF' (in ID column)
206 p_ret_add_layout := FND_REQUEST.add_layout( template_appl_name=>'OKL',
207 template_code=> P_REPORT_TEMPLATE_NAME, --'OKLFINEXTR',
208 template_language=> P_REPORT_LANGUAGE, --'en', --sechawla 7628379
209 template_territory=>'00',
210 output_format=>P_REPORT_FORMAT); --'RTF');--sechawla 7628379
211 IF p_ret_add_layout THEN
212 write_to_log('p_ret_add_layout = TRUE');
213 ELSE
214 write_to_log('p_ret_add_layout = FALSE');
215 END IF;
216
217 report_request_id := FND_REQUEST.SUBMIT_REQUEST(
218 application => 'OKL',
219 program => 'OKLFINEXTR',
220 sub_request => TRUE,
221 argument1 => P_OPERATING_UNIT,
222 argument2 => P_REPORT_DATE,
223 argument3 => P_START_DATE_FROM,
224 argument4 => P_START_DATE_TO,
225 argument5 => P_AR_INFO_YN,
226 argument6 => P_BOOK_CLASS,
227 argument7 => P_LEASE_PRODUCT,
228 argument8 => P_CONTRACT_STATUS,
229 argument9 => P_CUSTOMER_NUMBER,
230 argument10 => P_CUSTOMER_NAME,
231 argument11 => P_SIC_CODE,
232 argument12 => P_VENDOR_NUMBER,
233 argument13 => P_VENDOR_NAME,
234 argument14 => P_SALES_CHANNEL,
235 argument15 => P_GEN_ACCRUAL,
236 argument16 => P_END_DATE_FROM,
237 argument17 => P_END_DATE_TO,
238 argument18 => P_TERMINATE_DATE_FROM,
239 argument19 => P_TERMINATE_DATE_TO,
240 argument20 => P_DELETE_DATA_YN
241
242 );
243
244
245 write_to_log('Launching Report with Request ID '||report_request_id);
246
247 if (report_request_id = 0) then
248
249
250 write_to_log('Request submission failed. ');
251 write_to_log('Exiting with error... ');
252
253 -- If request submission failed, exit with error
254 errbuf := fnd_message.get;
255 retcode := 2;
256 else
257 write_to_log('Report Sub-Request submitted, putting master into PAUSED mode');
258 --Set the globals to put the master into PAUSED mode
259 fnd_conc_global.set_req_globals(conc_status => 'PAUSED',
260 request_data => to_char(2));
261 errbuf := 'Sub-Request submitted!';
262 retcode := 0;
263 end if;
264
265 elsif l_req_data is not null and l_req_data = '2' then
266 l_child_in_error := 0;
267 OPEN parent_sts_csr( l_request_id );
268 FETCH parent_sts_csr INTO l_child_in_error;
269 CLOSE parent_sts_csr;
270
271 write_to_log('l_child_in_error : '||l_child_in_error);
272 l_child_in_warn := 0;
273 OPEN parent_warn_sts_csr( l_request_id );
274 FETCH parent_warn_sts_csr INTO l_child_in_warn;
275 CLOSE parent_warn_sts_csr;
276
277 write_to_log('l_child_in_warn : '||l_child_in_warn);
278
279 if l_child_in_error > 0 then
280 errbuf := 'Done, but with error!';
281 retcode := 2;
282 return;
283 end if;
284
285 if l_child_in_warn > 0 then
286 errbuf := 'Done, but with warning(s)!';
287 retcode := 1;
288 return;
289 end if;
290
291 write_to_log('Returning Successfully');
292 errbuf := 'Done!';
293 retcode := 0;
294 return;
295
296 end if;
297
298 IF l_req_data IS NULL THEN
299
300
301
302 write_to_log('P_OPERATING_UNIT = '||P_OPERATING_UNIT);
303 write_to_log('P_REPORT_DATE = '||P_REPORT_DATE);
304 write_to_log('P_DATA_SOURCE_CODE = '||P_DATA_SOURCE_CODE);
305 write_to_log('P_REPORT_TEMPLATE_NAME ='|| P_REPORT_TEMPLATE_NAME);
306 write_to_log('P_REPORT_LANGUAGE ='|| P_REPORT_LANGUAGE);
307 write_to_log('P_REPORT_FORMAT ='|| P_REPORT_FORMAT);
308 write_to_log('P_START_DATE_FROM = '||P_START_DATE_FROM);
309 write_to_log('P_START_DATE_TO = '||P_START_DATE_TO);
310 write_to_log('P_AR_INFO_YN = '||P_AR_INFO_YN);
311 write_to_log('P_BOOK_CLASS = '||P_BOOK_CLASS);
312 write_to_log('P_LEASE_PRODUCT = '||P_LEASE_PRODUCT);
313 write_to_log('P_CONTRACT_STATUS = '||P_CONTRACT_STATUS);
314 write_to_log('P_CUSTOMER_NUMBER = '||P_CUSTOMER_NUMBER);
315 write_to_log('P_CUSTOMER_NAME = '||P_CUSTOMER_NAME);
316 write_to_log('P_SIC_CODE = '||P_SIC_CODE);
317 write_to_log('P_VENDOR_NUMBER = '||P_VENDOR_NUMBER);
318 write_to_log('P_VENDOR_NAME = '||P_VENDOR_NAME);
319 write_to_log('P_SALES_CHANNEL = '||P_SALES_CHANNEL);
320 write_to_log('P_GEN_ACCRUAL = '||P_GEN_ACCRUAL);
321 write_to_log('P_END_DATE_FROM = '||P_END_DATE_FROM);
322 write_to_log('P_END_DATE_TO = '||P_END_DATE_TO);
323 write_to_log('P_TERMINATE_DATE_FROM = '||P_TERMINATE_DATE_FROM);
324 write_to_log('P_TERMINATE_DATE_TO = '||P_TERMINATE_DATE_TO);
325 write_to_log('P_DELETE_DATA_YN '||P_DELETE_DATA_YN);
326 write_to_log('p_num_processes = '||p_num_processes);
327
328
329
330
331
332 lp_report_date := FND_DATE.CANONICAL_TO_DATE(P_REPORT_DATE);
333
334 ---- Paramater validations -----
335
336 IF trunc(lp_report_date) <> trunc(sysdate) THEN
337 write_to_log('Report Date should be today''s date');
338 return;
339 END IF;
340
341 -- If p_num_processes is 0 then no need to go through the algorithm.
342 -- p_num_processes can be 1
343 if ( nvl(p_num_processes,0) = 0 OR nvl(p_num_processes,0) < 0 )then
344 write_to_log('No workers specified');
345 return;
346 end if;
347
348 lp_k_start_date_from := FND_DATE.CANONICAL_TO_DATE(P_START_DATE_FROM);
349 lp_k_start_date_to := FND_DATE.CANONICAL_TO_DATE(P_START_DATE_TO);
350
351
352 IF P_END_DATE_FROM IS NOT NULL THEN
353 lp_k_end_date_from := FND_DATE.CANONICAL_TO_DATE(P_END_DATE_FROM);
354 END IF;
355
356 IF P_END_DATE_TO IS NOT NULL THEN
357 lp_k_end_date_to := FND_DATE.CANONICAL_TO_DATE(P_END_DATE_TO);
358 END IF;
359
360 -- Select sequence for marking processes
361 select okl_opp_seq.nextval
362 into l_seq_next
363 from dual ;
364
365 l_char_seq_num := to_char(l_seq_next);
366
367 WRITE_TO_LOG('Sequence Number : '||l_seq_next);
368
369 -- mark records for processing
370
371 l_org_id := mo_global.get_current_org_id();
372 WRITE_TO_LOG('org id:: '||l_org_id);
373
374
375 INSERT INTO OKL_PARALLEL_PROCESSES
376 (
377 object_type, object_value, assigned_process, process_status, start_date, khr_id,
378 ORG_ID,CREATED_BY,CREATION_DATE,LAST_UPDATE_DATE,LAST_UPDATED_BY,LAST_UPDATE_LOGIN,
379 REQUEST_ID,PROGRAM_ID,PROGRAM_UPDATE_DATE
380 )
381 SELECT 'CONTRACT_FIN_EXTRACT', chr.contract_number, l_char_seq_num, 'PENDING_ASSIGNMENT', sysdate, chr.id ,
382 l_org_id,l_last_updated_by,sysdate,sysdate,l_last_updated_by,l_last_update_login,
383 l_request_id,l_program_id,sysdate
384 FROM okc_k_headers_all_b chr,
385 OKL_K_HEADERS khr
386 WHERE chr.id = khr.id
387 AND chr.SCS_CODE = 'LEASE'
388 AND chr.sts_code IN ('BANKRUPTCY_HOLD','ENTERED','BOOKED', 'COMPLETE', 'EVERGREEN', 'EXPIRED', 'INCOMPLETE',
389 'LITIGATION_HOLD', 'NEW', 'PASSED', 'REVERSED', 'TERMINATED') --sechawla 13-jan-09 7693771
390 AND chr.AUTHORING_ORG_ID = P_OPERATING_UNIT
391 AND (chr.start_date IS NOT NULL AND chr.START_DATE >= lp_k_start_date_from)
392 AND (chr.start_date IS NOT NULL AND chr.START_DATE <= lp_k_start_date_to)
393 AND nvl(khr.DEAL_TYPE,'XXX') = nvl(P_BOOK_CLASS, nvl(khr.DEAL_TYPE,'XXX'))
394 AND nvl(khr.pdt_id,-9999) = nvl(P_LEASE_PRODUCT,nvl(khr.pdt_id,-9999))
395 AND chr.sts_code = nvl(P_CONTRACT_STATUS, chr.sts_code)
396 AND ( (lp_k_end_date_from IS NULL) OR (chr.END_DATE IS NOT NULL AND chr.END_DATE >= lp_k_end_date_from) )
397 AND ( (lp_k_end_date_to IS NULL ) OR (chr.END_DATE IS NOT NULL AND chr.END_DATE <= lp_k_end_date_to) )
398 AND NOT EXISTS
399 (SELECT '1'
400 FROM OKL_PARALLEL_PROCESSES opp
401 WHERE chr.contract_number = opp.object_value
402 AND opp.object_type = 'CONTRACT_FIN_EXTRACT'
403 AND opp.process_status in ('PENDING_ASSIGNMENT', 'ASSIGNED'));
404
405 l_row_count := SQL%ROWCOUNT;
406
407 write_to_log('Number of rows inserted in OKL_PARALLEL_PROCESSES :'||l_row_count);
408
409 IF l_row_count > 0 THEN
410 l_data_found := TRUE;
411
412 END IF;
413
414
415 COMMIT;
416
417
418 if l_data_found then
419
420 write_to_log('l_fetch_size : '||l_fetch_size);
421
422
423 i := 1;
424 l_parallel_worker_tbl.DELETE;
425 OPEN l_parallel_worker_csr(l_char_seq_num);
426 LOOP
427 l_parallel_worker_temp_tbl.DELETE;
428 FETCH l_parallel_worker_csr BULK COLLECT INTO l_parallel_worker_temp_tbl LIMIT l_fetch_size;
429
430
431 IF l_parallel_worker_temp_tbl.COUNT > 0 THEN
432 FOR k IN l_parallel_worker_temp_tbl.FIRST..l_parallel_worker_temp_tbl.LAST LOOP
433 l_parallel_worker_tbl(i).object_value := l_parallel_worker_temp_tbl(k).object_value;
434 l_parallel_worker_tbl(i).khr_id := l_parallel_worker_temp_tbl(k).khr_id;
435 l_parallel_worker_tbl(i).assigned_process := l_parallel_worker_temp_tbl(k).assigned_process;
436
437 i := i + 1;
438 END LOOP;
439
440 END IF;
441
442 EXIT WHEN l_parallel_worker_csr%NOTFOUND;
443 END LOOP;
444 CLOSE l_parallel_worker_csr;
445
446 l_total_rows := l_parallel_worker_tbl.count;
447
448 write_to_log('l_parallel_worker_tbl.count :'||l_total_rows);
449
450
451 IF l_total_rows > 0 THEN
452 -- p_num_processes is > 0
453 l_this_row := 1;
454
455 l_max_worker_used := 0;
456
457 WHILE l_this_row <= l_total_rows LOOP
458 FOR j in 1..p_num_processes LOOP
459 IF l_this_row <= l_total_rows THEN
460 l_parallel_worker_tbl(l_this_row).assigned_process := l_parallel_worker_tbl(l_this_row).assigned_process||'-'||j ;
461
462 l_last_worker_used := j;
463
464 l_this_row := l_this_row + 1;
465 ELSE
466 EXIT;
467 END IF;
468 END LOOP;
469
470 if l_last_worker_used > l_max_worker_used then
471 l_max_worker_used :=l_last_worker_used;
472 end if;
473
474 END LOOP;
475
476 write_to_log('l_max_worker_used :'||l_max_worker_used);
477
478 -- At this point, l_parallel_worker_tbl has all the contracts with an assigned process
479 FOR k IN l_parallel_worker_tbl.FIRST..l_parallel_worker_tbl.LAST LOOP
480
481
482 write_to_log('contract # : '||l_parallel_worker_tbl(k).object_value||': worker # '||l_parallel_worker_tbl(k).assigned_process);
483 UPDATE OKL_PARALLEL_PROCESSES
484 SET assigned_process = l_parallel_worker_tbl(k).assigned_process,
485 process_status = 'ASSIGNED'
486 WHERE object_Type = 'CONTRACT_FIN_EXTRACT'
487 AND object_value = l_parallel_worker_tbl(k).object_value
488 AND process_status = 'PENDING_ASSIGNMENT';
489
490 COMMIT;
491 END LOOP;
492
493 write_to_log('OKL_PARALLEL_PROCESSES Updated with worker assignment');
494
495 FOR j in 1..l_max_worker_used LOOP
496
497 l_req_data := fnd_conc_global.request_data;
498
499
500 if (l_req_data is not null) then
501 l_req_counter := l_req_counter + to_number(l_req_data);
502 else
503 l_req_counter := 1;
504 end if;
505
506 -- l_req_counter = number of workers used ?
507 write_to_log('Worker # :'||j||' l_req_data : '||l_req_data||' l_req_counter : '||l_req_counter);
508 if l_req_counter < (p_num_processes+1) then
509 FND_REQUEST.set_org_id(mo_global.get_current_org_id); --MOAC- Concurrent request
510
511
512 request_id := FND_REQUEST.SUBMIT_REQUEST(
513 application => 'OKL',
514 program => 'OKL_CNTRCT_FIN_REP_CHILD', --short name for child conc program
515 sub_request => TRUE,
516 argument1 => P_OPERATING_UNIT,
517 argument2 => P_REPORT_DATE,
518 argument3 => P_START_DATE_FROM,
519 argument4 => P_START_DATE_TO,
520 argument5 => P_AR_INFO_YN,
521 argument6 => P_BOOK_CLASS,
522 argument7 => P_LEASE_PRODUCT,
523 argument8 => P_CONTRACT_STATUS,
524 argument9 => P_CUSTOMER_NUMBER,
525 argument10 => P_CUSTOMER_NAME,
526 argument11 => P_SIC_CODE,
527 argument12 => P_VENDOR_NUMBER,
528 argument13 => P_VENDOR_NAME,
529 argument14 => P_SALES_CHANNEL,
530 argument15 => P_GEN_ACCRUAL,
531 argument16 => P_END_DATE_FROM,
532 argument17 => P_END_DATE_TO,
533 argument18 => P_TERMINATE_DATE_FROM,
534 argument19 => P_TERMINATE_DATE_TO,
535 argument20 => P_DELETE_DATA_YN,
536 argument21 => p_num_processes,
537 argument22 => l_seq_next||'-'||j
538 );
539
540
541 write_to_log('Launching Process '||l_seq_next||'-'||j ||' with Request ID '||request_id);
542
543 if (request_id = 0) then
544
545 write_to_log('Request submission failed.');
546 write_to_log('Exiting with error... ');
547
548 DELETE OKL_PARALLEL_PROCESSES
549 WHERE assigned_process like l_char_seq_num||'%' ;
550
551 l_row_count := sql%rowcount;
552 IF l_row_count > 0 THEN
553 write_to_log('Deleted '||l_row_count||' rows from OKL_PARALLEL_PROCESSES.');
554 END IF;
555
556 COMMIT;
557 -- If request submission failed, exit with error
558 errbuf := fnd_message.get;
559 retcode := 2;
560 else
561 write_to_log('Sub-Request submitted, putting master into PAUSED mode');
562 -- Set the globals to put the master into PAUSED mode
563 fnd_conc_global.set_req_globals(conc_status => 'PAUSED',
564 request_data => to_char(1));
565 errbuf := 'Sub-Request submitted!';
566 retcode := 0;
567 end if;
568 end if;
569
570
571 END LOOP;
572
573 END IF; --IF l_total_rows > 0 THEN
574
575 else --if l_data_found then
576 write_to_log('No workers assigned due to no data found for prcocesing');
577
578 end if;
579 end if;
580 exception
581 when others then
582 write_to_log('Unhandled Exception '||sqlcode||':'||sqlerrm);
583
584 DELETE OKL_PARALLEL_PROCESSES
585 WHERE assigned_process like l_char_seq_num||'%' ;
586
587 l_row_count := sql%rowcount;
588
589 IF l_row_count > 0 THEN
590 write_to_log('Deleted '||sql%rowcount||' rows from OKL_PARALLEL_PROCESSES.');
591 END IF;
592
593 COMMIT;
594
595 END Process_Spawner;
596
597
598
599 END OKL_CNTRCT_FIN_EXT_MASTER_PVT;