[Home] [Help]
PACKAGE BODY: APPS.FND_MLS_REQUEST
Source
1 package body FND_MLS_REQUEST as
2 /* $Header: AFMLSUBB.pls 120.8 2008/05/22 19:10:40 jtoruno ship $ */
3
4
5
6 /*
7 ** GEN_ERROR (Internal)
8 **
9 ** Return error message for unexpected sql errors
10 */
11 function GEN_ERROR(routine in varchar2,
12 errcode in number,
13 errmsg in varchar2) return varchar2 is
14 begin
15 fnd_message.set_name('FND', 'SQL_PLSQL_ERROR');
16 fnd_message.set_token('ROUTINE', routine);
17 fnd_message.set_token('ERRNO', errcode);
18 fnd_message.set_token('REASON', errmsg);
19 return substr( fnd_message.get, 1, 240);
20 end;
21
22 /*
23 ** FNDMLSUB
24 **
25 ** MLS master program.
26 **
27 */
28 procedure FNDMLSUB (errbuf out nocopy varchar2,
29 retcode out nocopy number,
30 appl_id in number,
31 prog_id in number,
32 use_func in varchar2 default 'N') is
33
34 cursor run_req_info(appl_id number, prog_id number, parent_id number) is
35 select a.application_short_name,
36 cp.concurrent_program_name,
37 r.request_set_program_id,
38 r.application_id,
39 r.concurrent_program_id,
40 r.number_of_copies,
41 r.printer,
42 r.print_style,
43 r.save_output_flag,
44 argument1, argument2, argument3, argument4, argument5,
45 argument6, argument7, argument8, argument9, argument10,
46 argument11, argument12, argument13, argument14, argument15,
47 argument16, argument17, argument18, argument19, argument20,
48 argument21, argument22, argument23, argument24, argument25,
49 argument26, argument27, argument28, argument29, argument30,
50 argument31, argument32, argument33, argument34, argument35,
51 argument36, argument37, argument38, argument39, argument40,
52 argument41, argument42, argument43, argument44, argument45,
53 argument46, argument47, argument48, argument49, argument50,
54 argument51, argument52, argument53, argument54, argument55,
55 argument56, argument57, argument58, argument59, argument60,
56 argument61, argument62, argument63, argument64, argument65,
57 argument66, argument67, argument68, argument69, argument70,
58 argument71, argument72, argument73, argument74, argument75,
59 argument76, argument77, argument78, argument79, argument80,
60 argument81, argument82, argument83, argument84, argument85,
61 argument86, argument87, argument88, argument89, argument90,
62 argument91, argument92, argument93, argument94, argument95,
63 argument96, argument97, argument98, argument99, argument100,
64 r.org_id
65 from fnd_run_requests r,
66 fnd_concurrent_programs cp, fnd_application a
67 where r.parent_request_id = parent_id
68 and a.application_id = r.application_id
69 and cp.application_id = r.application_id
70 and cp.concurrent_program_id = r.concurrent_program_id
71 order by r.request_set_program_id;
72
73 cursor mls_requests( parent_req_id number ) is
74 select nls_language, nls_territory, numeric_characters
75 from fnd_run_req_languages
76 where parent_request_id = parent_req_id;
77
78 cursor mls_req_printers(parent_req_id number,
79 set_program_id number,
80 language varchar2) is
81 select arguments printer, number_of_copies
82 from fnd_run_req_pp_actions
83 where parent_request_id = parent_req_id
84 and request_set_program_id = set_program_id
85 and action_type = 1
86 and (nls_language = language
87 or nls_language is null)
88 order by sequence;
89
90 cursor mls_req_notifications(parent_req_id number,
91 set_program_id number,
92 language varchar2) is
93 select arguments notify
94 from fnd_run_req_pp_actions
95 where parent_request_id = parent_req_id
96 and request_set_program_id = set_program_id
97 and action_type = 2
98 and (nls_language = language
99 or nls_language is null)
100 order by sequence;
101
102 cursor mls_req_layouts(parent_req_id number,
103 set_program_id number,
104 language varchar2) is
105 select argument1, argument2, argument3, argument4, argument5
106 from fnd_run_req_pp_actions
107 where parent_request_id = parent_req_id
108 and request_set_program_id = set_program_id
109 and action_type = 6
110 and (nls_language = language
111 or nls_language is null)
112 order by sequence;
113
114 cursor mls_function_req_layouts(parent_req_id number,
115 set_program_id number) is
116 select argument1, argument2, argument5
117 from fnd_run_req_pp_actions
118 where parent_request_id = parent_req_id
119 and request_set_program_id = set_program_id
120 and action_type = 6
121 order by sequence;
122
123 TYPE lang_record_type is record
124 (lang_code varchar2(4),
125 terr_code varchar2(4),
126 nc_code varchar2(2),
127 nls_language varchar2(30),
128 nls_territory varchar2(30),
129 numeric_characters varchar2(2));
130
131 TYPE lang_tab_type is table of lang_record_type
132 index by binary_integer;
133
134 TYPE req_record_type is record
135 ( req_id number(15));
136
137 TYPE req_tab_type is table of req_record_type
138 index by binary_integer;
139
140 P_LANG lang_tab_type;
141 P_REQ req_tab_type;
142
143 req_id number;
144 error boolean default FALSE;
145 req_data varchar2(240); /* State of last FNDMLSUB run. */
146 has_reqs boolean default FALSE;
147 funct varchar2(61); /* Function string */
148 fcursor varchar2(75); /* Cursor string for dbms_sql */
149 cid number; /* Cursor ID for dbms_sql */
150 dummy number;
151 printer varchar2(30);
152 copies number;
153 parent_id number;
154 func_outcome varchar2(240) := '';
155 function_id number;
156 function_appl_id number;
157 nls_comp varchar2(1);
158 P_LCOUNT number;
159 endloc number;
160 endloc1 number;
161 endloc2 number;
162 startloc number;
163 chkstrloc number;
164 i number;
165 current_outcome varchar2(1);
166 request_error boolean := FALSE;
167 request_warning boolean := FALSE;
168 outcome_meaning varchar2(240);
169 req_info_line varchar2(100) := '';
170 UserProgramName varchar2(240); /* Concurrent Program associated with the request */
171 /* xml project */
172 t_app_name varchar2(50);
173 t_code varchar2(80);
174 t_language varchar2(2);
175 t_territory varchar2(2);
176 t_format varchar2(6);
177
178 parent_nls_lang varchar2(30);
179 parent_nls_terr varchar2(30);
180 parent_nls_char varchar2(2);
181
182 begin
183 /* if use language function then get list of languages from that function
184 and submit the requests for those languages */
185
186 P_LCOUNT := 0;
187 parent_id := fnd_global.conc_request_id;
188
189 /* Get state from last run if any. */
190 req_data := fnd_conc_global.request_data;
191
192 /* Is this the first run? */
193 if (req_data is null) then
194 /*
195 * CODE FOLDED : Begining
196 */
197
198 if ( use_func = 'Y') then
199 /* Get function for program if any.
200 * Also, set up function globals.
201 */
202 begin
203 select execution_file_name,
204 p.mls_executable_id, p.mls_executable_app_id,
205 p.nls_compliant, P.User_Concurrent_Program_Name
206 into funct,
207 function_id, function_appl_id,
208 nls_comp, UserProgramName
209 from fnd_concurrent_programs_vl p, fnd_executables e
210 where p.application_id = appl_id
211 and p.concurrent_program_id = prog_id
212 and e.executable_id(+) = p.mls_executable_id
213 and e.application_id(+) = p.mls_executable_app_id;
214
215 exception
216 when NO_DATA_FOUND then
217 fnd_message.set_name('FND','CONC-Missing program');
218 errbuf := substr(fnd_message.get,1, 240);
219 retcode := 2;
220 return;
221 end;
222
223
224 /* Initialize the request information to access by the language function
225 */
226 fnd_request_info.initialize;
227
228 fnd_file.put_line(fnd_file.log,
229 '+---------------------------------------------------------------------------+');
230 fnd_message.set_name('FND', 'CONC-Before lang function');
231 fnd_message.set_token('FUNCTION', funct);
232 fnd_file.put_line(fnd_file.log, fnd_message.get || ' : ' ||
233 to_char(sysdate,'DD-MON-YYYY HH24:MI:SS'));
234
235 fcursor := 'begin :r := '||funct||'; end;';
236 begin
237 cid := dbms_sql.open_cursor;
238 dbms_sql.parse(cid, fcursor, dbms_sql.v7);
239 dbms_sql.bind_variable(cid, ':r', func_outcome, 240);
240 dummy := dbms_sql.execute(cid);
241 dbms_sql.variable_value(cid, ':r', func_outcome);
242 dbms_sql.close_cursor(cid);
243 exception
244 when others then
245 errbuf := gen_error(funct, SQLCODE, SQLERRM);
246 retcode := 2;
247 return;
248 end;
249
250 fnd_message.set_name('FND', 'CONC-After lang function');
251 fnd_message.set_token('VALUE', func_outcome );
252
253 fnd_file.put_line(fnd_file.log, fnd_message.get || ' : ' ||
254 to_char(sysdate,'DD-MON-YYYY HH24:MI:SS'));
255 fnd_file.put_line(fnd_file.log,
256 '+---------------------------------------------------------------------------+');
257
258 /* Parse func_outcome to get nls_languages */
259 startloc := 1;
260 endloc := 1;
261 P_LCOUNT := 0;
262
263 -- Fix for BUG 1207108
264 -- Language function associated with [PROGRAM] determined no data exists
265 -- for the given set of parameters
266
267 if (func_outcome is null ) then
268 fnd_file.put_line(fnd_file.log, fnd_message.get);
269 fnd_message.set_name('FND', 'CONC-MLS no data');
270 fnd_message.set_token('PROGRAM', UserProgramName);
271 errbuf := substr(fnd_message.get, 1, 240);
272 retcode := 1;
273 return;
274 end if;
275
276 -- 12.1 NEW MLS Function Str with optional territory and num char
277 chkstrloc := instr( func_outcome, ':', 1 );
278
279 if ( chkstrloc = 0 ) then
280 -- Process for original MLS Functionality for lang code only
281 if ( func_outcome is not null ) then
282 loop
283 endloc := instr( func_outcome, ',', startloc );
284 P_LCOUNT := P_LCOUNT + 1;
285 if ( endloc = 0 ) then
286 P_LANG(P_LCOUNT).lang_code := LTRIM(RTRIM( substr( func_outcome, startloc,
287 length(func_outcome) -
288 startloc + 1
289 )
290 )
291 );
292 P_LANG(P_LCOUNT).terr_code := null;
293 P_LANG(P_LCOUNT).nc_code := null;
294 exit;
295 else
296 P_LANG(P_LCOUNT).lang_code := LTRIM(RTRIM( substr( func_outcome, startloc,
297 endloc - startloc
298 )
299 )
300 );
301 P_LANG(P_LCOUNT).terr_code := null;
302 P_LANG(P_LCOUNT).nc_code := null;
303 end if;
304 startloc := endloc + 1;
305 end loop;
306 end if;
307 else
308
309 -- Process for MLS Functionality for lang code with
310 -- optional territory and numeric characters
311 loop
312 endloc := instr( func_outcome, ';', startloc );
313 P_LCOUNT := P_LCOUNT + 1;
314 if ( endloc = 0 ) then
315 endloc1 := instr( func_outcome, ':', startloc );
316 P_LANG(P_LCOUNT).lang_code :=
317 LTRIM(RTRIM( substr( func_outcome, startloc, endloc1 - startloc) ));
318
319 endloc2 := instr( func_outcome, ':', endloc1 + 1 );
320 P_LANG(P_LCOUNT).terr_code :=
321 LTRIM(RTRIM( substr( func_outcome, endloc1 + 1, endloc2 - (endloc1 + 1) )));
322
323 P_LANG(P_LCOUNT).nc_code :=
324 LTRIM(RTRIM( substr( func_outcome, endloc2 + 1, length(func_outcome) - endloc2 + 1 )));
325 exit;
326 else
327 endloc1 := instr( func_outcome, ':', startloc );
328 P_LANG(P_LCOUNT).lang_code :=
329 LTRIM(RTRIM( substr( func_outcome, startloc, endloc1 - startloc) ));
330
331 endloc2 := instr( func_outcome, ':', endloc1 + 1 );
332 P_LANG(P_LCOUNT).terr_code :=
333 LTRIM(RTRIM( substr( func_outcome, endloc1 + 1, endloc2 - (endloc1 + 1) )));
334
335 P_LANG(P_LCOUNT).nc_code :=
336 LTRIM(RTRIM( substr( func_outcome, endloc2 + 1, endloc - (endloc2 + 1) )));
337 end if;
338 startloc := endloc + 1;
339 end loop;
340 end if;
341
342 /* select lang, terr, num char from parent req id */
343 begin
344 select nls_language, nls_territory, nls_numeric_characters
345 into parent_nls_lang, parent_nls_terr, parent_nls_char
346 from fnd_concurrent_requests
347 where request_id = parent_id;
348 exception
349 when NO_DATA_FOUND then
350 fnd_message.set_name('FND','CONC-Missing Request');
351 fnd_message.set_token('ROUTINE', 'FND_MLS_REQUEST.FNDMLSUB');
352 fnd_message.set_token('REQUEST', to_char(parent_id));
353 errbuf := fnd_message.get;
354 retcode := 2;
355 return;
356 end;
357
358 /* get nls_language and nls_territory for each language_code */
359 -- 12.1 NEW MLS Function Str with optional territory and num char
360 -- Use the New Str if present otherwise keep as before
361 for i in 1..P_LCOUNT loop
362 /* if program is nls_compliant then use the default territory from
363 fnd_languages, otherwise use user environment */
364 if ( nls_comp = 'Y' ) then
365 if (chkstrloc = 0 ) then
366 begin
367 select nls_language, nls_territory
368 into P_LANG(i).nls_language, P_LANG(i).nls_territory
369 from fnd_languages
370 where language_code = P_LANG(i).lang_code;
371 exception
372 when no_data_found then
373 fnd_message.set_name('FND', 'CONC-Invalid Language Code');
374 fnd_message.set_token('LANG', P_LANG(i).lang_code);
375 errbuf := substr(fnd_message.get, 1, 240);
376 retcode := 2;
377 return;
378 end;
379 else
380 if ( P_LANG(i).terr_code is NULL ) then
381 begin
382 select nls_language, nls_territory
383 into P_LANG(i).nls_language, P_LANG(i).nls_territory
384 from fnd_languages
385 where language_code = P_LANG(i).lang_code;
386 exception
387 when no_data_found then
388 fnd_message.set_name('FND', 'CONC-Invalid LangTerr Code');
389 fnd_message.set_token('LANG', P_LANG(i).lang_code);
390 fnd_message.set_token('TERR', P_LANG(i).terr_code);
391 errbuf := substr(fnd_message.get, 1, 240);
392 retcode := 2;
393 return;
394 end;
395 else
396 begin
397 select nls_language, b.nls_territory
398 into P_LANG(i).nls_language, P_LANG(i).nls_territory
399 from fnd_languages a, fnd_territories b
400 where language_code = P_LANG(i).lang_code
401 and territory_code = P_LANG(i).terr_code;
402 exception
403 when no_data_found then
404 fnd_message.set_name('FND', 'CONC-Invalid LangTerr Code');
405 fnd_message.set_token('LANG', P_LANG(i).lang_code);
406 fnd_message.set_token('TERR', P_LANG(i).terr_code);
407 errbuf := substr(fnd_message.get, 1, 240);
408 retcode := 2;
409 return;
410 end;
411 end if;
412
413 end if;
414 else
415 /* use territory from the user environment which is parent_id's
416 nls_territory */
417 -- 12.1 NEW MLS Function Str with optional territory and num char
418 -- Use the New Str if present otherwise keep as before
419 begin
420 select nls_language
421 into P_LANG(i).nls_language
422 from fnd_languages
423 where language_code = P_LANG(i).lang_code;
424 exception
425 when no_data_found then
426 fnd_message.set_name('FND', 'CONC-Invalid Language Code');
427 fnd_message.set_token('LANG', P_LANG(i).lang_code);
428 errbuf := substr(fnd_message.get, 1, 240);
429 retcode := 2;
430 return;
431 end;
432
433 if ( chkstrloc = 0 ) then
434 P_LANG(i).nls_territory := fnd_request_info.get_territory;
435 else
436
437 if ( P_LANG(i).terr_code is NULL ) then
438 P_LANG(i).nls_territory := fnd_request_info.get_territory;
439 else
440 begin
441 select nls_territory
442 into P_LANG(i).nls_territory
443 from fnd_territories
444 where territory_code = P_LANG(i).terr_code;
445 exception
446 when no_data_found then
447 fnd_message.set_name('FND', 'CONC-Invalid Territory Code');
448 fnd_message.set_token('TERR', P_LANG(i).terr_code);
449 errbuf := substr(fnd_message.get, 1, 240);
450 retcode := 2;
451 return;
452 end;
453 end if;
454 end if;
455
456 end if;
457
458 -- 12.1 NEW MLS Function Str with optional territory and num char
459 -- Use the New Str if present otherwise keep as before
460 if ( chkstrloc = 0 ) then
461 /* Determine Numeric Character value to use */
462 if (parent_nls_lang = P_LANG(i).nls_language) then
463 P_LANG(i).nls_territory := parent_nls_terr;
464 P_LANG(i).numeric_characters := parent_nls_char;
465 else
466 P_LANG(i).numeric_characters := NULL;
467 end if;
468 else
469 if (parent_nls_lang = P_LANG(i).nls_language) then
470 P_LANG(i).nls_territory := parent_nls_terr;
471 end if;
472 if ( P_LANG(i).nc_code is NULL ) then
473 if (parent_nls_lang = P_LANG(i).nls_language) then
474 P_LANG(i).numeric_characters := parent_nls_char;
475 else
476 P_LANG(i).numeric_characters := NULL;
477 end if;
478 else
479 P_LANG(i).numeric_characters := P_LANG(i).nc_code;
480 end if;
481 end if;
482
483 end loop;
484
485 else /* not using the language function */
486 for req in mls_requests(parent_id) loop
487 P_LCOUNT := P_LCOUNT + 1;
488 P_LANG(P_LCOUNT).nls_language := req.nls_language;
489 P_LANG(P_LCOUNT).nls_territory := req.nls_territory;
490 /* NLS Project - Set the numeric characters */
491 P_LANG(P_LCOUNT).numeric_characters := req.numeric_characters;
492 end loop;
493 end if; /* use_func */
494
495
496 -- 12.1 NEW MLS Function Str with optional territory and num char
497 if ( chkstrloc = 0 ) then
498 fnd_message.set_name('FND', 'CONC-About submitted requests');
499 else
500 fnd_message.set_name('FND', 'CONC-About submitted req full');
501 end if;
502 fnd_file.put_line(fnd_file.log, fnd_message.get);
503
504 /* process all the requests */
505 begin
506 /* using cursor for loop for easy coding. run_req_info will return
507 only one row */
508 for req in run_req_info(appl_id, prog_id, parent_id) loop
509
510 for ind in 1..P_LCOUNT loop
511
512 /* set the language and territory and numeric characters for this request
513 all individual requests are protected against updates */
514 /* NLS Project - added numeric character */
515 if ( not fnd_request.set_options(
516 implicit => 'NO',
517 protected => 'YES',
518 language => P_LANG(ind).nls_language,
519 territory => P_LANG(ind).nls_territory,
520 datagroup => '',
521 numeric_characters => P_LANG(ind).numeric_characters )) then
522 errbuf := substr(fnd_message.get, 1, 240);
523 retcode := 2;
524 rollback;
525 return;
526 end if;
527
528 /* set the print pp actions for this request */
529 open mls_req_printers(parent_id, 0, P_LANG(ind).nls_language);
530
531 fetch mls_req_printers into printer, copies;
532
533 if (mls_req_printers%found) then
534 if (not fnd_request.set_print_options(
535 printer => printer,
536 style => req.print_style,
537 copies => copies,
538 save_output => (req.save_output_flag = 'Y'),
539 print_together => NULL))
540 then
541 errbuf := substr(fnd_message.get, 1, 240);
542 retcode := 2;
543 close mls_req_printers;
544 rollback;
545 return;
546 end if;
547
548 fetch mls_req_printers into printer, copies;
549 while (mls_req_printers%found) loop
550 if (not fnd_request.add_printer(
551 printer => printer,
552 copies => copies)) then
553 errbuf := substr(fnd_message.get, 1, 240);
554 retcode := 2;
555 close mls_req_printers;
556 rollback;
557 return;
558 end if;
559 fetch mls_req_printers into printer, copies;
560 end loop;
561 else
562 if (not fnd_request.set_print_options(
563 printer => null,
564 style => req.print_style,
565 copies => 0,
566 save_output => (req.save_output_flag = 'Y'),
567 print_together => NULL))
568 then
569 errbuf := substr(fnd_message.get, 1, 240);
570 retcode := 2;
571 close mls_req_printers;
572 rollback;
573 return;
574 end if;
575 end if;
576 close mls_req_printers;
577
578 /* set notification pp actions for this request */
579 for notify_rec in mls_req_notifications
580 (parent_id, req.request_set_program_id,
581 P_LANG(ind).nls_language) loop
582 if (not fnd_request.add_notification(
583 user=>notify_rec.notify)) then
584 errbuf := substr(fnd_message.get, 1, 240);
585 retcode := 2;
586 rollback;
587 return;
588 end if;
589 end loop;
590
591 /* Determine if an MLS Function is associated with this prog_id */
592 /* If so, then use iso_language and iso_territory to add to */
593 /* layout for each language that is in the MLS Function. */
594 if (function_id is not NULL) then
595 open mls_function_req_layouts(parent_id, 0);
596 fetch mls_function_req_layouts into t_app_name,
597 t_code,
598 t_format;
599
600 /* Change the language and terr */
601 select iso_language, iso_territory
602 into t_language, t_territory
603 from fnd_languages
604 where nls_language = P_LANG(ind).nls_language;
605
606 -- 12.1 NEW MLS Function Str with optional territory and num char
607 if ( chkstrloc > 0 ) then
608 if ( P_LANG(ind).terr_code is NOT NULL ) then
609 begin
610 select nls_territory
611 into P_LANG(ind).nls_territory
612 from fnd_territories
613 where territory_code = P_LANG(ind).terr_code;
614 exception
615 when no_data_found then
616 fnd_message.set_name('FND', 'CONC-Invalid Territory Code');
617 fnd_message.set_token('TERR', P_LANG(ind).terr_code);
618 errbuf := substr(fnd_message.get, 1, 240);
619 retcode := 2;
620 return;
621 end;
622 t_territory := UPPER(P_LANG(ind).terr_code);
623 end if;
624 end if;
625
626 t_language := lower(t_language);
627
628 while (mls_function_req_layouts%found) loop
629 if (not fnd_request.add_layout(
630 t_app_name,
631 t_code,
632 t_language,
633 t_territory,
634 t_format)) then
635 errbuf := substr(fnd_message.get, 1, 240);
636 retcode := 2;
637 close mls_function_req_layouts;
638 rollback;
639 return;
640 end if;
641 fetch mls_function_req_layouts into t_app_name,
642 t_code,
643 t_format;
644 end loop;
645 close mls_function_req_layouts;
646 else
647 /* set the layout pp actions for this request */
648 open mls_req_layouts(parent_id, 0, P_LANG(ind).nls_language);
649
650 fetch mls_req_layouts into t_app_name,
651 t_code,
652 t_language,
653 t_territory,
654 t_format;
655
656 while (mls_req_layouts%found) loop
657 if (not fnd_request.add_layout(
658 t_app_name,
659 t_code,
660 t_language,
661 t_territory,
662 t_format)) then
663 errbuf := substr(fnd_message.get, 1, 240);
664 retcode := 2;
665 close mls_req_layouts;
666 rollback;
667 return;
668 end if;
669 fetch mls_req_layouts into t_app_name,
670 t_code,
671 t_language,
672 t_territory,
673 t_format;
674 end loop;
675 close mls_req_layouts;
676 end if;
677
678 fnd_request.internal(critical => null, type=>'C');
679
680 fnd_request.set_org_id(req.org_id);
681
682 req_id := fnd_request.submit_request(
683 req.application_short_name, req.concurrent_program_name,
684 Null, NULL, TRUE,
685 req.argument1, req.argument2, req.argument3,
686 req.argument4, req.argument5, req.argument6,
687 req.argument7, req.argument8, req.argument9,
688 req.argument10, req.argument11, req.argument12,
689 req.argument13, req.argument14, req.argument15,
690 req.argument16, req.argument17, req.argument18,
691 req.argument19, req.argument20, req.argument21,
692 req.argument22, req.argument23, req.argument24,
693 req.argument25, req.argument26, req.argument27,
694 req.argument28, req.argument29, req.argument30,
695 req.argument31, req.argument32, req.argument33,
696 req.argument34, req.argument35, req.argument36,
697 req.argument37, req.argument38, req.argument39,
698 req.argument40, req.argument41, req.argument42,
699 req.argument43, req.argument44, req.argument45,
700 req.argument46, req.argument47, req.argument48,
701 req.argument49, req.argument50, req.argument51,
702 req.argument52, req.argument53, req.argument54,
703 req.argument55, req.argument56, req.argument57,
704 req.argument58, req.argument59, req.argument60,
705 req.argument61, req.argument62, req.argument63,
706 req.argument64, req.argument65, req.argument66,
707 req.argument67, req.argument68, req.argument69,
708 req.argument70, req.argument71, req.argument72,
709 req.argument73, req.argument74, req.argument75,
710 req.argument76, req.argument77, req.argument78,
711 req.argument79, req.argument80, req.argument81,
712 req.argument82, req.argument83, req.argument84,
713 req.argument85, req.argument86, req.argument87,
714 req.argument88, req.argument89, req.argument90,
715 req.argument91, req.argument92, req.argument93,
716 req.argument94, req.argument95, req.argument96,
717 req.argument97, req.argument98, req.argument99,
718 req.argument100);
719 if (req_id = 0) then
720 errbuf := substr(fnd_message.get, 1, 240);
721 retcode := 2;
722 return;
723 end if;
724 has_reqs := TRUE;
725
726 /* prepare the req_data to be set after submission of all req's */
727 if ( req_data is null ) then
728 req_data := to_char(req_id);
729 else
730 req_data := req_data || ',' || to_char(req_id);
731 end if;
732
733 -- 12.1 NEW MLS Function Str with optional territory and num char
734 /* print the submitted request in log file */
735 if ( chkstrloc = 0 ) then
736 req_info_line := ' ' || RPAD(to_char(req_id),15) || P_LANG(ind).nls_language;
737 else
738 req_info_line := ' ' || RPAD(to_char(req_id),15) || RPAD(P_LANG(ind).nls_language,31)||RPAD(P_LANG(ind).nls_territory,31)||P_LANG(ind).nc_code;
739 end if;
740 fnd_file.put_line(fnd_file.log, req_info_line);
741 end loop;
742
743 end loop; /* run_req_info */
744
745
746 if ( has_reqs = FALSE ) then
747 fnd_message.set_name('FND', 'CONC-MLS has no requests');
748 errbuf := substr(fnd_message.get, 1, 240);
749 retcode := 2;
750 else
751 fnd_conc_global.set_req_globals(
752 conc_status => 'PAUSED',
753 request_data => req_data);
754 end if;
755
756 end;
757
758 /*
759 * CODE FOLDED: ENDS
760 */
761
762 else /* program was restarted */
763
764 P_LCOUNT := 0;
765 startloc := 1;
766 endloc := 1;
767
768 loop
769 endloc := instr( req_data, ',', startloc );
770 P_LCOUNT := P_LCOUNT + 1;
771 if ( endloc = 0 ) then
772 P_REQ(P_LCOUNT).req_id := to_number( substr( req_data, startloc,
773 length(req_data) -
774 startloc + 1
775 )
776 );
777 exit;
778 else
779 P_REQ(P_LCOUNT).req_id := to_number( substr( req_data, startloc,
780 endloc - startloc
781 )
782 );
783 end if;
784 startloc := endloc + 1;
785 end loop;
786
787 /* print the header for completed request status */
788 fnd_message.set_name('FND', 'CONC-About completed requests');
789 fnd_file.put_line(fnd_file.log, fnd_message.get);
790
791 for ind in 1..P_LCOUNT loop
792 begin
793 select decode(status_code, 'C', 'S', 'G', 'W', 'E')
794 into current_outcome
795 from fnd_concurrent_requests
796 where request_id = P_REQ(ind).req_id;
797
798 if ( current_outcome = 'E' ) then
799 request_error := TRUE;
800 elsif ( current_outcome = 'W' ) then
801 request_warning := TRUE;
802 end if;
803
804 exception
805 when NO_DATA_FOUND then
806 fnd_message.set_name('FND','CONC-Missing Request');
807 fnd_message.set_token('ROUTINE', 'FND_MLS_REQUEST.FNDMLSUB');
808 fnd_message.set_token('REQUEST', to_char(P_REQ(ind).req_id));
809 errbuf := fnd_message.get;
810 retcode := 2;
811 return;
812 end;
813
814 select meaning
815 into outcome_meaning
816 from fnd_lookups
817 where lookup_type = 'CP_SET_OUTCOME'
818 and lookup_code = current_outcome;
819
820 req_info_line := ' '||RPAD(to_char(P_REQ(ind).req_id),15) || outcome_meaning;
821 fnd_file.put_line(fnd_file.log, req_info_line);
822
823 end loop;
824
825 if ( request_error ) then
826 retcode := 2;
827 elsif ( request_warning ) then
828 retcode := 1;
829 else
830 retcode := 0;
831 end if;
832
833 /* Get final outcome meaning */
834 select meaning
835 into outcome_meaning
836 from fnd_lookups
837 where lookup_type = 'CP_SET_OUTCOME'
838 and lookup_code = decode(retcode,2,'E',1,'W','S');
839
840 fnd_message.set_name('FND', 'CONC-mls Completed');
841 fnd_message.set_token('OUTCOME', outcome_meaning);
842 errbuf := substr(fnd_message.get, 1, 240);
843
844 end if; /* req_data */
845
846 end FNDMLSUB;
847
848
849
850 function standard_languages return varchar2 is
851 cursor langs_c is
852 select language_code
853 from fnd_languages
854 where installed_flag in ('B','I')
855 order by language_id;
856 lang_str varchar2(240);
857 ret_val varchar2(240);
858 begin
859 lang_str := null;
860
861 for langs in langs_c loop
862 select concat ( lang_str, langs.language_code || ',')
863 into lang_str
864 from dual;
865 end loop;
866
867 if ( length( lang_str) > 0) then
868 ret_val := substr(lang_str, 1, length(lang_str) - 1);
869 else
870 ret_val := null;
871 end if;
872
873 return (ret_val);
874
875 end;
876
877
878 end FND_MLS_REQUEST;