[Home] [Help]
PACKAGE BODY: APPS.FA_XADJ_ITF_PKG
Source
1 PACKAGE BODY FA_XADJ_ITF_PKG as
2 /* $Header: faxadjib.pls 120.6 2009/07/05 18:57:13 anujain ship $ */
3
4 g_log_level_rec fa_api_types.log_level_rec_type;
5
6 PROCEDURE faxadji(
7 p_batch_id IN VARCHAR2,
8 p_old_flag IN VARCHAR2,
9 p_parent_request_id IN NUMBER,
10 p_total_requests IN NUMBER,
11 p_request_number IN NUMBER,
12 px_max_asset_id IN OUT NOCOPY NUMBER,
13 x_success_count OUT NOCOPY number,
14 x_failure_count OUT NOCOPY number,
15 x_worker_jobs OUT NOCOPY NUMBER,
16 x_return_status OUT NOCOPY number) IS
17
18 -- messaging
19 l_batch_size NUMBER;
20 l_loop_count NUMBER;
21 l_count NUMBER := 0;
22
23 -- misc
24 l_request_id NUMBER;
25 l_trx_approval BOOLEAN;
26 rbs_name VARCHAR2(30);
27 sql_stmt VARCHAR2(101);
28
29 -- types
30 TYPE rowid_tbl IS TABLE OF VARCHAR2(50) INDEX BY BINARY_INTEGER;
31 TYPE number_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
32 TYPE v30_tbl IS TABLE OF VARCHAR2(150) INDEX BY BINARY_INTEGER;
33
34 -- used for main cursor
35 l_itf_rowid rowid_tbl;
36 l_asset_id number_tbl;
37 l_asset_number v30_tbl;
38 l_book_type_code v30_tbl;
39 l_extended_deprn_flag v30_tbl;
40 l_extended_deprn_period number_tbl;
41 l_posting_status v30_tbl;
42 l_extended_deprn_limit number_tbl;
43
44
45 -- used for api call
46 l_return_status varchar2(1);
47 l_mesg_count number := 0;
48 l_mesg_name varchar2(30);
49 l_mesg varchar2(4000);
50
51 l_trans_rec FA_API_TYPES.trans_rec_type;
52 l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;
53 l_asset_fin_rec_adj FA_API_TYPES.asset_fin_rec_type;
54 l_asset_fin_rec_new FA_API_TYPES.asset_fin_rec_type;
55 l_asset_fin_mrc_tbl_new FA_API_TYPES.asset_fin_tbl_type;
56 l_inv_trans_rec FA_API_TYPES.inv_trans_rec_type;
57 l_inv_tbl FA_API_TYPES.inv_tbl_type;
58 l_asset_deprn_rec_adj FA_API_TYPES.asset_deprn_rec_type;
59 l_asset_deprn_rec_new FA_API_TYPES.asset_deprn_rec_type;
60 l_asset_deprn_mrc_tbl_new FA_API_TYPES.asset_deprn_tbl_type;
61 l_group_reclass_options_rec FA_API_TYPES.group_reclass_options_rec_type;
62
63 l_calling_fn VARCHAR2(30) := 'FA_XADJ_ITF_PKG.faxadji';
64
65 -- for parallelization
66 l_unassigned_cnt number := 0;
67 l_failed_cnt number := 0;
68 l_wip_cnt number := 0;
69 l_completed_cnt number := 0;
70 l_total_cnt number := 0;
71 l_counter number := 0;
72 l_start_range number := 0;
73 l_end_range number := 0;
74
75 v_err number;
76 v_msg varchar2(255);
77
78 cursor c_assets is
79 select fat.rowid
80 , fab.asset_id id
81 , fat.asset_number num
82 , fat.book_type_code book
83 , fat.extended_deprn_flag flag
84 , fat.extended_depreciation_period period
85 , fat.posting_status status
86 , fat.extended_deprn_limit -- bug 6658280
87 from fa_adjustments_t fat,
88 fa_additions_b fab
89 where fat.asset_number = fab.asset_number
90 and fat.posting_status = 'POST' /* bug 8597025 */
91 and fat.batch_id = p_batch_id
92 and fab.asset_id >= l_start_range
93 and fab.asset_id <= l_end_range
94 order by fat.book_type_code, fab.asset_id;
95
96 -- Exceptions
97 done_exc EXCEPTION;
98 data_error EXCEPTION;
99 fapadj_err EXCEPTION;
100
101
102 BEGIN
103
104 -- px_max_asset_id := nvl(px_max_asset_id, 0);
105 x_success_count := 0;
106 x_failure_count := 0;
107 x_worker_jobs := 0;
108
109 l_request_id := fnd_global.conc_request_id;
110
111 if (rbs_name is not null) then
112 sql_stmt := 'Set Transaction Use Rollback Segment '|| rbs_name;
113 execute immediate sql_stmt;
114 end if;
115
116
117 if (not g_log_level_rec.initialized) then
118 if (NOT fa_util_pub.get_log_level_rec (
119 x_log_level_rec => g_log_level_rec
120 )) then
121 raise fapadj_err;
122 end if;
123 end if;
124
125 l_batch_size := nvl(fa_cache_pkg.fa_batch_size, 1000);
126
127 if (g_log_level_rec.statement_level) then
128 fa_debug_pkg.add(l_calling_fn,'Before','Fetching data', p_log_level_rec => g_log_level_rec);
129 end if;
130
131 /*Added for parallelism start */
132 if (p_total_requests > 1) then
133
134 begin
135
136 select nvl(sum(decode(status,'UNASSIGNED', 1, 0)),0),
137 nvl(sum(decode(status,'FAILED', 1, 0)),0),
138 nvl(sum(decode(status,'IN PROCESS', 1, 0)),0),
139 nvl(sum(decode(status,'COMPLETED',1 , 0)),0),
140 count(*)
141 into l_unassigned_cnt,
142 l_failed_cnt,
143 l_wip_cnt,
144 l_completed_cnt,
145 l_total_cnt
146 from fa_worker_jobs
147 where request_id = p_parent_request_id;
148 exception
149 when others then
150 raise fapadj_err;
151 end;
152 if g_log_level_rec.statement_level then
153 fa_debug_pkg.add(l_calling_fn, 'Job status - Unassigned: ', l_unassigned_cnt, p_log_level_rec => g_log_level_rec);
154 fa_debug_pkg.add(l_calling_fn, 'Job status - In Process: ', l_wip_cnt, p_log_level_rec => g_log_level_rec);
155 fa_debug_pkg.add(l_calling_fn, 'Job status - Completed: ', l_completed_cnt, p_log_level_rec => g_log_level_rec);
156 fa_debug_pkg.add(l_calling_fn, 'Job status - Failed: ', l_failed_cnt, p_log_level_rec => g_log_level_rec);
157 fa_debug_pkg.add(l_calling_fn, 'Job status - Total: ', l_total_cnt, p_log_level_rec => g_log_level_rec);
158 fa_debug_pkg.add(l_calling_fn, 'Job status - p_parent_request_id ', p_parent_request_id, p_log_level_rec => g_log_level_rec);
159 end if;
160
161 if (l_failed_cnt > 0) then
162 if g_log_level_rec.statement_level then
163 fa_debug_pkg.add(l_calling_fn, 'another worker has errored out: ', 'stop processing', p_log_level_rec => g_log_level_rec);
164 end if;
165 raise fapadj_err; -- probably not
166 elsif (l_unassigned_cnt = 0) then
167 if g_log_level_rec.statement_level then
168 fa_debug_pkg.add(l_calling_fn, 'no more jobs left', 'terminating.', p_log_level_rec => g_log_level_rec);
169 end if;
170 raise done_exc;
171 elsif (l_completed_cnt = l_total_cnt) then
172 if g_log_level_rec.statement_level then
173 fa_debug_pkg.add(l_calling_fn, 'all jobs completed, no more jobs. ', 'terminating', p_log_level_rec => g_log_level_rec);
174 end if;
175 raise done_exc;
176 elsif (l_unassigned_cnt > 0) then
177 begin
178
179 update fa_worker_jobs
180 set status = 'IN PROCESS',
181 worker_num = p_request_number
182 where status = 'UNASSIGNED'
183 and request_id = p_parent_request_id
184 and rownum < 2;
185
186 l_counter := sql%rowcount;
187
188 if g_log_level_rec.statement_level then
189 fa_debug_pkg.add(l_calling_fn, 'taking job from job queue', l_counter, p_log_level_rec => g_log_level_rec);
190 end if;
191
192 commit;
193 exception
194 when others then
195 fa_debug_pkg.add(l_calling_fn, 'exception ', ' raised', p_log_level_rec => g_log_level_rec);
196 raise fapadj_err;
197 end;
198
199
200 x_worker_jobs := l_unassigned_cnt;
201
202 end if;
203 end if; -- if (p_total_requests > 1) then
204
205 /*end parallelism*/
206
207 if (l_counter > 0 or p_total_requests < 2) then
208 begin
209
210 select start_range
211 ,end_range
212 into l_start_range
213 ,l_end_range
214 from fa_worker_jobs
215 where request_id = p_parent_request_id
216 and worker_num = p_request_number
217 and status = 'IN PROCESS';
218
219 exception
220
221 when no_data_found then
222
223 select min(asset_id), max(asset_id)
224 into l_start_range
225 , l_end_range
226 from fa_adjustments_t fat
227 , fa_additions_b fab
228 where batch_id = p_batch_id
229 and fat.asset_number = fab.asset_number;
230
231 when others then
232 fa_debug_pkg.add(l_calling_fn, 'exception', 'raised', p_log_level_rec => g_log_level_rec);
233 raise fapadj_err;
234 end;
235
236 end if;
237
238 open c_assets;
239 loop
240 fetch c_assets bulk collect
241 into l_itf_rowid ,
242 l_asset_id ,
243 l_asset_number ,
244 l_book_type_code ,
245 l_extended_deprn_flag ,
246 l_extended_deprn_period ,
247 l_posting_status ,
248 l_extended_deprn_limit -- bug 6658280
249 limit l_batch_size;
250
251 -- 7339522 closing the cursor after loop.
252 --close c_assets;
253
254 if (g_log_level_rec.statement_level) then
255 fa_debug_pkg.add(l_calling_fn,'After','Fetching data', p_log_level_rec => g_log_level_rec);
256 end if;
257
258 if l_itf_rowid.count = 0 then
259 raise done_exc;
260 end if;
261
262 for l_loop_count in 1..l_itf_rowid.count loop
263
264 -- set savepoint
265 savepoint fapadj_savepoint;
266
267 -- clear the debug stack for each asset
268 FA_DEBUG_PKG.initialize;
269 -- reset the message level to prevent bogus errors
270 FA_SRVR_MSG.Set_Message_Level(message_level => 10, p_log_level_rec => g_log_level_rec);
271
272 l_mesg_name := null;
273 fa_srvr_msg.add_message(
274 calling_fn => NULL,
275 name => 'FA_SHARED_ASSET_NUMBER',
276 token1 => 'NUMBER',
277 value1 => l_asset_number(l_loop_count));
278
279 if (nvl(l_extended_deprn_flag(l_loop_count), 'NULL') <> 'Y' and
280 nvl(p_old_flag, 'NULL') <> 'Y') then
281
282 if(nvl(l_posting_status(l_loop_count),'NULL') <> 'POST') then
283 update fa_adjustments_t
284 set request_id = l_request_id
285 where rowid = l_itf_rowid(l_loop_count);
286
287 else
288 if(nvl(l_extended_deprn_flag(l_loop_count),'NULL') <> 'NULL' or
289 nvl(l_extended_deprn_flag(l_loop_count),'NULL') <> nvl(p_old_flag,'NULL')) then
290 update fa_books
291 set extended_deprn_flag = l_extended_deprn_flag(l_loop_count)
292 where asset_id = l_asset_id(l_loop_count)
293 and book_type_code = l_book_type_code(l_loop_count)
294 and transaction_header_id_out is null;
295 end if;
296 update fa_adjustments_t
297 set posting_status = 'POSTED'
298 , request_id = l_request_id
299 where rowid = l_itf_rowid(l_loop_count);
300 end if;
301
302 -- Increment asset count and dump asset_number to the log file
303 x_success_count := x_success_count + 1;
304 write_message(l_asset_number(l_loop_count),'FA_MCP_ADJUSTMENT_SUCCESS');
305
306 if (g_log_level_rec.statement_level) then
307 fa_debug_pkg.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
308 end if;
309
310 else
311 if(nvl(l_posting_status(l_loop_count),'NULL') <> 'POST' or
312 nvl(l_extended_deprn_flag(l_loop_count),'NULL') = 'NULL' or
313 nvl(l_extended_deprn_flag(l_loop_count),'NULL') = nvl(p_old_flag,'NULL')) then
314 update fa_adjustments_t
315 set request_id = l_request_id
316 where rowid = l_itf_rowid(l_loop_count);
317 else
318
319 BEGIN
320
321 -- reset the structs to null
322 l_trans_rec := NULL;
323 l_asset_hdr_rec := NULL;
324 l_asset_fin_rec_adj := NULL;
325 l_asset_fin_rec_new := NULL;
326 l_asset_fin_mrc_tbl_new.delete;
327 l_inv_trans_rec := NULL;
328 l_inv_tbl.delete;
329 l_asset_deprn_rec_adj := NULL;
330 l_asset_deprn_rec_new := NULL;
331 l_asset_deprn_mrc_tbl_new.delete;
332
333 -- reset the who info in trans rec
334 l_trans_rec.who_info.last_updated_by := FND_GLOBAL.USER_ID;
335 l_trans_rec.who_info.created_by := FND_GLOBAL.USER_ID;
336 l_trans_rec.who_info.creation_date := sysdate;
337 l_trans_rec.who_info.last_update_date := sysdate;
338 l_trans_rec.who_info.last_update_login := FND_GLOBAL.CONC_LOGIN_ID;
339 l_trans_rec.mass_reference_id := p_parent_request_id;
340 l_trans_rec.calling_interface := 'FAXADJ';
341
342 -- counter for the number of assets
343 l_count := l_count + 1;
344
345 -- asset header info
346 l_asset_hdr_rec.asset_id := l_asset_id(l_loop_count);
347 l_asset_hdr_rec.book_type_code := l_book_type_code(l_loop_count);
348
349 -- asset fin info
350 l_asset_fin_rec_adj.extended_deprn_flag := nvl(l_extended_deprn_flag(l_loop_count), FND_API.G_MISS_CHAR);
351 l_asset_fin_rec_adj.extended_depreciation_period := l_extended_deprn_period(l_loop_count);
352 -- bug6658280 incase the extended_deprn_limit is null then give it a default value of 1
353 l_asset_fin_rec_adj.allowed_deprn_limit_amount := nvl(l_extended_deprn_limit(l_loop_count),1);
354
355
356 -- asset transaction info
357 l_trans_rec.calling_interface := 'FAEXDEPR';
358 l_trans_rec.transaction_subtype := 'EXPENSED';
359 l_trans_rec.amortization_start_date := null;
360
361 if l_trans_rec.amortization_start_date is not null then
362 l_trans_rec.transaction_date_entered := l_trans_rec.amortization_start_date;
363 end if;
364
365 l_trans_rec.who_info.last_updated_by := FND_GLOBAL.USER_ID;
366 l_trans_rec.transaction_type_code := 'ADJUSTMENT';
367
368 -- set up other needed struct values
369 l_trans_rec.mass_reference_id := l_request_id;
370
371 -- perform the Adjustment
372 fa_adjustment_pub.do_adjustment
373 (p_api_version => 1.0,
374 p_init_msg_list => FND_API.G_FALSE,
375 p_commit => FND_API.G_FALSE,
376 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
377 x_return_status => l_return_status,
378 x_msg_count => l_mesg_count,
379 x_msg_data => l_mesg,
380 p_calling_fn => l_calling_fn,
381 px_trans_rec => l_trans_rec,
382 px_asset_hdr_rec => l_asset_hdr_rec,
383 p_asset_fin_rec_adj => l_asset_fin_rec_adj,
384 x_asset_fin_rec_new => l_asset_fin_rec_new,
385 x_asset_fin_mrc_tbl_new => l_asset_fin_mrc_tbl_new,
386 px_inv_trans_rec => l_inv_trans_rec,
387 px_inv_tbl => l_inv_tbl,
388 p_asset_deprn_rec_adj => l_asset_deprn_rec_adj,
389 x_asset_deprn_rec_new => l_asset_deprn_rec_new,
390 x_asset_deprn_mrc_tbl_new => l_asset_deprn_mrc_tbl_new,
391 p_group_reclass_options_rec => l_group_reclass_options_rec
392 );
393
394 if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
395 raise data_error;
396 end if;
397
398 -- flag interface record as posted
399 update fa_adjustments_t
400 set posting_status = 'POSTED',
401 request_id = l_request_id
402 where rowid = l_itf_rowid(l_loop_count);
403
404 -- Increment asset count and dump asset_number to the log file
405 x_success_count := x_success_count + 1;
406 write_message(l_asset_number(l_loop_count),'FA_MCP_ADJUSTMENT_SUCCESS');
407
408 if (g_log_level_rec.statement_level) then
409 fa_debug_pkg.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
410 end if;
411
412
413 EXCEPTION -- exceptions
414
415 when data_error then
416 x_failure_count := x_failure_count + 1;
417
418 write_message(l_asset_number(l_loop_count),l_mesg_name);
419
420 if (g_log_level_rec.statement_level) then
421 fa_debug_pkg.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
422 end if;
423
424 rollback to savepoint fapadj_savepoint;
425
426 when others then
427 x_failure_count := x_failure_count + 1;
428
429 write_message(l_asset_number(l_loop_count),'FA_TAXUP_FAIL_TRX');
430 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => g_log_level_rec);
431
432 if (g_log_level_rec.statement_level) then
433 fa_debug_pkg.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
434 end if;
435
436 rollback to savepoint fapadj_savepoint;
437
438 END; -- end
439 end if;
440 end if;
441
442 -- commit every batch and reset the large rollback segment
443 COMMIT WORK;
444
445 end loop; -- inner loop to loop through arrays
446
447 --7339522 Exiting when No of records fetched < limit i.e. no more records are to fetched
448
449 EXIT WHEN l_itf_rowid.COUNT < l_batch_size;
450 end loop;
451 close c_assets;
452
453 --7339522 Closing the cursor here instead of closing it in starting
454
455 -- px_max_asset_id := l_asset_id(l_asset_id.count);
456
457 if (p_total_requests > 1) then
458
459 if (x_failure_count <> 0) then
460
461 update fa_worker_jobs
462 set status = 'FAILED'
463 where request_id = p_parent_request_id
464 and worker_num = p_request_number
465 and status = 'IN PROCESS';
466
467 commit;
468 else
469 update fa_worker_jobs
470 set status = 'COMPLETED'
471 where request_id = p_parent_request_id
472 and worker_num = p_request_number
473 and status = 'IN PROCESS';
474
475 commit;
476
477 end if;
478
479
480 if g_log_level_rec.statement_level then
481 fa_debug_pkg.add(l_calling_fn, 'updating', 'worker jobs', p_log_level_rec => g_log_level_rec);
482 end if;
483
484 end if;
485
486 x_return_status := 0;
487
488 EXCEPTION
489 when done_exc then
490
491 if (p_total_requests > 1) then
492
493 update fa_worker_jobs
494 set status = 'COMPLETED'
495 where request_id = p_parent_request_id
496 and worker_num = p_request_number
497 and status = 'IN PROCESS';
498 commit;
499
500 if g_log_level_rec.statement_level then
501 fa_debug_pkg.add(l_calling_fn, 'updating', 'worker jobs', p_log_level_rec => g_log_level_rec);
502 end if;
503 end if;
504
505 x_return_status := 0;
506
507 when fapadj_err then
508
509 if (p_total_requests > 1) then
510
511 update fa_worker_jobs
512 set status = 'FAILED'
513 where request_id = p_parent_request_id
514 and worker_num = p_request_number
515 and status = 'IN PROCESS';
516 commit;
517
518 if g_log_level_rec.statement_level then
519 fa_debug_pkg.add(l_calling_fn, 'updating', 'worker jobs', p_log_level_rec => g_log_level_rec);
520 end if;
521 end if;
522
523 ROLLBACK WORK;
524 fa_srvr_msg.add_message(calling_fn => l_calling_fn, p_log_level_rec => g_log_level_rec);
525
526 -- Dump Debug messages when run in debug mode to log file
527 if (g_log_level_rec.statement_level) then
528 fa_debug_pkg.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
529 end if;
530
531 x_return_status := 2;
532
533 when others then
534
535 if (p_total_requests > 1) then
536
537 update fa_worker_jobs
538 set status = 'FAILED'
539 where request_id = p_parent_request_id
540 and worker_num = p_request_number
541 and status = 'IN PROCESS';
542 commit;
543
544 if g_log_level_rec.statement_level then
545 fa_debug_pkg.add(l_calling_fn, 'updating', 'worker jobs', p_log_level_rec => g_log_level_rec);
546 end if;
547 end if;
548
549 ROLLBACK WORK;
550 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => g_log_level_rec);
551
552 -- Dump Debug messages when run in debug mode to log file
553 if (g_log_level_rec.statement_level) then
554 fa_debug_pkg.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
555 end if;
556
557 x_return_status := 2;
558
559 END faxadji; -- end
560
561 -----------------------------------------------------------------------------
562
563 PROCEDURE write_message
564 (p_asset_number in varchar2,
565 p_message in varchar2) IS
566
567 l_message varchar2(30);
568 l_mesg varchar2(100);
569 l_string varchar2(512);
570 l_calling_fn varchar2(40); -- condiajitfonally populated below
571
572 BEGIN
573
574 -- first dump the message to the output file
575 -- set/translate/retrieve the mesg from fnd
576
577 l_message := nvl(p_message, 'FA_TAXUP_FAIL_TRX');
578
579 if (l_message <> 'FA_MCP_ADJUSTMENT_SUCCESS') then
580 l_calling_fn := 'fa_masschg_pkg.do_mass_change';
581 end if;
582
583 fnd_message.set_name('OFA', l_message);
584 l_mesg := substrb(fnd_message.get, 1, 100);
585
586 l_string := rpad(p_asset_number, 15) || ' ' || l_mesg;
587
588 FND_FILE.put(FND_FILE.output,l_string);
589 FND_FILE.new_line(FND_FILE.output,1);
590
591 -- now process the messages for the log file
592 fa_srvr_msg.add_message
593 (calling_fn => l_calling_fn,
594 name => l_message, p_log_level_rec => g_log_level_rec);
595
596 EXCEPTION
597 when others then
598 raise;
599
600 END write_message;
601 -----------------------------------------------------------------------------
602 PROCEDURE Load_Workers(
603 p_batch_id IN NUMBER,
604 p_parent_request_id IN NUMBER,
605 p_total_requests IN NUMBER,
606 x_return_status OUT NOCOPY NUMBER) IS
607
608 l_batch_size number;
609 l_calling_fn varchar2(60) := 'FA_XADJ_ITF_PKG.Load_Workers';
610 error_found exception;
611
612 BEGIN
613
614
615 if (not g_log_level_rec.initialized) then
616 if (NOT fa_util_pub.get_log_level_rec (
617 x_log_level_rec => g_log_level_rec
618 )) then
619 raise FND_API.G_EXC_ERROR;
620 end if;
621 end if;
622
623 l_batch_size := nvl(fa_cache_pkg.fa_batch_size, 1000);
624
625 if (p_total_requests > 1) then
626
627 insert into fa_worker_jobs
628 (start_range, end_range, worker_num, status,request_id)
629 select min(aid), max(aid), 0,
630 'UNASSIGNED', p_parent_request_id from ( select /*+ parallel(dh) */
631 fab.asset_id aid, floor(rank()
632 over (order by fab.asset_id)/l_batch_size ) unit_id
633 from fa_adjustments_t fat, fa_additions_b fab
634 where batch_id = p_batch_id
635 and fat.asset_number = fab.asset_number)
636 group by unit_id;
637
638 commit;
639 end if;
640
641 if g_log_level_rec.statement_level then
642 fa_debug_pkg.add(l_calling_fn, 'rows inserted into worker jobs: ', SQL%ROWCOUNT);
643 end if;
644
645 x_return_status := 0;
646
647 EXCEPTION
648 when error_found then
649 x_return_status := 2;
650
651 when OTHERS then
652 fa_srvr_msg.add_sql_error(calling_fn => 'FA_XADJ_ITF_PKG.Load_Workers', p_log_level_rec => g_log_level_rec);
653 rollback;
654 if (g_log_level_rec.statement_level) then
655 fa_debug_pkg.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
656 end if;
657 x_return_status := 2;
658
659 END Load_Workers;
660
661 END FA_XADJ_ITF_PKG;