1 PACKAGE BODY CST_START_IMP_PROCESS as
2 /* $Header: CSTSIMPB.pls 115.4 2002/11/11 22:57:00 awwang ship $ */
3
4 PROCEDURE Start_process(ERRBUF OUT NOCOPY VARCHAR2,
5 RETCODE OUT NOCOPY NUMBER,
6 i_option IN NUMBER,
7 i_run_option IN NUMBER,
8 i_group_option IN NUMBER,
9 i_group_dummy IN VARCHAR2,
10 i_next_val IN VARCHAR2,
11 i_cost_type IN VARCHAR2,
12 i_del_option IN NUMBER
13 ) as
14 i_opt NUMBER;
15 i_count NUMBER := 0;
16 l_next_val VARCHAR2(20);
17 CONC_STATUS BOOLEAN;
18 Error_number NUMBER := 0;
19 l_min_reqid NUMBER;
20 l_grp_id NUMBER;
21 l_req_arg VARCHAR2(20);
22 CST_ERROR_EXCEPTION EXCEPTION;
23 BEGIN
24 i_opt := 5;
25
26 l_next_val := i_next_val;
27
28 fnd_file.put_line(fnd_file.log,'---------------------------------------------');
29 fnd_file.put_line(fnd_file.log,'Option to import : ' || to_char(i_option));
30 fnd_file.put_line(fnd_file.log,'Mode to run : ' || to_char(i_run_option));
31 fnd_file.put_line(fnd_file.log,'Group ID option : ' || to_char(i_group_option));
32 fnd_file.put_line(fnd_file.log,'Group ID selected: ' || i_next_val);
33 fnd_file.put_line(fnd_file.log,'Cost type : '|| i_cost_type);
34 fnd_file.put_line(fnd_file.log,'Delete option : ' || to_char (i_del_option));
35 fnd_file.put_line(fnd_file.log,'---------------------------------------------');
36
37 /*check first to see if there is another request running with similar parameters */
38
39 select FCR.argument5 into l_req_arg
40 from FND_CONCURRENT_REQUESTS FCR
41 WHERE FCR.concurrent_program_id = FND_GLOBAL.CONC_PROGRAM_ID
42 AND FCR.program_application_id = FND_GLOBAL.PROG_APPL_ID
43 AND FCR.request_id = FND_GLOBAL.CONC_REQUEST_ID;
44
45 select min(FCR.request_id) into l_min_reqid
46 from FND_CONCURRENT_REQUESTS FCR
47 WHERE FCR.concurrent_program_id = FND_GLOBAL.CONC_PROGRAM_ID
48 AND FCR.program_application_id = FND_GLOBAL.PROG_APPL_ID
49 AND FCR.phase_code <> 'C'
50 AND ((NVL(FCR.argument5,'X') = NVL(l_req_arg,'X'))
51 OR (FCR.argument5 is null)
52 OR (l_req_arg is null));
53
54 if (NVL(l_min_reqid,FND_GLOBAL.CONC_REQUEST_ID) <> FND_GLOBAL.CONC_REQUEST_ID) then
55 fnd_file.put_line(fnd_file.log,fnd_message.get_string('BOM','CST_REQ_ERROR'));
56 CONC_STATUS := fnd_concurrent.set_completion_status('ERROR',substr(fnd_message.get_string('BOM','CST_REQ_ERROR'),1,240));
57 return;
58 end if;
59
60
61 /* check if the specific group ID has been sent in or null(ALL) has been sent in*/
62
63 If l_next_val is null then
64 select CST_LISTS_S.NEXTVAL into l_grp_id
65 from dual;
66 else
67 l_grp_id := to_number(l_next_val);
68 end if;
69
70 fnd_file.put_line(fnd_file.log,'---------------------------------------------');
71
72 fnd_file.put_line(fnd_file.log,'Group ID selected: ' || l_grp_id);
73
74 fnd_file.put_line(fnd_file.log,'---------------------------------------------');
75
76 fnd_file.put_line(fnd_file.log,'Start time: ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'));
77
78 IF i_option = 1 then
79 CST_ITEM_COST_IMPORT_INTERFACE.Start_item_cost_import_process(Error_number,l_next_val,l_grp_id,i_del_option,i_cost_type,i_run_option);
80
81 ELSIF i_option = 2 then
82 CST_RES_COST_IMPORT_INTERFACE.Start_res_cost_import_process(Error_number,l_next_val,l_grp_id,i_cost_type,i_del_option,i_run_option);
83
84 ELSIF i_option = 3 then
85 CST_OVHD_RATE_IMPORT_INTERFACE.Start_process(Error_number,i_cost_type,l_next_val,l_grp_id,i_del_option,i_run_option);
86
87 ELSIF i_option = 4 then
88 CST_ITEM_COST_IMPORT_INTERFACE.Start_item_cost_import_process(Error_number,l_next_val,l_grp_id,i_del_option,i_cost_type,i_run_option);
89
90 IF Error_number = 1 then
91 fnd_file.put_line(fnd_file.log,'Exception in CST_ITEM_COST_IMPORT_INTERFACE');
92 raise CST_ERROR_EXCEPTION;
93 END IF;
94
95 CST_RES_COST_IMPORT_INTERFACE.Start_res_cost_import_process(Error_number,l_next_val,l_grp_id,i_cost_type,i_del_option,i_run_option);
96
97 IF Error_number = 1 then
98 raise CST_ERROR_EXCEPTION;
99 END IF;
100
101 CST_OVHD_RATE_IMPORT_INTERFACE.Start_process(Error_number,i_cost_type,l_next_val,l_grp_id,i_del_option,i_run_option);
102
103 IF Error_number = 1 then
104 raise CST_ERROR_EXCEPTION;
105 END IF;
106
107 END IF;
108
109 fnd_file.put_line(fnd_file.log,'End date is : ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'));
110
111
112 EXCEPTION
113 When others then
114 rollback;
115 fnd_file.put_line(fnd_file.log,'CST_START_IMP_PROCESS.Start_Process() '|| to_char(SQLCODE) || ','|| substr(SQLERRM,1,180));
116 fnd_file.put_line(fnd_file.log,(fnd_message.get_string('BOM','CST_EXCEPTION_OCCURED')));
117
118
119 END Start_process;
120
121 END CST_START_IMP_PROCESS;