59: l_cln_params wf_parameter_list_t;
60: l_key VARCHAR2(100);
61: BEGIN
62: IF g_debug_level <= 2 THEN
63: cln_debug_pub.add('Entering m4u_get_cin_extn.update_cln_history',2);
64: cln_debug_pub.add('a_cln_id - ' || a_cln_id,1);
65: cln_debug_pub.add('a_sts - ' || a_sts,1);
66: cln_debug_pub.add('a_msg - ' || a_msg,1);
67: END IF;
60: l_key VARCHAR2(100);
61: BEGIN
62: IF g_debug_level <= 2 THEN
63: cln_debug_pub.add('Entering m4u_get_cin_extn.update_cln_history',2);
64: cln_debug_pub.add('a_cln_id - ' || a_cln_id,1);
65: cln_debug_pub.add('a_sts - ' || a_sts,1);
66: cln_debug_pub.add('a_msg - ' || a_msg,1);
67: END IF;
68:
61: BEGIN
62: IF g_debug_level <= 2 THEN
63: cln_debug_pub.add('Entering m4u_get_cin_extn.update_cln_history',2);
64: cln_debug_pub.add('a_cln_id - ' || a_cln_id,1);
65: cln_debug_pub.add('a_sts - ' || a_sts,1);
66: cln_debug_pub.add('a_msg - ' || a_msg,1);
67: END IF;
68:
69: -- Actually this api is not called for success
62: IF g_debug_level <= 2 THEN
63: cln_debug_pub.add('Entering m4u_get_cin_extn.update_cln_history',2);
64: cln_debug_pub.add('a_cln_id - ' || a_cln_id,1);
65: cln_debug_pub.add('a_sts - ' || a_sts,1);
66: cln_debug_pub.add('a_msg - ' || a_msg,1);
67: END IF;
68:
69: -- Actually this api is not called for success
70: IF a_sts = g_success_code THEN
84:
85: -- Call CLN history update API
86: l_key := 'M4U_EXTN_' || a_cln_id;
87: IF g_debug_level <= 1 THEN
88: cln_debug_pub.add('Key - ' || l_key,2);
89: END IF;
90:
91: l_cln_params := wf_parameter_list_t();
92:
108:
109: commit;
110:
111: IF g_debug_level <= 2 THEN
112: cln_debug_pub.add('Exiting m4u_get_cin_extn.update_cln_history - Normal',2);
113: END IF;
114:
115: RETURN;
116: EXCEPTION
116: EXCEPTION
117: WHEN OTHERS THEN
118: -- ignore exceptions - log and continue
119: IF g_debug_level <= 6 THEN
120: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.update_cln_history',6);
121: cln_debug_pub.add(SQLCODE || ':' || substr(SQLERRM,1,255),6);
122: cln_debug_pub.add('Exiting m4u_get_cin_extn.update_cln_history - Exception',6);
123: END IF;
124: END;
117: WHEN OTHERS THEN
118: -- ignore exceptions - log and continue
119: IF g_debug_level <= 6 THEN
120: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.update_cln_history',6);
121: cln_debug_pub.add(SQLCODE || ':' || substr(SQLERRM,1,255),6);
122: cln_debug_pub.add('Exiting m4u_get_cin_extn.update_cln_history - Exception',6);
123: END IF;
124: END;
125:
118: -- ignore exceptions - log and continue
119: IF g_debug_level <= 6 THEN
120: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.update_cln_history',6);
121: cln_debug_pub.add(SQLCODE || ':' || substr(SQLERRM,1,255),6);
122: cln_debug_pub.add('Exiting m4u_get_cin_extn.update_cln_history - Exception',6);
123: END IF;
124: END;
125:
126: -- Add any more validation here
141: BEGIN
142: l_param := NULL;
143:
144: IF g_debug_level <= 2 THEN
145: cln_debug_pub.add('Entering m4u_get_cin_extn.read_and_validate_inputs',2);
146: END IF;
147:
148:
149: l_param_list := a_evnt.getParameterList();
180: x_ret_sts := g_success_code;
181: x_ret_msg := NULL;
182:
183: IF g_debug_level <= 2 THEN
184: cln_debug_pub.add('Exiting m4u_get_cin_extn.read_and_validate_inputs - Normal',2);
185: END IF;
186: END;
187:
188:
209: l_upd_col BOOLEAN;
210: handled_exception exception;
211: BEGIN
212: IF g_debug_level <= 2 THEN
213: cln_debug_pub.add('Entering m4u_get_cin_extn.get_xml_fragment',2);
214: END IF;
215:
216: l_upd_col := false;
217: l_ret_sts := g_success_code;
222: -- validate inputs, make sure all mandatory parameters are supplied
223: read_and_validate_inputs(a_evnt,l_cln_id,l_tp_site_id,l_indstry_list,l_ret_sts,l_ret_msg);
224:
225: IF g_debug_level <= 1 THEN
226: cln_debug_pub.add('l_cln_id - ' || l_cln_id);
227: cln_debug_pub.add('l_tp_site_id - ' || l_tp_site_id);
228: cln_debug_pub.add('l_indstry_list - ' || l_indstry_list);
229: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts);
230: cln_debug_pub.add('l_ret_msg - ' || l_ret_msg);
223: read_and_validate_inputs(a_evnt,l_cln_id,l_tp_site_id,l_indstry_list,l_ret_sts,l_ret_msg);
224:
225: IF g_debug_level <= 1 THEN
226: cln_debug_pub.add('l_cln_id - ' || l_cln_id);
227: cln_debug_pub.add('l_tp_site_id - ' || l_tp_site_id);
228: cln_debug_pub.add('l_indstry_list - ' || l_indstry_list);
229: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts);
230: cln_debug_pub.add('l_ret_msg - ' || l_ret_msg);
231: END IF;
224:
225: IF g_debug_level <= 1 THEN
226: cln_debug_pub.add('l_cln_id - ' || l_cln_id);
227: cln_debug_pub.add('l_tp_site_id - ' || l_tp_site_id);
228: cln_debug_pub.add('l_indstry_list - ' || l_indstry_list);
229: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts);
230: cln_debug_pub.add('l_ret_msg - ' || l_ret_msg);
231: END IF;
232: -- validation failed, update CLN and raise exception
225: IF g_debug_level <= 1 THEN
226: cln_debug_pub.add('l_cln_id - ' || l_cln_id);
227: cln_debug_pub.add('l_tp_site_id - ' || l_tp_site_id);
228: cln_debug_pub.add('l_indstry_list - ' || l_indstry_list);
229: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts);
230: cln_debug_pub.add('l_ret_msg - ' || l_ret_msg);
231: END IF;
232: -- validation failed, update CLN and raise exception
233: IF l_ret_sts <> g_success_code THEN
226: cln_debug_pub.add('l_cln_id - ' || l_cln_id);
227: cln_debug_pub.add('l_tp_site_id - ' || l_tp_site_id);
228: cln_debug_pub.add('l_indstry_list - ' || l_indstry_list);
229: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts);
230: cln_debug_pub.add('l_ret_msg - ' || l_ret_msg);
231: END IF;
232: -- validation failed, update CLN and raise exception
233: IF l_ret_sts <> g_success_code THEN
234: IF g_debug_level <= 1 THEN
231: END IF;
232: -- validation failed, update CLN and raise exception
233: IF l_ret_sts <> g_success_code THEN
234: IF g_debug_level <= 1 THEN
235: cln_debug_pub.add('Update_cln_history with failure',1);
236: END IF;
237: update_cln_history(l_cln_id,l_ret_sts,l_ret_msg);
238: RAISE handled_exception;
239: END IF;
247:
248: l_idx := INSTR(l_indstry_list,':');
249:
250: IF g_debug_level <= 1 THEN
251: cln_debug_pub.add('l_idx - ' || l_idx);
252: END IF;
253:
254: -- loop through industry list
255: -- industry1:industry2:industry3:
259: l_indstry := SUBSTR(l_indstry_list,1,l_idx-1);
260: l_indstry_list := SUBSTR(l_indstry_list,l_idx+1);
261:
262: IF g_debug_level <= 1 THEN
263: cln_debug_pub.add('l_indstry - ' || l_indstry,1);
264: cln_debug_pub.add('l_indstry_list - ' || l_indstry_list,1);
265: END IF;
266:
267: l_indstry := get_indstry_extn_nam(l_indstry);
260: l_indstry_list := SUBSTR(l_indstry_list,l_idx+1);
261:
262: IF g_debug_level <= 1 THEN
263: cln_debug_pub.add('l_indstry - ' || l_indstry,1);
264: cln_debug_pub.add('l_indstry_list - ' || l_indstry_list,1);
265: END IF;
266:
267: l_indstry := get_indstry_extn_nam(l_indstry);
268:
266:
267: l_indstry := get_indstry_extn_nam(l_indstry);
268:
269: IF g_debug_level <= 1 THEN
270: cln_debug_pub.add('decoded l_indstry - ' || l_indstry,1);
271: END IF;
272:
273: l_ret_sts := g_success_code;
274:
275: IF UPPER(l_indstry) NOT IN ('FMCG','HARDLINES') THEN
276: -- make call to extension API
277:
278: IF g_debug_level <= 1 THEN
279: cln_debug_pub.add('Calling where collaboration_id := a_cln_id',1);
280: END IF;
281:
282: l_upd_col := true;
283: -- for industry code "XYZ" map-name = "M4U_EXTN_XYZ"
300:
301:
302:
303: IF g_debug_level <= 1 THEN
304: cln_debug_pub.add('m4u_xml_extn.generate_xml_fragment Success',1);
305: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts,1);
306: cln_debug_pub.add('l_ret_msf - ' || l_ret_msg,1);
307: cln_debug_pub.add('XML Size - ' || length(l_xml_frgmt),1);
308: cln_debug_pub.add('Out-xml size- ' || length(x_xml),1);
301:
302:
303: IF g_debug_level <= 1 THEN
304: cln_debug_pub.add('m4u_xml_extn.generate_xml_fragment Success',1);
305: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts,1);
306: cln_debug_pub.add('l_ret_msf - ' || l_ret_msg,1);
307: cln_debug_pub.add('XML Size - ' || length(l_xml_frgmt),1);
308: cln_debug_pub.add('Out-xml size- ' || length(x_xml),1);
309: END IF;
302:
303: IF g_debug_level <= 1 THEN
304: cln_debug_pub.add('m4u_xml_extn.generate_xml_fragment Success',1);
305: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts,1);
306: cln_debug_pub.add('l_ret_msf - ' || l_ret_msg,1);
307: cln_debug_pub.add('XML Size - ' || length(l_xml_frgmt),1);
308: cln_debug_pub.add('Out-xml size- ' || length(x_xml),1);
309: END IF;
310:
303: IF g_debug_level <= 1 THEN
304: cln_debug_pub.add('m4u_xml_extn.generate_xml_fragment Success',1);
305: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts,1);
306: cln_debug_pub.add('l_ret_msf - ' || l_ret_msg,1);
307: cln_debug_pub.add('XML Size - ' || length(l_xml_frgmt),1);
308: cln_debug_pub.add('Out-xml size- ' || length(x_xml),1);
309: END IF;
310:
311: -- if sucess append XML and process next industry
304: cln_debug_pub.add('m4u_xml_extn.generate_xml_fragment Success',1);
305: cln_debug_pub.add('l_ret_sts - ' || l_ret_sts,1);
306: cln_debug_pub.add('l_ret_msf - ' || l_ret_msg,1);
307: cln_debug_pub.add('XML Size - ' || length(l_xml_frgmt),1);
308: cln_debug_pub.add('Out-xml size- ' || length(x_xml),1);
309: END IF;
310:
311: -- if sucess append XML and process next industry
312: IF l_ret_sts = g_success_code THEN
311: -- if sucess append XML and process next industry
312: IF l_ret_sts = g_success_code THEN
313: x_xml := x_xml || l_xml_frgmt;
314: IF g_debug_level <= 1 THEN
315: cln_debug_pub.add('Concat successful ',1);
316: END IF;
317: ELSE
318: -- bail-out
319: IF g_debug_level <= 1 THEN
316: END IF;
317: ELSE
318: -- bail-out
319: IF g_debug_level <= 1 THEN
320: cln_debug_pub.add('Exiting loop',1);
321: END IF;
322: EXIT;
323: END IF;
324: END IF;
332: -- Well-formed XML requires a single root node
333: -- "OracleM4UExtensionFragment" is used in XSLT m4uoutcin.xsl
334: IF l_ret_sts = g_success_code THEN
335: IF g_debug_level <= 1 THEN
336: cln_debug_pub.add('Adding envelope',1);
337: END IF;
338: x_xml := '
339: x_xml := x_xml || '
340: ELSE
339: x_xml := x_xml || '';
340: ELSE
341: -- update CLN with failure details
342: IF g_debug_level <= 1 THEN
343: cln_debug_pub.add('Update_cln_history with failure',1);
344: END IF;
345: update_cln_history(l_cln_id,l_ret_sts,l_ret_msg);
346: RAISE handled_exception;
347: END IF;
346: RAISE handled_exception;
347: END IF;
348:
349: IF g_debug_level <= 2 THEN
350: cln_debug_pub.add('Exiting m4u_get_cin_extn.get_xml_fragment - Normal',2);
351: END IF;
352: RETURN;
353: EXCEPTION
354: -- all handled errors reach here
354: -- all handled errors reach here
355: -- raise exception to stop M4USTD workflow
356: WHEN handled_exception THEN
357: IF g_debug_level <= 6 THEN
358: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.get_xml_fragment',6);
359: cln_debug_pub.add(g_err,6);
360: cln_debug_pub.add('Exiting m4u_get_cin_extn.get_xml_fragment - Exception',6);
361: END IF;
362: RAISE;
355: -- raise exception to stop M4USTD workflow
356: WHEN handled_exception THEN
357: IF g_debug_level <= 6 THEN
358: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.get_xml_fragment',6);
359: cln_debug_pub.add(g_err,6);
360: cln_debug_pub.add('Exiting m4u_get_cin_extn.get_xml_fragment - Exception',6);
361: END IF;
362: RAISE;
363: -- all unhandled errors reach here
356: WHEN handled_exception THEN
357: IF g_debug_level <= 6 THEN
358: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.get_xml_fragment',6);
359: cln_debug_pub.add(g_err,6);
360: cln_debug_pub.add('Exiting m4u_get_cin_extn.get_xml_fragment - Exception',6);
361: END IF;
362: RAISE;
363: -- all unhandled errors reach here
364: -- 1. update cln
364: -- 1. update cln
365: -- 2. raise exception to stop M4USTD workflow
366: WHEN OTHERS THEN
367: IF g_debug_level <= 6 THEN
368: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.get_xml_fragment',6);
369: cln_debug_pub.add(SQLCODE || ':' || SQLERRM,6);
370: cln_debug_pub.add('Exiting m4u_get_cin_extn.get_xml_fragment - Exception',6);
371: END IF;
372: update_cln_history(l_cln_id,g_error_code,SQLCODE || SQLERRM);
365: -- 2. raise exception to stop M4USTD workflow
366: WHEN OTHERS THEN
367: IF g_debug_level <= 6 THEN
368: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.get_xml_fragment',6);
369: cln_debug_pub.add(SQLCODE || ':' || SQLERRM,6);
370: cln_debug_pub.add('Exiting m4u_get_cin_extn.get_xml_fragment - Exception',6);
371: END IF;
372: update_cln_history(l_cln_id,g_error_code,SQLCODE || SQLERRM);
373: RAISE;
366: WHEN OTHERS THEN
367: IF g_debug_level <= 6 THEN
368: cln_debug_pub.add('Unexpected error in m4u_get_cin_extn.get_xml_fragment',6);
369: cln_debug_pub.add(SQLCODE || ':' || SQLERRM,6);
370: cln_debug_pub.add('Exiting m4u_get_cin_extn.get_xml_fragment - Exception',6);
371: END IF;
372: update_cln_history(l_cln_id,g_error_code,SQLCODE || SQLERRM);
373: RAISE;
374: END get_xml_fragment;