20: l_ret_msg VARCHAR2(4000);
21: BEGIN
22:
23:
24: m4u_dmd_utils.log('Entering m4u_cln_pkg.log_payload',2);
25:
26: l_event_key := p_event.getEventKey();
27: l_event_name := p_event.getEventName();
28:
25:
26: l_event_key := p_event.getEventKey();
27: l_event_name := p_event.getEventName();
28:
29: m4u_dmd_utils.log('l_event_key -|' || l_event_key || '|',6);
30: m4u_dmd_utils.log('l_event_name -|' || l_event_name || '|',6);
31:
32: -- reading parameters
33: l_params := p_event.getParameterList();
26: l_event_key := p_event.getEventKey();
27: l_event_name := p_event.getEventName();
28:
29: m4u_dmd_utils.log('l_event_key -|' || l_event_key || '|',6);
30: m4u_dmd_utils.log('l_event_name -|' || l_event_name || '|',6);
31:
32: -- reading parameters
33: l_params := p_event.getParameterList();
34: l_payload_id := wf_event.getValueForParameter('PAYLOAD_ID', l_params);
35: l_payload_type := wf_event.getValueForParameter('PAYLOAD_TYPE',l_params);
36: l_direction := wf_event.getValueForParameter('PAYLOAD_DIR' ,l_params);
37:
38: l_ecx_doc_num := l_payload_type || '.' || l_payload_id;
39: IF l_direction = m4u_dmd_utils.c_dir_out THEN
40: l_txn_styp := m4u_cln_pkg.c_xmlg_styp_out;
41: ELSE
42: l_txn_styp := m4u_cln_pkg.c_xmlg_styp_in;
43: END IF;
42: l_txn_styp := m4u_cln_pkg.c_xmlg_styp_in;
43: END IF;
44:
45:
46: m4u_dmd_utils.log('l_ecx_doc_num -|' || l_ecx_doc_num || '|',6);
47: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
48: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
49: m4u_dmd_utils.log('l_direction -|' || l_direction || '|',6);
50: m4u_dmd_utils.log('l_txn_styp -|' || l_txn_styp || '|',1);
43: END IF;
44:
45:
46: m4u_dmd_utils.log('l_ecx_doc_num -|' || l_ecx_doc_num || '|',6);
47: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
48: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
49: m4u_dmd_utils.log('l_direction -|' || l_direction || '|',6);
50: m4u_dmd_utils.log('l_txn_styp -|' || l_txn_styp || '|',1);
51:
44:
45:
46: m4u_dmd_utils.log('l_ecx_doc_num -|' || l_ecx_doc_num || '|',6);
47: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
48: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
49: m4u_dmd_utils.log('l_direction -|' || l_direction || '|',6);
50: m4u_dmd_utils.log('l_txn_styp -|' || l_txn_styp || '|',1);
51:
52:
45:
46: m4u_dmd_utils.log('l_ecx_doc_num -|' || l_ecx_doc_num || '|',6);
47: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
48: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
49: m4u_dmd_utils.log('l_direction -|' || l_direction || '|',6);
50: m4u_dmd_utils.log('l_txn_styp -|' || l_txn_styp || '|',1);
51:
52:
53: BEGIN
46: m4u_dmd_utils.log('l_ecx_doc_num -|' || l_ecx_doc_num || '|',6);
47: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
48: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
49: m4u_dmd_utils.log('l_direction -|' || l_direction || '|',6);
50: m4u_dmd_utils.log('l_txn_styp -|' || l_txn_styp || '|',1);
51:
52:
53: BEGIN
54: SELECT payload
56: FROM m4u_dmd_payloads
57: WHERE payload_id = l_payload_id;
58: EXCEPTION
59: WHEN OTHERS THEN
60: m4u_dmd_utils.log('Error retrieving payload',6);
61: m4u_dmd_utils.log(SQLCODE || '-' || SQLERRM ,6);
62: RAISE;
63: END;
64:
57: WHERE payload_id = l_payload_id;
58: EXCEPTION
59: WHEN OTHERS THEN
60: m4u_dmd_utils.log('Error retrieving payload',6);
61: m4u_dmd_utils.log(SQLCODE || '-' || SQLERRM ,6);
62: RAISE;
63: END;
64:
65: IF l_clob IS NOT NULL THEN
62: RAISE;
63: END;
64:
65: IF l_clob IS NOT NULL THEN
66: m4u_dmd_utils.log('length(l_clob) -|' || length(l_clob) || '|',6);
67: END IF;
68:
69: m4u_dmd_utils.log('Call ecx_errorlog.log_document',2);
70: ecx_errorlog.log_document
65: IF l_clob IS NOT NULL THEN
66: m4u_dmd_utils.log('length(l_clob) -|' || length(l_clob) || '|',6);
67: END IF;
68:
69: m4u_dmd_utils.log('Call ecx_errorlog.log_document',2);
70: ecx_errorlog.log_document
71: (
72: o_retcode => l_ret_sts,
73: o_retmsg => l_ret_msg,
104: i_cb_event_key => null,
105: i_block_mode => 'N'
106: );
107:
108: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',2);
109: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',2);
110: m4u_dmd_utils.log('Exiting m4u_cln_pkg.log_payload - Success' ,2);
111:
112: RETURN 'SUCCESS';
105: i_block_mode => 'N'
106: );
107:
108: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',2);
109: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',2);
110: m4u_dmd_utils.log('Exiting m4u_cln_pkg.log_payload - Success' ,2);
111:
112: RETURN 'SUCCESS';
113:
106: );
107:
108: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',2);
109: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',2);
110: m4u_dmd_utils.log('Exiting m4u_cln_pkg.log_payload - Success' ,2);
111:
112: RETURN 'SUCCESS';
113:
114: EXCEPTION
112: RETURN 'SUCCESS';
113:
114: EXCEPTION
115: WHEN OTHERS THEN
116: m4u_dmd_utils.log('m4u_cln_pkg.log_payload',6);
117: m4u_dmd_utils.log('Unexpected error occured while processing',6);
118: m4u_dmd_utils.log(SQLCODE || '-' || SQLERRM,6);
119: RETURN 'SUCCESS';
120: END log_payload;
113:
114: EXCEPTION
115: WHEN OTHERS THEN
116: m4u_dmd_utils.log('m4u_cln_pkg.log_payload',6);
117: m4u_dmd_utils.log('Unexpected error occured while processing',6);
118: m4u_dmd_utils.log(SQLCODE || '-' || SQLERRM,6);
119: RETURN 'SUCCESS';
120: END log_payload;
121:
114: EXCEPTION
115: WHEN OTHERS THEN
116: m4u_dmd_utils.log('m4u_cln_pkg.log_payload',6);
117: m4u_dmd_utils.log('Unexpected error occured while processing',6);
118: m4u_dmd_utils.log(SQLCODE || '-' || SQLERRM,6);
119: RETURN 'SUCCESS';
120: END log_payload;
121:
122: FUNCTION update_collab
168: l_m4u_doc_rec m4u_dmd_documents%ROWTYPE;
169: l_m4u_msg_rec m4u_dmd_messages%ROWTYPE;
170: BEGIN
171:
172: m4u_dmd_utils.log('Entering m4u_cln_pkg.update_collab',6);
173: l_event_key := p_event.getEventKey();
174: l_event_name := p_event.getEventName();
175:
176: m4u_dmd_utils.log('l_event_key -|' || l_event_key || '|',1);
172: m4u_dmd_utils.log('Entering m4u_cln_pkg.update_collab',6);
173: l_event_key := p_event.getEventKey();
174: l_event_name := p_event.getEventName();
175:
176: m4u_dmd_utils.log('l_event_key -|' || l_event_key || '|',1);
177: m4u_dmd_utils.log('l_event_name -|' || l_event_name || '|',1);
178:
179: -- reading parameters
180: l_params := p_event.getParameterList();
173: l_event_key := p_event.getEventKey();
174: l_event_name := p_event.getEventName();
175:
176: m4u_dmd_utils.log('l_event_key -|' || l_event_key || '|',1);
177: m4u_dmd_utils.log('l_event_name -|' || l_event_name || '|',1);
178:
179: -- reading parameters
180: l_params := p_event.getParameterList();
181: l_retry_count := wf_event.getValueForParameter('RETRY_COUNT' ,l_params);
191: l_payload_dir := wf_event.getValueForParameter('PAYLOAD_DIR' ,l_params);
192: l_payload_type := wf_event.getValueForParameter('PAYLOAD_TYPE' ,l_params);
193:
194:
195: m4u_dmd_utils.log('l_ref_doc_id -|' || l_ref_doc_id || '|',1);
196: m4u_dmd_utils.log('l_doc_id -|' || l_doc_id || '|',1);
197: m4u_dmd_utils.log('l_doc_typ -|' || l_doc_type || '|',1);
198: m4u_dmd_utils.log('l_retry_count -|' || l_retry_count || '|',1);
199: m4u_dmd_utils.log('l_action -|' || l_action || '|',1);
192: l_payload_type := wf_event.getValueForParameter('PAYLOAD_TYPE' ,l_params);
193:
194:
195: m4u_dmd_utils.log('l_ref_doc_id -|' || l_ref_doc_id || '|',1);
196: m4u_dmd_utils.log('l_doc_id -|' || l_doc_id || '|',1);
197: m4u_dmd_utils.log('l_doc_typ -|' || l_doc_type || '|',1);
198: m4u_dmd_utils.log('l_retry_count -|' || l_retry_count || '|',1);
199: m4u_dmd_utils.log('l_action -|' || l_action || '|',1);
200:
193:
194:
195: m4u_dmd_utils.log('l_ref_doc_id -|' || l_ref_doc_id || '|',1);
196: m4u_dmd_utils.log('l_doc_id -|' || l_doc_id || '|',1);
197: m4u_dmd_utils.log('l_doc_typ -|' || l_doc_type || '|',1);
198: m4u_dmd_utils.log('l_retry_count -|' || l_retry_count || '|',1);
199: m4u_dmd_utils.log('l_action -|' || l_action || '|',1);
200:
201: m4u_dmd_utils.log('l_doc_sts -|' || l_doc_sts || '|',1);
194:
195: m4u_dmd_utils.log('l_ref_doc_id -|' || l_ref_doc_id || '|',1);
196: m4u_dmd_utils.log('l_doc_id -|' || l_doc_id || '|',1);
197: m4u_dmd_utils.log('l_doc_typ -|' || l_doc_type || '|',1);
198: m4u_dmd_utils.log('l_retry_count -|' || l_retry_count || '|',1);
199: m4u_dmd_utils.log('l_action -|' || l_action || '|',1);
200:
201: m4u_dmd_utils.log('l_doc_sts -|' || l_doc_sts || '|',1);
202: m4u_dmd_utils.log('l_processing_msg -|' || l_processing_msg || '|',1);
195: m4u_dmd_utils.log('l_ref_doc_id -|' || l_ref_doc_id || '|',1);
196: m4u_dmd_utils.log('l_doc_id -|' || l_doc_id || '|',1);
197: m4u_dmd_utils.log('l_doc_typ -|' || l_doc_type || '|',1);
198: m4u_dmd_utils.log('l_retry_count -|' || l_retry_count || '|',1);
199: m4u_dmd_utils.log('l_action -|' || l_action || '|',1);
200:
201: m4u_dmd_utils.log('l_doc_sts -|' || l_doc_sts || '|',1);
202: m4u_dmd_utils.log('l_processing_msg -|' || l_processing_msg || '|',1);
203:
197: m4u_dmd_utils.log('l_doc_typ -|' || l_doc_type || '|',1);
198: m4u_dmd_utils.log('l_retry_count -|' || l_retry_count || '|',1);
199: m4u_dmd_utils.log('l_action -|' || l_action || '|',1);
200:
201: m4u_dmd_utils.log('l_doc_sts -|' || l_doc_sts || '|',1);
202: m4u_dmd_utils.log('l_processing_msg -|' || l_processing_msg || '|',1);
203:
204: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
205: m4u_dmd_utils.log('l_payload_dir -|' || l_payload_dir || '|',1);
198: m4u_dmd_utils.log('l_retry_count -|' || l_retry_count || '|',1);
199: m4u_dmd_utils.log('l_action -|' || l_action || '|',1);
200:
201: m4u_dmd_utils.log('l_doc_sts -|' || l_doc_sts || '|',1);
202: m4u_dmd_utils.log('l_processing_msg -|' || l_processing_msg || '|',1);
203:
204: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
205: m4u_dmd_utils.log('l_payload_dir -|' || l_payload_dir || '|',1);
206: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
200:
201: m4u_dmd_utils.log('l_doc_sts -|' || l_doc_sts || '|',1);
202: m4u_dmd_utils.log('l_processing_msg -|' || l_processing_msg || '|',1);
203:
204: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
205: m4u_dmd_utils.log('l_payload_dir -|' || l_payload_dir || '|',1);
206: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
207:
208: -- query m4u_dmd_documents
201: m4u_dmd_utils.log('l_doc_sts -|' || l_doc_sts || '|',1);
202: m4u_dmd_utils.log('l_processing_msg -|' || l_processing_msg || '|',1);
203:
204: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
205: m4u_dmd_utils.log('l_payload_dir -|' || l_payload_dir || '|',1);
206: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
207:
208: -- query m4u_dmd_documents
209: SELECT *
202: m4u_dmd_utils.log('l_processing_msg -|' || l_processing_msg || '|',1);
203:
204: m4u_dmd_utils.log('l_payload_id -|' || l_payload_id || '|',1);
205: m4u_dmd_utils.log('l_payload_dir -|' || l_payload_dir || '|',1);
206: m4u_dmd_utils.log('l_payload_type -|' || l_payload_type || '|',1);
207:
208: -- query m4u_dmd_documents
209: SELECT *
210: INTO l_m4u_doc_rec
209: SELECT *
210: INTO l_m4u_doc_rec
211: FROM m4u_dmd_documents
212: WHERE doc_id = l_doc_id;
213: m4u_dmd_utils.log('m4u_doc_rec.doc_id -|' || l_m4u_doc_rec.doc_id || '|',1);
214:
215: -- query m4u_dmd_messages
216: SELECT *
217: INTO l_m4u_msg_rec
216: SELECT *
217: INTO l_m4u_msg_rec
218: FROM m4u_dmd_messages
219: WHERE msg_id = l_m4u_doc_rec.msg_id;
220: m4u_dmd_utils.log('m4u_msg_rec.msg_id -|' || l_m4u_msg_rec.msg_id || '|',1);
221:
222: --xmlg payload reference
223: IF l_payload_id IS NOT NULL THEN
224: l_xmlg_doc_id := l_payload_type || '.' || l_payload_id;
223: IF l_payload_id IS NOT NULL THEN
224: l_xmlg_doc_id := l_payload_type || '.' || l_payload_id;
225: l_xmlg_type := m4u_cln_pkg.c_xmlg_type;
226:
227: IF l_payload_dir = m4u_dmd_utils.c_dir_out THEN
228: l_xmlg_styp := m4u_cln_pkg.c_xmlg_styp_out;
229: ELSE
230: l_xmlg_styp := m4u_cln_pkg.c_xmlg_styp_in;
231: END IF;
232: END IF;
233:
234:
235: --todo: fill this junk BEGIN
236: IF l_doc_type = m4u_dmd_utils.c_type_rfcin THEN
237: l_cln_doc_id := l_doc_type || '.' ||l_doc_id;
238: l_cln_ref_id := l_doc_type || '.' ||l_doc_id;
239: l_cln_type := l_doc_type ;
240: l_cln_doc_type := l_doc_type;
237: l_cln_doc_id := l_doc_type || '.' ||l_doc_id;
238: l_cln_ref_id := l_doc_type || '.' ||l_doc_id;
239: l_cln_type := l_doc_type ;
240: l_cln_doc_type := l_doc_type;
241: l_payload_dir := nvl(l_payload_dir,m4u_dmd_utils.c_dir_out);
242: l_cln_dtl_msg := l_processing_msg;
243:
244: IF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count = 0 THEN
245: l_create_flag := true;
240: l_cln_doc_type := l_doc_type;
241: l_payload_dir := nvl(l_payload_dir,m4u_dmd_utils.c_dir_out);
242: l_cln_dtl_msg := l_processing_msg;
243:
244: IF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count = 0 THEN
245: l_create_flag := true;
246: l_cln_doc_sts := 'SUCCESS';
247: l_cln_pt := 'APPS';
248: l_cln_sts := 'INITIATED';
250: fnd_message.set_name('CLN','M4U_DMD_REQUEST_INIT');
251: fnd_message.set_token('TYPE','Request for Catalogue Item Notification');
252: l_cln_msg := fnd_message.get;
253:
254: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count > 0 THEN
255: l_create_flag := false;
256: l_cln_doc_sts := 'SUCCESS';
257: l_cln_pt := 'APPS';
258: l_cln_sts := 'INITIATED';
260: fnd_message.set_name('CLN','M4U_DMD_REQUEST_RETRY');
261: fnd_message.set_token('TYPE','Request for Catalogue Item Notification');
262: l_cln_msg := fnd_message.get;
263:
264: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_sent THEN
265: l_create_flag := false;
266: l_cln_doc_sts := 'SUCCESS';
267: l_cln_pt := 'APPS';
268: l_cln_sts := 'STARTED';
270: fnd_message.set_name('CLN','M4U_DMD_REQUEST_SENT');
271: fnd_message.set_token('TYPE','Request for Catalogue Item Notification');
272: l_cln_msg := fnd_message.get;
273:
274: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_success THEN
275: l_create_flag := false;
276: l_cln_doc_sts := 'SUCCESS';
277: l_cln_pt := 'B2B_SERVER';
278: l_cln_sts := 'COMPLETED';
282: fnd_message.set_token('TYPE','Request for Catalogue Item Notification');
283: l_cln_msg := fnd_message.get;
284:
285:
286: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_fail THEN
287: l_create_flag := false;
288: l_cln_doc_sts := 'SUCCESS';
289: l_cln_pt := 'B2B_SERVER';
290: l_cln_sts := 'COMPLETED';
294: fnd_message.set_token('TYPE','Request for Catalogue Item Notification');
295: l_cln_msg := fnd_message.get;
296:
297:
298: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_error THEN
299: l_create_flag := false;
300: l_cln_doc_sts := 'ERROR';
301: l_cln_pt := 'B2B_SERVER';
302: l_cln_sts := 'ERROR';
306: l_cln_msg := fnd_message.get;
307:
308: END IF;
309:
310: ELSIF l_doc_type = m4u_dmd_utils.c_type_cis THEN
311:
312: l_cln_doc_id := l_doc_type || '.' ||l_doc_id;
313: l_cln_ref_id := l_doc_type || '.' ||l_doc_id;
314: l_cln_type := l_doc_type ;
312: l_cln_doc_id := l_doc_type || '.' ||l_doc_id;
313: l_cln_ref_id := l_doc_type || '.' ||l_doc_id;
314: l_cln_type := l_doc_type ;
315: l_cln_doc_type := l_doc_type;
316: l_payload_dir := nvl(l_payload_dir,m4u_dmd_utils.c_dir_out);
317: l_cln_dtl_msg := l_processing_msg;
318:
319: IF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count = 0 THEN
320: l_create_flag := true;
315: l_cln_doc_type := l_doc_type;
316: l_payload_dir := nvl(l_payload_dir,m4u_dmd_utils.c_dir_out);
317: l_cln_dtl_msg := l_processing_msg;
318:
319: IF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count = 0 THEN
320: l_create_flag := true;
321: l_cln_pt := 'APPS';
322: l_cln_doc_sts := 'SUCCESS';
323: l_cln_sts := 'INITIATED';
325: fnd_message.set_name('CLN','M4U_DMD_REQUEST_INIT');
326: fnd_message.set_token('TYPE','Catalogue Item Subscription');
327: l_cln_msg := fnd_message.get;
328:
329: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count > 0 THEN
330: l_create_flag := false;
331: l_cln_pt := 'APPS';
332: l_cln_doc_sts := 'SUCCESS';
333: l_cln_sts := 'INITIATED';
336: fnd_message.set_token('TYPE','Catalogue Item Subscription');
337: l_cln_msg := fnd_message.get;
338:
339:
340: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_sent THEN
341: l_create_flag := false;
342: l_cln_pt := 'APPS';
343: l_cln_sts := 'STARTED';
344: l_cln_doc_sts := 'SUCCESS';
347: fnd_message.set_token('TYPE','Catalogue Item Subscription');
348: l_cln_msg := fnd_message.get;
349:
350:
351: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_success THEN
352: l_create_flag := false;
353: l_cln_pt := 'B2B_SERVER';
354: l_cln_doc_sts := 'SUCCESS';
355: l_cln_sts := 'COMPLETED';
358: fnd_message.set_token('TYPE','Catalogue Item Subscription');
359: l_cln_msg := fnd_message.get;
360:
361:
362: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_fail THEN
363: l_create_flag := false;
364: l_cln_pt := 'B2B_SERVER';
365: l_cln_doc_sts := 'SUCCESS';
366: l_cln_sts := 'COMPLETED';
369: fnd_message.set_token('TYPE','Catalogue Item Subscription');
370: l_cln_msg := fnd_message.get;
371:
372:
373: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_error THEN
374: l_create_flag := false;
375: l_cln_doc_sts := 'ERROR';
376: l_cln_pt := 'B2B_SERVER';
377: l_cln_sts := 'ERROR';
383:
384: END IF;
385:
386: --TBD:cin ack case
387: ELSIF l_doc_type = m4u_dmd_utils.c_type_cin THEN
388:
389: l_cln_doc_id := l_doc_type || '.' ||l_doc_id;
390: l_cln_ref_id := l_doc_type || '.' ||l_doc_id;
391: l_cln_type := l_doc_type;
392: l_cln_doc_type := l_doc_type;
393: l_cln_dtl_msg := l_processing_msg;
394:
395:
396: IF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count = 0 THEN
397:
398: l_create_flag := true;
399: l_cln_pt := 'B2B_SERVER';
400: l_cln_sts := 'INITIATED';
399: l_cln_pt := 'B2B_SERVER';
400: l_cln_sts := 'INITIATED';
401: l_cln_doc_sts := 'SUCCESS';
402: l_cln_disp := 'PENDING';
403: l_payload_dir := m4u_dmd_utils.c_dir_in;
404: fnd_message.set_name('CLN','M4U_DMD_REQUEST_INIT');
405: fnd_message.set_token('TYPE','Catalogue Item Notification');
406: l_cln_msg := fnd_message.get;
407:
404: fnd_message.set_name('CLN','M4U_DMD_REQUEST_INIT');
405: fnd_message.set_token('TYPE','Catalogue Item Notification');
406: l_cln_msg := fnd_message.get;
407:
408: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count > 0 THEN
409: l_create_flag := false;
410: l_cln_pt := 'B2B_SERVER';
411: l_cln_sts := 'INITIATED';
412: l_cln_doc_sts := 'SUCCESS';
410: l_cln_pt := 'B2B_SERVER';
411: l_cln_sts := 'INITIATED';
412: l_cln_doc_sts := 'SUCCESS';
413: l_cln_disp := 'PENDING';
414: l_payload_dir := m4u_dmd_utils.c_dir_in;
415: fnd_message.set_name('CLN','M4U_DMD_REQUEST_RETRY');
416: fnd_message.set_token('TYPE','Catalogue Item Notification');
417: l_cln_msg := fnd_message.get;
418:
416: fnd_message.set_token('TYPE','Catalogue Item Notification');
417: l_cln_msg := fnd_message.get;
418:
419: --CIN sent to plm
420: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_sent
421: AND l_payload_type <> m4u_dmd_utils.c_type_cin_ack THEN
422: l_create_flag := false;
423: l_cln_pt := 'APPS';
424: l_cln_sts := 'STARTED';
417: l_cln_msg := fnd_message.get;
418:
419: --CIN sent to plm
420: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_sent
421: AND l_payload_type <> m4u_dmd_utils.c_type_cin_ack THEN
422: l_create_flag := false;
423: l_cln_pt := 'APPS';
424: l_cln_sts := 'STARTED';
425: l_cln_doc_sts := 'SUCCESS';
423: l_cln_pt := 'APPS';
424: l_cln_sts := 'STARTED';
425: l_cln_doc_sts := 'SUCCESS';
426: l_cln_disp := 'PENDING';
427: l_payload_dir := m4u_dmd_utils.c_dir_in;
428: fnd_message.set_name('CLN','M4U_DMD_REQUEST_SENT');
429: fnd_message.set_token('TYPE','Catalogue Item Notification');
430: l_cln_msg := fnd_message.get;
431:
428: fnd_message.set_name('CLN','M4U_DMD_REQUEST_SENT');
429: fnd_message.set_token('TYPE','Catalogue Item Notification');
430: l_cln_msg := fnd_message.get;
431:
432: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_fail
433: AND l_payload_type <> m4u_dmd_utils.c_type_cin_ack THEN
434: l_create_flag := false;
435: l_cln_pt := 'APPS';
436: l_cln_sts := 'ERROR';
429: fnd_message.set_token('TYPE','Catalogue Item Notification');
430: l_cln_msg := fnd_message.get;
431:
432: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_fail
433: AND l_payload_type <> m4u_dmd_utils.c_type_cin_ack THEN
434: l_create_flag := false;
435: l_cln_pt := 'APPS';
436: l_cln_sts := 'ERROR';
437: l_cln_doc_sts := 'ERROR';
435: l_cln_pt := 'APPS';
436: l_cln_sts := 'ERROR';
437: l_cln_doc_sts := 'ERROR';
438: l_cln_disp := 'REJECTED';
439: l_payload_dir := m4u_dmd_utils.c_dir_in;
440:
441: fnd_message.set_name('CLN','M4U_DMD_REQUEST_FAILURE');
442: fnd_message.set_token('TYPE','Catalogue Item Notification');
443: l_cln_msg := fnd_message.get;
442: fnd_message.set_token('TYPE','Catalogue Item Notification');
443: l_cln_msg := fnd_message.get;
444:
445:
446: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_error
447: AND l_payload_type <> m4u_dmd_utils.c_type_cin_ack THEN
448: l_create_flag := false;
449: l_cln_doc_sts := 'ERROR';
450: l_cln_pt := 'APPS';
443: l_cln_msg := fnd_message.get;
444:
445:
446: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_error
447: AND l_payload_type <> m4u_dmd_utils.c_type_cin_ack THEN
448: l_create_flag := false;
449: l_cln_doc_sts := 'ERROR';
450: l_cln_pt := 'APPS';
451: l_cln_sts := 'ERROR';
449: l_cln_doc_sts := 'ERROR';
450: l_cln_pt := 'APPS';
451: l_cln_sts := 'ERROR';
452: l_cln_disp := 'FAILED';
453: l_payload_dir := m4u_dmd_utils.c_dir_in;
454: fnd_message.set_name('CLN','M4U_DMD_REQUEST_ERROR');
455: fnd_message.set_token('TYPE','Catalogue Item Notification');
456: l_cln_msg := fnd_message.get;
457: -- CIN response sent
454: fnd_message.set_name('CLN','M4U_DMD_REQUEST_ERROR');
455: fnd_message.set_token('TYPE','Catalogue Item Notification');
456: l_cln_msg := fnd_message.get;
457: -- CIN response sent
458: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_sent
459: AND l_payload_type = m4u_dmd_utils.c_type_cin_ack THEN
460: l_create_flag := false;
461: l_cln_pt := 'B2B_SERVER';
462: l_cln_doc_sts := 'SUCCESS';
455: fnd_message.set_token('TYPE','Catalogue Item Notification');
456: l_cln_msg := fnd_message.get;
457: -- CIN response sent
458: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_sent
459: AND l_payload_type = m4u_dmd_utils.c_type_cin_ack THEN
460: l_create_flag := false;
461: l_cln_pt := 'B2B_SERVER';
462: l_cln_doc_sts := 'SUCCESS';
463: l_cln_sts := 'STARTED';
461: l_cln_pt := 'B2B_SERVER';
462: l_cln_doc_sts := 'SUCCESS';
463: l_cln_sts := 'STARTED';
464: l_cln_disp := 'PENDING';
465: l_payload_dir := m4u_dmd_utils.c_dir_out;
466: fnd_message.set_name('CLN','M4U_DMD_REQUEST_SENT');
467: fnd_message.set_token('TYPE','Catalogue Item Notification Response');
468: l_cln_msg := fnd_message.get;
469:
467: fnd_message.set_token('TYPE','Catalogue Item Notification Response');
468: l_cln_msg := fnd_message.get;
469:
470: -- CIN response sent
471: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_error
472: AND l_payload_type = m4u_dmd_utils.c_type_cin_ack THEN
473: l_create_flag := false;
474: l_cln_doc_sts := 'ERROR';
475: l_cln_pt := 'B2B_SERVER';
468: l_cln_msg := fnd_message.get;
469:
470: -- CIN response sent
471: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_error
472: AND l_payload_type = m4u_dmd_utils.c_type_cin_ack THEN
473: l_create_flag := false;
474: l_cln_doc_sts := 'ERROR';
475: l_cln_pt := 'B2B_SERVER';
476: l_cln_sts := 'ERROR';
474: l_cln_doc_sts := 'ERROR';
475: l_cln_pt := 'B2B_SERVER';
476: l_cln_sts := 'ERROR';
477: l_cln_disp := 'FAILED';
478: l_payload_dir := m4u_dmd_utils.c_dir_out;
479: fnd_message.set_name('CLN','M4U_DMD_REQUEST_ERROR');
480: fnd_message.set_token('TYPE','Catalogue Item Notification Response');
481: l_cln_msg := fnd_message.get;
482:
480: fnd_message.set_token('TYPE','Catalogue Item Notification Response');
481: l_cln_msg := fnd_message.get;
482:
483: -- CIN response sent
484: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_fail
485: AND l_payload_type = m4u_dmd_utils.c_type_cin_ack THEN
486: l_create_flag := false;
487: l_cln_doc_sts := 'ERROR';
488: l_cln_pt := 'B2B_SERVER';
481: l_cln_msg := fnd_message.get;
482:
483: -- CIN response sent
484: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_fail
485: AND l_payload_type = m4u_dmd_utils.c_type_cin_ack THEN
486: l_create_flag := false;
487: l_cln_doc_sts := 'ERROR';
488: l_cln_pt := 'B2B_SERVER';
489: l_cln_sts := 'ERROR';
487: l_cln_doc_sts := 'ERROR';
488: l_cln_pt := 'B2B_SERVER';
489: l_cln_sts := 'ERROR';
490: l_cln_disp := 'FAILED';
491: l_payload_dir := m4u_dmd_utils.c_dir_out;
492: fnd_message.set_name('CLN','M4U_DMD_REQUEST_ERROR');
493: fnd_message.set_token('TYPE','Catalogue Item Notification Response');
494: l_cln_msg := fnd_message.get;
495:
496:
497: END IF;
498:
499:
500: ELSIF l_doc_type = m4u_dmd_utils.c_type_cic THEN
501:
502: l_create_flag := false;
503: l_cln_doc_id := m4u_dmd_utils.c_type_cin || '.' || l_m4u_doc_rec.ref_doc_id;
504: l_cln_type := m4u_dmd_utils.c_type_cin;
499:
500: ELSIF l_doc_type = m4u_dmd_utils.c_type_cic THEN
501:
502: l_create_flag := false;
503: l_cln_doc_id := m4u_dmd_utils.c_type_cin || '.' || l_m4u_doc_rec.ref_doc_id;
504: l_cln_type := m4u_dmd_utils.c_type_cin;
505: l_cln_ref_id := m4u_dmd_utils.c_type_cin || '.' || l_m4u_doc_rec.ref_doc_id;
506:
507: l_cln_doc_type := l_doc_type;
500: ELSIF l_doc_type = m4u_dmd_utils.c_type_cic THEN
501:
502: l_create_flag := false;
503: l_cln_doc_id := m4u_dmd_utils.c_type_cin || '.' || l_m4u_doc_rec.ref_doc_id;
504: l_cln_type := m4u_dmd_utils.c_type_cin;
505: l_cln_ref_id := m4u_dmd_utils.c_type_cin || '.' || l_m4u_doc_rec.ref_doc_id;
506:
507: l_cln_doc_type := l_doc_type;
508: l_payload_dir := nvl(l_payload_dir,m4u_dmd_utils.c_dir_out);
501:
502: l_create_flag := false;
503: l_cln_doc_id := m4u_dmd_utils.c_type_cin || '.' || l_m4u_doc_rec.ref_doc_id;
504: l_cln_type := m4u_dmd_utils.c_type_cin;
505: l_cln_ref_id := m4u_dmd_utils.c_type_cin || '.' || l_m4u_doc_rec.ref_doc_id;
506:
507: l_cln_doc_type := l_doc_type;
508: l_payload_dir := nvl(l_payload_dir,m4u_dmd_utils.c_dir_out);
509: l_cln_dtl_msg := l_processing_msg;
504: l_cln_type := m4u_dmd_utils.c_type_cin;
505: l_cln_ref_id := m4u_dmd_utils.c_type_cin || '.' || l_m4u_doc_rec.ref_doc_id;
506:
507: l_cln_doc_type := l_doc_type;
508: l_payload_dir := nvl(l_payload_dir,m4u_dmd_utils.c_dir_out);
509: l_cln_dtl_msg := l_processing_msg;
510:
511: IF l_m4u_doc_rec.parameter1 = 'ACCEPTED' THEN
512: l_cln_disp := 'ACCEPTED' ;
517: ELSIF l_m4u_doc_rec.parameter1 = 'REVIEW' THEN
518: l_cln_disp := 'CORRECTION' ;
519: END IF;
520:
521: IF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count = 0 THEN
522:
523: l_cln_pt := 'APPS';
524: l_cln_doc_sts := 'SUCCESS';
525: l_cln_sts := 'STARTED';
526: fnd_message.set_name('CLN','M4U_DMD_REQUEST_INIT');
527: fnd_message.set_token('TYPE','Catalogue Item Confirmation');
528: l_cln_msg := fnd_message.get;
529:
530: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_ready AND l_retry_count > 0 THEN
531:
532: l_cln_pt := 'B2B_SERVER';
533: l_cln_doc_sts := 'SUCCESS';
534: l_cln_sts := 'STARTED';
536: fnd_message.set_token('TYPE','Catalogue Item Confirmation');
537: l_cln_msg := fnd_message.get;
538:
539:
540: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_sent THEN
541:
542: l_cln_pt := 'B2B_SERVER';
543: l_cln_doc_sts := 'SUCCESS';
544: l_cln_sts := 'STARTED';
546: fnd_message.set_token('TYPE','Catalogue Item Confirmation');
547: l_cln_msg := fnd_message.get;
548:
549:
550: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_success THEN
551:
552: l_cln_pt := 'B2B_SERVER';
553: l_cln_doc_sts := 'SUCCESS';
554: l_cln_sts := 'COMPLETED';
556: fnd_message.set_token('TYPE','Catalogue Item Confirmation');
557: l_cln_msg := fnd_message.get;
558:
559:
560: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_fail THEN
561:
562: l_cln_pt := 'B2B_SERVER';
563: l_cln_sts := 'ERROR';
564: l_cln_doc_sts := 'ERROR';
566: fnd_message.set_token('TYPE','Catalogue Item Confirmation');
567: l_cln_msg := fnd_message.get;
568:
569:
570: ELSIF l_doc_sts = m4u_dmd_utils.c_sts_error THEN
571:
572: l_cln_doc_sts := 'ERROR';
573: l_cln_pt := 'B2B_SERVER';
574: l_cln_sts := 'ERROR';
587:
588:
589: IF l_create_flag THEN
590:
591: m4u_dmd_utils.log('Call cln.create_collaboration',2);
592: cln_ch_collaboration_pkg.create_collaboration
593: (
594: x_return_status => l_ret_sts,
595: x_msg_data => l_ret_msg,
592: cln_ch_collaboration_pkg.create_collaboration
593: (
594: x_return_status => l_ret_sts,
595: x_msg_data => l_ret_msg,
596: p_app_id => m4u_dmd_utils.c_app_id,
597: p_ref_id => l_cln_ref_id,
598: p_org_id => fnd_global.org_id,
599: p_rel_no => null,
600: p_doc_no => l_cln_doc_id,
643: p_attribute15 => l_m4u_doc_rec.lparameter1,
644: p_dattribute1 => l_m4u_doc_rec.doc_timestamp,
645: x_coll_id => l_cln_id
646: );
647: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
648: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
649: m4u_dmd_utils.log('l_cln_id -|' || l_cln_id || '|',6);
650: END IF;
651:
644: p_dattribute1 => l_m4u_doc_rec.doc_timestamp,
645: x_coll_id => l_cln_id
646: );
647: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
648: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
649: m4u_dmd_utils.log('l_cln_id -|' || l_cln_id || '|',6);
650: END IF;
651:
652: m4u_dmd_utils.log('Query collaboration_id',6);
645: x_coll_id => l_cln_id
646: );
647: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
648: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
649: m4u_dmd_utils.log('l_cln_id -|' || l_cln_id || '|',6);
650: END IF;
651:
652: m4u_dmd_utils.log('Query collaboration_id',6);
653: SELECT collaboration_id
648: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
649: m4u_dmd_utils.log('l_cln_id -|' || l_cln_id || '|',6);
650: END IF;
651:
652: m4u_dmd_utils.log('Query collaboration_id',6);
653: SELECT collaboration_id
654: INTO l_cln_id
655: FROM cln_coll_hist_hdr
656: WHERE application_reference_id = l_cln_ref_id
655: FROM cln_coll_hist_hdr
656: WHERE application_reference_id = l_cln_ref_id
657: AND collaboration_type = l_cln_type
658: AND rownum < 2;
659: m4u_dmd_utils.log('l_cln_id -|' || l_cln_id || '|',6);
660:
661:
662: m4u_dmd_utils.log('Call cln.update_collaboration',6);
663: cln_ch_collaboration_pkg.update_collaboration
658: AND rownum < 2;
659: m4u_dmd_utils.log('l_cln_id -|' || l_cln_id || '|',6);
660:
661:
662: m4u_dmd_utils.log('Call cln.update_collaboration',6);
663: cln_ch_collaboration_pkg.update_collaboration
664: (
665: x_return_status => l_ret_sts,
666: x_msg_data => l_ret_msg,
664: (
665: x_return_status => l_ret_sts,
666: x_msg_data => l_ret_msg,
667: p_coll_id => l_cln_id,
668: p_app_id => m4u_dmd_utils.c_app_id,
669: p_ref_id => l_cln_ref_id,
670: p_rel_no => NULL,
671: p_doc_no => l_cln_doc_id,
672: p_doc_rev_no => NULL,
708: p_dattribute1 => l_m4u_doc_rec.doc_timestamp,
709: x_dtl_coll_id => l_cln_dtl_id,
710: p_xml_event_key => null
711: );
712: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
713: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
714: m4u_dmd_utils.log('l_cln_dtl_id -|' || l_cln_dtl_id|| '|',6);
715:
716:
709: x_dtl_coll_id => l_cln_dtl_id,
710: p_xml_event_key => null
711: );
712: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
713: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
714: m4u_dmd_utils.log('l_cln_dtl_id -|' || l_cln_dtl_id|| '|',6);
715:
716:
717: IF l_cln_dtl_msg IS NOT NULL THEN
710: p_xml_event_key => null
711: );
712: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
713: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
714: m4u_dmd_utils.log('l_cln_dtl_id -|' || l_cln_dtl_id|| '|',6);
715:
716:
717: IF l_cln_dtl_msg IS NOT NULL THEN
718: -- add coll message
715:
716:
717: IF l_cln_dtl_msg IS NOT NULL THEN
718: -- add coll message
719: m4u_dmd_utils.log('Call cln.add_collaboration_messages',6);
720: cln_ch_collaboration_pkg.add_collaboration_messages
721: (
722: x_return_status => l_ret_sts,
723: x_msg_data => l_ret_msg,
728: p_ref4 => NULL,
729: p_ref5 => NULL,
730: p_dtl_msg => l_cln_dtl_msg
731: );
732: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
733: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
734:
735: END IF;
736:
729: p_ref5 => NULL,
730: p_dtl_msg => l_cln_dtl_msg
731: );
732: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
733: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
734:
735: END IF;
736:
737: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
733: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
734:
735: END IF;
736:
737: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
738: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
739: m4u_dmd_utils.log('Exiting m4u_cln_pkg.update_collab - Success' ,6);
740:
741: RETURN 'SUCCESS';
734:
735: END IF;
736:
737: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
738: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
739: m4u_dmd_utils.log('Exiting m4u_cln_pkg.update_collab - Success' ,6);
740:
741: RETURN 'SUCCESS';
742:
735: END IF;
736:
737: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',6);
738: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',6);
739: m4u_dmd_utils.log('Exiting m4u_cln_pkg.update_collab - Success' ,6);
740:
741: RETURN 'SUCCESS';
742:
743: EXCEPTION
741: RETURN 'SUCCESS';
742:
743: EXCEPTION
744: WHEN OTHERS THEN
745: m4u_dmd_utils.log('m4u_cln_pkg.update_collab',6);
746: m4u_dmd_utils.log('Unexpected error occured while processing',6);
747: m4u_dmd_utils.log(SQLCODE || '-' || SQLERRM,6);
748: RETURN 'SUCCESS';
749: END update_collab;
742:
743: EXCEPTION
744: WHEN OTHERS THEN
745: m4u_dmd_utils.log('m4u_cln_pkg.update_collab',6);
746: m4u_dmd_utils.log('Unexpected error occured while processing',6);
747: m4u_dmd_utils.log(SQLCODE || '-' || SQLERRM,6);
748: RETURN 'SUCCESS';
749: END update_collab;
750:
743: EXCEPTION
744: WHEN OTHERS THEN
745: m4u_dmd_utils.log('m4u_cln_pkg.update_collab',6);
746: m4u_dmd_utils.log('Unexpected error occured while processing',6);
747: m4u_dmd_utils.log(SQLCODE || '-' || SQLERRM,6);
748: RETURN 'SUCCESS';
749: END update_collab;
750:
751:
789: l_ext_process_id NUMBER;
790: BEGIN
791:
792:
793: m4u_dmd_utils.log('Entering m4u_cln_pkg.add_or_update_tp_detail',2);
794: m4u_dmd_utils.log('p_tp_hdr_id -|' || p_tp_hdr_id || '|',1);
795: m4u_dmd_utils.log('p_direction -|' || p_direction || '|',1);
796:
797:
790: BEGIN
791:
792:
793: m4u_dmd_utils.log('Entering m4u_cln_pkg.add_or_update_tp_detail',2);
794: m4u_dmd_utils.log('p_tp_hdr_id -|' || p_tp_hdr_id || '|',1);
795: m4u_dmd_utils.log('p_direction -|' || p_direction || '|',1);
796:
797:
798: --------------------------------------------------------------------------
791:
792:
793: m4u_dmd_utils.log('Entering m4u_cln_pkg.add_or_update_tp_detail',2);
794: m4u_dmd_utils.log('p_tp_hdr_id -|' || p_tp_hdr_id || '|',1);
795: m4u_dmd_utils.log('p_direction -|' || p_direction || '|',1);
796:
797:
798: --------------------------------------------------------------------------
799: --Set ECX api input params
803: l_party_type := m4u_cln_pkg.c_party_type;
804: l_doc_conf := '2';
805: l_map := 'm4u_230_cin_out';
806:
807: IF p_direction = m4u_dmd_utils.c_dir_out THEN
808: --out specific values
809: l_src_loc := 7777;
810: l_ext_subtype := m4u_cln_pkg.c_xmlg_styp_out;
811: l_txn_subtype := m4u_cln_pkg.c_xmlg_styp_out;
826: l_passwd := null;
827: END IF;
828: --------------------------------------------------------------------------
829: -- Query ecx_tp_detail_id
830: m4u_dmd_utils.log('Query ecx_tp_detail_id',2);
831: l_progress := 'Query ecx_tp_detail_id';
832:
833: BEGIN
834: SELECT tp_detail_id
852: AND txn.transaction_subtype = l_txn_subtype
853: AND tph.tp_header_id = p_tp_hdr_id;
854:
855: l_record_found := TRUE;
856: m4u_dmd_utils.log('l_tp_dtl_id -|' || l_tp_dtl_id || '|',1);
857:
858: EXCEPTION
859: WHEN NO_DATA_FOUND THEN
860: m4u_dmd_utils.log('No data found',1);
856: m4u_dmd_utils.log('l_tp_dtl_id -|' || l_tp_dtl_id || '|',1);
857:
858: EXCEPTION
859: WHEN NO_DATA_FOUND THEN
860: m4u_dmd_utils.log('No data found',1);
861: l_record_found := FALSE;
862: END;
863:
864: -------------------------------------------------------------------------
862: END;
863:
864: -------------------------------------------------------------------------
865: --Query extp.ext_process_id
866: m4u_dmd_utils.log('Query extp.ext_process_id',1);
867: l_progress := 'Query ecx_tp_detail_id';
868:
869:
870: SELECT extp.ext_process_id
882: AND txn.party_type = l_party_type
883: AND txn.transaction_type = l_txn_type
884: AND txn.transaction_subtype = l_txn_subtype;
885:
886: m4u_dmd_utils.log('l_ext_process_id -|' || l_ext_process_id || '|',1);
887: -------------------------------------------------------------------------
888: -- Create or update ECX tp detail
889: IF NOT l_record_found THEN
890: --Create
887: -------------------------------------------------------------------------
888: -- Create or update ECX tp detail
889: IF NOT l_record_found THEN
890: --Create
891: m4u_dmd_utils.log('Call ecx_tp_api.create_tp_detail',1);
892: l_progress := 'Call ecx_tp_api.create_tp_detail';
893:
894: ecx_tp_api.create_tp_detail
895: (
910: p_external_tp_location_code => null,
911: p_confirmation => l_doc_conf
912: );
913:
914: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',1);
915: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',1);
916:
917:
918:
911: p_confirmation => l_doc_conf
912: );
913:
914: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',1);
915: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',1);
916:
917:
918:
919: IF l_ret_sts <> '0' THEN
918:
919: IF l_ret_sts <> '0' THEN
920: x_ret_sts := fnd_api.g_ret_sts_error;
921: x_ret_msg := l_ret_msg;
922: m4u_dmd_utils.log('Exiting add_or_update_tp_detail - Failure',6);
923: RETURN;
924: END IF;
925: ELSE
926: --Update
923: RETURN;
924: END IF;
925: ELSE
926: --Update
927: m4u_dmd_utils.log('Call ecx_tp_api.update_tp_detail',1);
928: l_progress := 'Call ecx_tp_api.update_tp_detail';
929:
930: ecx_tp_api.update_tp_detail
931: (
946: p_confirmation => l_doc_conf,
947: p_passupd_flag => 'Y'
948: );
949:
950: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',1);
951: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',1);
952:
953: IF l_ret_sts <> '0' THEN
954: x_ret_sts := fnd_api.g_ret_sts_error;
947: p_passupd_flag => 'Y'
948: );
949:
950: m4u_dmd_utils.log('l_ret_sts -|' || l_ret_sts || '|',1);
951: m4u_dmd_utils.log('l_ret_msg -|' || l_ret_msg || '|',1);
952:
953: IF l_ret_sts <> '0' THEN
954: x_ret_sts := fnd_api.g_ret_sts_error;
955: x_ret_msg := l_ret_msg;
952:
953: IF l_ret_sts <> '0' THEN
954: x_ret_sts := fnd_api.g_ret_sts_error;
955: x_ret_msg := l_ret_msg;
956: m4u_dmd_utils.log('Exiting add_or_update_tp_detail - Failure',6);
957: RETURN;
958: END IF;
959: END IF;
960: -------------------------------------------------------------------------
960: -------------------------------------------------------------------------
961: x_ret_sts := fnd_api.g_ret_sts_success;
962: x_ret_msg := '';
963:
964: m4u_dmd_utils.log('Exiting add_or_update_tp_detail - Success',2);
965: RETURN; /*success*/
966: EXCEPTION
967: WHEN OTHERS THEN
968: x_ret_sts := fnd_api.g_ret_sts_error;
1006: l_record_found BOOLEAN;
1007:
1008: BEGIN
1009:
1010: m4u_dmd_utils.log('Entering m4u_dmd_utils.setup_cln',2);
1011:
1012: l_location_code := m4u_cln_pkg.c_party_site;
1013: l_description := 'Dummy seeded location for M4U transactions';
1014: l_addr_line_1 := 'Princeton';
1018: -- Query HR Locations
1019: -- Check if record exists. Create Locations if it does not else Update Location value
1020: l_progress := 'Query for hr_locations_all based on location_code';
1021: BEGIN
1022: m4u_dmd_utils.log('Query hr_locations_all',1);
1023: SELECT location_id, object_version_number
1024: INTO l_location_id, l_obj_ver_num
1025: FROM hr_locations_all
1026: WHERE location_code = l_location_code
1026: WHERE location_code = l_location_code
1027: AND ROWNUM < 2;
1028: l_record_found := TRUE;
1029:
1030: m4u_dmd_utils.log('l_location_id -|'||l_location_id || '|', 1);
1031: m4u_dmd_utils.log('l_obj_ver_num -|'||l_obj_ver_num || '|', 1);
1032: EXCEPTION
1033: WHEN NO_DATA_FOUND THEN
1034: m4u_dmd_utils.log('No data found', 1);
1027: AND ROWNUM < 2;
1028: l_record_found := TRUE;
1029:
1030: m4u_dmd_utils.log('l_location_id -|'||l_location_id || '|', 1);
1031: m4u_dmd_utils.log('l_obj_ver_num -|'||l_obj_ver_num || '|', 1);
1032: EXCEPTION
1033: WHEN NO_DATA_FOUND THEN
1034: m4u_dmd_utils.log('No data found', 1);
1035: l_record_found := FALSE;
1030: m4u_dmd_utils.log('l_location_id -|'||l_location_id || '|', 1);
1031: m4u_dmd_utils.log('l_obj_ver_num -|'||l_obj_ver_num || '|', 1);
1032: EXCEPTION
1033: WHEN NO_DATA_FOUND THEN
1034: m4u_dmd_utils.log('No data found', 1);
1035: l_record_found := FALSE;
1036: END;
1037: -----------------------------------------------------------------------------
1038: --HR location
1037: -----------------------------------------------------------------------------
1038: --HR location
1039: IF NOT l_record_found THEN
1040: --Create
1041: m4u_dmd_utils.log('Call HR_LOCATION_API.create_location', 2);
1042: l_progress := 'Call to HR_LOCATION_API.create_location';
1043:
1044: HR_LOCATION_API.create_location
1045: (
1053: p_location_id => l_location_id,
1054: p_object_version_number => l_obj_ver_num
1055: );
1056:
1057: m4u_dmd_utils.log('l_location_id -|'||l_location_id || '|', 1);
1058: m4u_dmd_utils.log('l_obj_ver_num -|'||l_obj_ver_num || '|', 1);
1059:
1060: ELSE
1061: --Update
1054: p_object_version_number => l_obj_ver_num
1055: );
1056:
1057: m4u_dmd_utils.log('l_location_id -|'||l_location_id || '|', 1);
1058: m4u_dmd_utils.log('l_obj_ver_num -|'||l_obj_ver_num || '|', 1);
1059:
1060: ELSE
1061: --Update
1062: m4u_dmd_utils.log('Call HR_LOCATION_API.update_location', 2);
1058: m4u_dmd_utils.log('l_obj_ver_num -|'||l_obj_ver_num || '|', 1);
1059:
1060: ELSE
1061: --Update
1062: m4u_dmd_utils.log('Call HR_LOCATION_API.update_location', 2);
1063: l_progress := 'Call HR_LOCATION_API.update_location';
1064:
1065: HR_LOCATION_API.update_location
1066: (
1074: p_location_id => l_location_id,
1075: p_object_version_number => l_obj_ver_num
1076: );
1077:
1078: m4u_dmd_utils.log('l_location_id -|'||l_location_id || '|', 1);
1079: m4u_dmd_utils.log('l_obj_ver_num -|'||l_obj_ver_num || '|', 1);
1080: END IF;
1081:
1082: -- reset the value for next phase
1075: p_object_version_number => l_obj_ver_num
1076: );
1077:
1078: m4u_dmd_utils.log('l_location_id -|'||l_location_id || '|', 1);
1079: m4u_dmd_utils.log('l_obj_ver_num -|'||l_obj_ver_num || '|', 1);
1080: END IF;
1081:
1082: -- reset the value for next phase
1083: l_record_found := FALSE;
1093: AND party_id = l_location_id
1094: AND party_site_id = l_location_id;
1095:
1096: l_record_found := TRUE;
1097: m4u_dmd_utils.log('l_tp_hdr_id -'||l_tp_hdr_id || '|', 1);
1098: EXCEPTION
1099: WHEN NO_DATA_FOUND THEN
1100: m4u_dmd_utils.log('No data found', 1);
1101: l_record_found := FALSE;
1096: l_record_found := TRUE;
1097: m4u_dmd_utils.log('l_tp_hdr_id -'||l_tp_hdr_id || '|', 1);
1098: EXCEPTION
1099: WHEN NO_DATA_FOUND THEN
1100: m4u_dmd_utils.log('No data found', 1);
1101: l_record_found := FALSE;
1102: END;
1103: -----------------------------------------------------------------------------
1104: --ECX TP Header
1103: -----------------------------------------------------------------------------
1104: --ECX TP Header
1105: IF NOT l_record_found THEN
1106: --create
1107: m4u_dmd_utils.log('Call ecx_tp_api.create_trading_partner', 2);
1108: l_progress := 'Call ecx_tp_api.create_trading_partner';
1109:
1110: ecx_tp_api.create_trading_partner
1111: (
1117: p_party_site_id => l_location_id,
1118: p_company_admin_email => m4u_cln_pkg.c_tp_email
1119: );
1120:
1121: m4u_dmd_utils.log('l_ret_msg -|'||l_ret_msg ||'|', 1);
1122: m4u_dmd_utils.log('l_ret_sts -|'||l_ret_sts ||'|', 1);
1123: IF l_ret_sts <> '0' THEN
1124: l_err_msg := l_ret_msg;
1125: RAISE FND_API.G_EXC_ERROR;
1118: p_company_admin_email => m4u_cln_pkg.c_tp_email
1119: );
1120:
1121: m4u_dmd_utils.log('l_ret_msg -|'||l_ret_msg ||'|', 1);
1122: m4u_dmd_utils.log('l_ret_sts -|'||l_ret_sts ||'|', 1);
1123: IF l_ret_sts <> '0' THEN
1124: l_err_msg := l_ret_msg;
1125: RAISE FND_API.G_EXC_ERROR;
1126: END IF;
1127:
1128:
1129: ELSE
1130: --Update
1131: m4u_dmd_utils.log('Call ecx_tp_api.update_trading_partner', 2);
1132: l_progress := 'Call ecx_tp_api.update_trading_partner';
1133:
1134: ecx_tp_api.update_trading_partner
1135: (
1138: p_tp_header_id => l_tp_hdr_id,
1139: p_company_admin_email => m4u_cln_pkg.c_tp_email
1140: );
1141:
1142: m4u_dmd_utils.log('l_ret_msg -|'||l_ret_msg ||'|', 1);
1143: m4u_dmd_utils.log('l_ret_sts -|'||l_ret_sts ||'|', 1);
1144: IF l_ret_sts <> '0' THEN
1145: l_err_msg := l_ret_msg;
1146: RAISE FND_API.G_EXC_ERROR;
1139: p_company_admin_email => m4u_cln_pkg.c_tp_email
1140: );
1141:
1142: m4u_dmd_utils.log('l_ret_msg -|'||l_ret_msg ||'|', 1);
1143: m4u_dmd_utils.log('l_ret_sts -|'||l_ret_sts ||'|', 1);
1144: IF l_ret_sts <> '0' THEN
1145: l_err_msg := l_ret_msg;
1146: RAISE FND_API.G_EXC_ERROR;
1147: END IF;
1150: --TP details
1151:
1152: --Out txn
1153: l_progress := 'Call update_tp_detail - OUT';
1154: update_tp_detail(l_tp_hdr_id,m4u_dmd_utils.c_dir_out,l_ret_sts,l_ret_msg);
1155: IF l_ret_sts <> fnd_api.g_ret_sts_success THEN
1156: l_err_msg := l_ret_msg;
1157: RAISE FND_API.G_EXC_ERROR;
1158: END IF;
1157: RAISE FND_API.G_EXC_ERROR;
1158: END IF;
1159: --In txn
1160: l_progress := 'Call update_tp_detail - IN';
1161: update_tp_detail(l_tp_hdr_id,m4u_dmd_utils.c_dir_in ,l_ret_sts,l_ret_msg);
1162: IF l_ret_sts <> fnd_api.g_ret_sts_success THEN
1163: l_err_msg := l_ret_msg;
1164: RAISE FND_API.G_EXC_ERROR;
1165: END IF;
1166: -----------------------------------------------------------------------------
1167: --Done, return success
1168: x_retcode := 0;
1169: x_errbuf := '';
1170: m4u_dmd_utils.log('Exiting m4u_dmd_utils.setup_cln - SUCCESS',2);
1171: RETURN; /*sucess*/
1172: EXCEPTION
1173: WHEN OTHERS THEN
1174: x_errbuf := 'Unexpected error at: ' || l_progress || '-' || l_err_msg ;