[Home] [Help]
PACKAGE BODY: APPS.ECEPOCI
Source
1 PACKAGE BODY ECEPOCI AS
2 /* $Header: ECPOCIB.pls 120.2.12010000.2 2008/11/24 17:24:13 akemiset ship $ */
3
4 PROCEDURE Process_POCI_Inbound (
5 errbuf OUT NOCOPY varchar2,
6 retcode OUT NOCOPY varchar2,
7 i_file_path IN varchar2,
8 i_file_name IN varchar2,
9 i_debug_mode IN number,
10 i_run_import IN varchar2,
11 i_num_instances IN number default 1,
12 i_transaction_type IN varchar2,
13 i_map_id IN number,
14 i_data_file_characterset IN varchar2
15 -- i_debug_mode IN number
16 -- i_num_instances IN number default 1
17 )
18 IS
19 i_submit_id number;
20 i_run_id number;
21 i_map_type varchar2(40);
22
23 cEnabled VARCHAR2(1) := 'Y';
24 ece_transaction_disabled EXCEPTION;
25
26 begin
27 ec_debug.enable_debug(i_debug_mode);
28 ec_debug.pl(0,'EC','ECE_START_INBOUND','TRANSACTION_TYPE',i_transaction_type);
29 ec_debug.push('ECEPOCI.PROCESS_POCI_INBOUND');
30 ec_debug.pl(3,'i_file_path',i_file_path);
31 ec_debug.pl(3,'i_file_name',i_file_name);
32 ec_debug.pl(3,'i_run_import',i_run_import);
33 ec_debug.pl(3,'i_map_id',i_map_id);
34 ec_debug.pl(3,'i_debug_mode',i_debug_mode);
35 ec_debug.pl(3,'i_num_instances',i_num_instances);
36
37 /* Check to see if the transaction is enabled. If not, abort */
38 fnd_profile.get('ECE_' || i_transaction_type || '_ENABLED',cEnabled);
39 IF cEnabled = 'N' THEN
40 RAISE ece_transaction_disabled;
41 END IF;
42
43 ec_debug.pl(0,'EC','ECE_BEGIN_STAGING','TRANSACTION_TYPE',i_transaction_type);
44
45 select map_type into i_map_type
46 from ece_mappings
47 where map_id = i_map_id
48 and enabled ='Y';
49
50 ec_inbound_stage.g_source_charset := i_data_file_characterset;
51
52 IF i_map_type = 'XML' THEN
53 ec_xml_utils.ec_xml_processor_in_generic (
54 i_map_id,
55 i_run_id,
56 i_file_path,
57 i_file_name
58 );
59 ELSE
60 ec_inbound_stage.load_data (
61 i_transaction_type,
62 i_file_name,
63 i_file_path,
64 i_map_id,
65 i_run_id
66 );
67 END IF;
68
69 ec_debug.pl(0,'EC','ECE_END_STAGING','TRANSACTION_TYPE',i_transaction_type);
70
71 /**
72 Initialize the Stack Table
73 **/
74 ec_utils.g_stack.DELETE;
75
76 ec_debug.pl(0,'EC','ECE_START_GENERIC_INBOUND','TRANSACTION_TYPE',i_transaction_type);
77 ece_inbound.process_run_inbound (
78 i_transaction_type => i_transaction_type,
79 i_run_id => i_run_id
80 );
81
82 ec_debug.pl(0,'EC','ECE_FINISH_GENERIC_INBOUND','TRANSACTION_TYPE',i_transaction_type);
83
84 IF i_Run_Import = 'Y' THEN
85 i_Submit_ID := fnd_request.submit_request (
86 application => 'ONT',
87 program => 'OEOIMP',
88 argument1 => NULL , --Operating_unit_id bug6918092
89 argument2 => '6', -- Order_Source_Id =6 for EDI
90 argument3 => '', -- Order Ref = all
91 argument4 => 'UPDATE',-- Operation code = UPDATE
92 argument5 => 'N', -- Validate_Only = 'N'
93 argument6 => '1', -- Debug Level = 1
94 argument7 => i_num_instances -- No. of Instances
95 );
96
97 ec_debug.pl(0,'EC','ECE_EXECUTE_OPEN_INTERFACE',
98 'TRANSACTION_TYPE',i_transaction_type,
99 'REQUEST_ID',i_Submit_Id);
100 END IF;
101
102 COMMIT;
103 retcode := ec_utils.i_ret_code;
104
105 IF ec_mapping_utils.ec_get_trans_upgrade_status(i_transaction_type) = 'U' THEN
106 ec_debug.pl(0,'EC','ECE_REC_TRANS_PENDING',NULL);
107 retcode := 1;
108 END IF;
109
110 ec_debug.pl(3,'i_submit_id',i_submit_id);
111 ec_debug.pl(3,'retcode',retcode);
112 ec_debug.pl(3,'errbuf',errbuf);
113 ec_debug.pop('ECEPOCI.PROCESS_POCI_INBOUND');
114
115 ec_debug.pl(0,'EC','ECE_END_INBOUND','TRANSACTION_TYPE',i_transaction_type);
116 ec_debug.disable_debug;
117
118 EXCEPTION
119 WHEN ece_transaction_disabled THEN
120 ec_debug.pl(0,'EC','ECE_TRANSACTION_DISABLED','TRANSACTION',i_transaction_type);
121 retcode := 1;
122 ec_debug.disable_debug;
123 ROLLBACK WORK;
124
125 WHEN EC_UTILS.PROGRAM_EXIT then
126 errbuf := ec_utils.i_errbuf;
127 retcode := ec_utils.i_ret_code;
128 ece_flatfile_pvt.print_attributes;
129 rollback work;
130 ec_debug.disable_debug;
131
132 WHEN OTHERS THEN
133 ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL',
134 'ECEPOCI.PROCESS_POCI_INBOUND');
135 ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
136 retcode := 2;
137 rollback work;
138 ece_flatfile_pvt.print_attributes;
139 ec_debug.disable_debug;
140
141 END PROCESS_POCI_INBOUND;
142
143
144 PROCEDURE def_creation_date(
145 p_operation_code IN VARCHAR2,
146 p_creation_date_in IN DATE,
147 p_creation_date_out OUT NOCOPY DATE
148 )
149 IS
150 BEGIN
151
152 IF (UPPER(p_operation_code) = 'INSERT') AND
153 p_creation_date_in IS NULL THEN
154 p_creation_date_out := SYSDATE;
155 ELSE
156 p_creation_date_out := p_creation_date_in;
157 END IF;
158
159 END def_creation_date;
160
161 PROCEDURE def_automatic_flag(
162 p_operation_code IN VARCHAR2,
163 p_automatic_flag_in IN VARCHAR2,
164 p_automatic_flag_out OUT NOCOPY VARCHAR2
165 )
166 IS
167 BEGIN
168
169 IF (UPPER(p_operation_code) = 'INSERT') AND
170 p_automatic_flag_in IS NULL THEN
171 p_automatic_flag_out := 'N';
172 ELSE
173 p_automatic_flag_out := p_automatic_flag_in;
174 END IF;
175
176 END def_automatic_flag;
177
178 PROCEDURE def_calc_prc_flag(
179 p_operation_code IN VARCHAR2,
180 p_calc_prc_flag_in IN VARCHAR2,
181 p_calc_prc_flag_out OUT NOCOPY VARCHAR2
182 )
183 IS
184 BEGIN
185
186 IF (UPPER(p_operation_code) = 'INSERT') AND
187 p_calc_prc_flag_in IS NULL THEN
188 p_calc_prc_flag_out := 'Y';
189 ELSE
190 p_calc_prc_flag_out := p_calc_prc_flag_in;
191 END IF;
192
193 END def_calc_prc_flag;
194
195 PROCEDURE def_created_by(
196 p_operation_code IN VARCHAR2,
197 p_created_by_in IN NUMBER,
198 p_created_by_out OUT NOCOPY NUMBER
199 )
200 IS
201 BEGIN
202
203 IF (UPPER(p_operation_code) = 'INSERT') AND
204 p_created_by_in IS NULL THEN
205 p_created_by_out := FND_GLOBAL.USER_ID;
206 ELSE
207 p_created_by_out := p_created_by_in;
208 END IF;
209
210 END def_created_by;
211
212
213 END ECEPOCI;