[Home] [Help]
PACKAGE BODY: APPS.ECEASNI
Source
1 package body ECEASNI as
2 -- $Header: ECWASNIB.pls 120.2 2005/09/30 07:25:45 arsriniv ship $
3 procedure process_asni_docs
4 (
5 i_transaction_type IN varchar2,
6 i_run_id IN number
7 )
8 is
9 BEGIN
10 ec_debug.push('ECEASNI.PROCESS_ASNI_DOCS');
11 ec_debug.pl(3,'i_transaction_type',i_transaction_type);
12 ec_debug.pl(3,'i_run_id',i_run_id);
13
14 /**
15 Initialize the Stack Table
16 **/
17 ec_utils.g_stack.DELETE;
18
19 ec_debug.pl(0,'EC','ECE_START_GENERIC_INBOUND','TRANSACTION_TYPE',i_transaction_type);
20 ece_inbound.process_run_inbound
21 (
22 i_transaction_type => i_transaction_type,
23 i_run_id => i_run_id
24 );
25 ec_debug.pl(0,'EC','ECE_FINISH_GENERIC_INBOUND','TRANSACTION_TYPE',i_transaction_type);
26
27 ec_debug.pop('ECEASNI.PROCESS_ASNI_DOCS');
28 EXCEPTION
29 WHEN EC_UTILS.PROGRAM_EXIT then
30 raise;
31 WHEN OTHERS THEN
32 ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','ECEASNI.PROCESS_ASNI_DOCS');
33 ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
34 ec_utils.i_ret_code :=2;
35 raise EC_UTILS.PROGRAM_EXIT;
36 end process_asni_docs;
37
38 procedure process_asni_inbound
39 (
40 errbuf OUT NOCOPY varchar2,
41 retcode OUT NOCOPY varchar2,
42 i_file_path IN varchar2,
43 i_file_name IN varchar2,
44 i_run_import IN varchar2,
45 i_transaction_type IN varchar2,
46 i_map_id IN number,
47 i_debug_mode IN number,
48 i_source_charset IN varchar2
49 )
50 is
51 i_submit_id number;
52 i_run_id number;
53 i_map_type varchar2(40);
54 cEnabled VARCHAR2(1) := 'Y';
55 ece_transaction_disabled EXCEPTION;
56
57 begin
58 ec_debug.enable_debug(i_debug_mode);
59 ec_debug.pl(0,'EC','ECE_START_INBOUND','TRANSACTION_TYPE',i_transaction_type);
60 ec_debug.push('ECEASNI.PROCESS_ASNI_INBOUND');
61 ec_debug.pl(3,'i_file_path',i_file_path);
62 ec_debug.pl(3,'i_file_name',i_file_name);
63 ec_debug.pl(3,'i_run_import',i_run_import);
64 ec_debug.pl(3,'i_map_id',i_map_id);
65 ec_debug.pl(3,'i_debug_mode',i_debug_mode);
66 ec_debug.pl(3,'i_source_charset',i_source_charset);
67
68 /* Check to see if the transaction is enabled. If not, abort */
69 fnd_profile.get('ECE_' || i_transaction_type || '_ENABLED',cEnabled);
70 IF cEnabled = 'N' THEN
71 RAISE ece_transaction_disabled;
72 END IF;
73
74 ec_debug.pl(0,'EC','ECE_BEGIN_STAGING','TRANSACTION_TYPE',i_transaction_type);
75 select map_type into i_map_type
76 from ece_mappings
77 where map_id = i_map_id
78 and enabled ='Y';
79
80 /* bug 2162062 : Set the global variable for the characterset based on the input characterset */
81
82 ec_inbound_stage.g_source_charset:= i_source_charset;
83
84 IF i_map_type = 'XML' THEN
85 ec_xml_utils.ec_xml_processor_in_generic
86 (
87 i_map_id,
88 i_run_id,
89 i_file_path,
90 i_file_name
91 );
92 ELSE
93 ec_inbound_stage.load_data
94 (
95 i_transaction_type,
96 i_file_name,
97 i_file_path,
98 i_map_id,
99 i_run_id
100 );
101 END IF;
102 ec_debug.pl(0,'EC','ECE_END_STAGING','TRANSACTION_TYPE',i_transaction_type);
103
104 process_ASNI_docs
105 (
106 i_transaction_type,
107 i_run_id
108 );
109
110 IF (i_Run_Import = 'Y')
111 THEN
112 i_Submit_ID := fnd_request.submit_request(
113 application => 'PO',
114 program => 'RVCTP',
115 argument1 => 'BATCH',
116 argument2 => NULL);
117 ec_debug.pl(0,'EC','ECE_EXECUTE_OPEN_INTERFACE','TRANSACTION_TYPE',i_transaction_type,
118 'REQUEST_ID',i_Submit_Id);
119 END IF;
120
121 commit;
122 retcode := ec_utils.i_ret_code;
123
124 IF ec_mapping_utils.ec_get_trans_upgrade_status(i_transaction_type, i_map_id) = 'U' THEN
125 ec_debug.pl(0,'EC','ECE_REC_TRANS_PENDING',NULL);
126 retcode := 1;
127 END IF;
128
129 ec_debug.pl(3,'retcode',retcode);
130 ec_debug.pl(3,'errbuf',errbuf);
131 ec_debug.pl(3,'i_submit_id',i_submit_id);
132 ec_debug.pop('ECEASNI.PROCESS_ASNI_INBOUND');
133 ec_debug.pl(0,'EC','ECE_END_INBOUND','TRANSACTION_TYPE',i_transaction_type);
134 ec_debug.disable_debug;
135 EXCEPTION
136 WHEN ece_transaction_disabled THEN
137 ec_debug.pl(0,'EC','ECE_TRANSACTION_DISABLED','TRANSACTION',i_transaction_type);
138 retcode := 1;
139 ec_debug.disable_debug;
140 ROLLBACK WORK;
141
142 WHEN EC_UTILS.PROGRAM_EXIT then
143 rollback work;
144 retcode := ec_utils.i_ret_code;
145 ece_flatfile_pvt.print_attributes;
146 ec_debug.disable_debug;
147 WHEN OTHERS THEN
148 retcode := 2;
149 rollback work;
150 ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','ECEASNI.PROCESS_ASNI_INBOUND');
151 ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
152 ece_flatfile_pvt.print_attributes;
153 ec_debug.disable_debug;
154 end process_ASNI_inbound;
155
156 procedure process_sbni_inbound
157 (
158 errbuf OUT NOCOPY varchar2,
159 retcode OUT NOCOPY varchar2,
160 i_file_path IN varchar2,
161 i_file_name IN varchar2,
162 i_run_import IN varchar2,
163 i_transaction_type In varchar2,
164 i_map_id IN number,
165 i_debug_mode IN number,
166 i_source_charset IN varchar2
167 )
168 is
169 i_submit_id number;
170 i_run_id number;
171 i_map_type varchar2(40);
172 cEnabled VARCHAR2(1) := 'Y';
173 ece_transaction_disabled EXCEPTION;
174
175 begin
176 ec_debug.enable_debug(i_debug_mode);
177 ec_debug.pl(0,'EC','ECE_START_INBOUND','TRANSACTION_TYPE',i_transaction_type);
178 ec_debug.push('ECEASNI.PROCESS_SBNI_INBOUND');
179 ec_debug.pl(3,'i_file_path',i_file_path);
180 ec_debug.pl(3,'i_file_name',i_file_name);
181 ec_debug.pl(3,'i_run_import',i_run_import);
182 ec_debug.pl(3,'i_map_id',i_map_id);
183 ec_debug.pl(3,'i_debug_mode',i_debug_mode);
184 ec_debug.pl(3,'i_source_charset',i_source_charset);
185
186 /* Check to see if the transaction is enabled. If not, abort */
187 fnd_profile.get('ECE_' || i_transaction_type || '_ENABLED',cEnabled);
188 IF cEnabled = 'N' THEN
189 RAISE ece_transaction_disabled;
190 END IF;
191
192 ec_debug.pl(0,'EC','ECE_BEGIN_STAGING','TRANSACTION_TYPE',i_transaction_type);
193 select map_type into i_map_type
194 from ece_mappings
195 where map_id = i_map_id
196 and enabled ='Y';
197
198 /* bug 2162062 : Set the global variable for the characterset based on the input characterset */
199
200 ec_inbound_stage.g_source_charset:= i_source_charset;
201
202 IF i_map_type = 'XML' THEN
203 ec_xml_utils.ec_xml_processor_in_generic
204 (
205 i_map_id,
206 i_run_id,
207 i_file_path,
208 i_file_name
209 );
210 ELSE
211 ec_inbound_stage.load_data
212 (
213 i_transaction_type,
214 i_file_name,
215 i_file_path,
216 i_map_id,
217 i_run_id
218 );
219 END IF;
220 ec_debug.pl(0,'EC','ECE_END_STAGING','TRANSACTION_TYPE',i_transaction_type);
221
222 process_ASNI_docs
223 (
224 i_transaction_type,
225 i_run_id
226 );
227
228 IF (i_Run_Import = 'Y')
229 THEN
230 i_Submit_ID := fnd_request.submit_request(
231 application => 'PO',
232 program => 'RVCTP',
233 argument1 => 'BATCH',
234 argument2 => NULL);
235 ec_debug.pl(0,'EC','ECE_EXECUTE_OPEN_INTERFACE','TRANSACTION_TYPE',i_transaction_type,
236 'REQUEST_ID',i_Submit_Id);
237 END IF;
238 commit;
239 retcode := ec_utils.i_ret_code;
240
241 IF ec_mapping_utils.ec_get_trans_upgrade_status(i_transaction_type,i_map_id) = 'U' THEN
242 ec_debug.pl(0,'EC','ECE_REC_TRANS_PENDING',NULL);
243 retcode := 1;
244 END IF;
245
246 ec_debug.pl(3,'retcode',retcode);
247 ec_debug.pl(3,'errbuf',errbuf);
248 ec_debug.pl(3,'i_submit_id',i_submit_id);
249 ec_debug.pop('ECEASNI.PROCESS_SBNI_INBOUND');
250 ec_debug.pl(0,'EC','ECE_END_INBOUND','TRANSACTION_TYPE',i_transaction_type);
251 ec_debug.disable_debug;
252 EXCEPTION
253 WHEN ece_transaction_disabled THEN
254 ec_debug.pl(0,'EC','ECE_TRANSACTION_DISABLED','TRANSACTION',i_transaction_type);
255 retcode := 1;
256 ec_debug.disable_debug;
257 ROLLBACK WORK;
258
259 WHEN EC_UTILS.PROGRAM_EXIT then
260 rollback work;
261 retcode := ec_utils.i_ret_code;
262 ece_flatfile_pvt.print_attributes;
263 ec_debug.disable_debug;
264 WHEN OTHERS THEN
265 retcode := 2;
266 rollback work;
267 ec_debug.pl(0,'EC','ECE_PROGRAM_ERROR','PROGRESS_LEVEL','ECEASNI.PROCESS_SBNI_INBOUND');
268 ec_debug.pl(0,'EC','ECE_ERROR_MESSAGE','ERROR_MESSAGE',SQLERRM);
269 ece_flatfile_pvt.print_attributes;
270 ec_debug.disable_debug;
271 end process_SBNI_inbound;
272
273 end eceasni;