2: -- $Header: ECXRULEB.pls 120.4.12020000.2 2013/03/21 11:20:38 jmaddila ship $
3: --
4: --
5: -- rule (PUBLIC)
6: -- Standard XML Gateway Subscription rule function
7: -- IN:
8: -- p_subscription_guid - GUID of Subscription to be processed
9: -- p_event - Event to be processes
10: -- NOTE:
172: end outbound_rule;
173:
174:
175: -- Inbound_Rule (PUBLIC)
176: -- Standard XML Gateway Subscription rule function
177: -- IN:
178: -- p_subscription_guid - GUID of Subscription to be processed
179: -- p_event - Event to be processes
180: -- NOTE: Determines the Inbound Transaction Queue
178: -- p_subscription_guid - GUID of Subscription to be processed
179: -- p_event - Event to be processes
180: -- NOTE: Determines the Inbound Transaction Queue
181: --
182: -- Standard inbound_rule function
183:
184: function inbound_rule(
185: p_subscription_guid in raw,
186: p_event in out nocopy wf_event_t
188: is
189:
190: l_transaction_type varchar2(240);
191: l_transaction_subtype varchar2(240);
192: l_standard_code varchar2(2000);
193: l_standard_type varchar2(2000);
194: i_queue_name varchar2(2000);
195: v_ect_inengobj system.ecx_inengobj;
196: v_enqueueoptions dbms_aq.enqueue_options_t;
189:
190: l_transaction_type varchar2(240);
191: l_transaction_subtype varchar2(240);
192: l_standard_code varchar2(2000);
193: l_standard_type varchar2(2000);
194: i_queue_name varchar2(2000);
195: v_ect_inengobj system.ecx_inengobj;
196: v_enqueueoptions dbms_aq.enqueue_options_t;
197: v_messageproperties dbms_aq.message_properties_t;
241:
242: -- Get the data from the Event
243: l_transaction_type := p_event.getValueForParameter('ECX_TRANSACTION_TYPE');
244: l_transaction_subtype := p_event.getValueForParameter('ECX_TRANSACTION_SUBTYPE');
245: l_standard_code := p_event.getValueForParameter('ECX_MESSAGE_STANDARD');
246: l_standard_type := p_event.getValueForParameter('ECX_MESSAGE_TYPE');
247: -- we should pickup from event subscription and not from p_event VS
248: --debug_level := p_event.getValueForParameter('ECX_DEBUG_LEVEL');
249: --Party_site_id added for Bug #2183619
242: -- Get the data from the Event
243: l_transaction_type := p_event.getValueForParameter('ECX_TRANSACTION_TYPE');
244: l_transaction_subtype := p_event.getValueForParameter('ECX_TRANSACTION_SUBTYPE');
245: l_standard_code := p_event.getValueForParameter('ECX_MESSAGE_STANDARD');
246: l_standard_type := p_event.getValueForParameter('ECX_MESSAGE_TYPE');
247: -- we should pickup from event subscription and not from p_event VS
248: --debug_level := p_event.getValueForParameter('ECX_DEBUG_LEVEL');
249: --Party_site_id added for Bug #2183619
250: l_party_site_id := p_event.getValueForParameter('ECX_PARTY_SITE_ID');
253: 'Transaction Type ' || l_transaction_type);
254: wf_log_pkg.string(wf_log_pkg.level_statement, l_module,
255: 'Transaction Subtype '||l_transaction_subtype);
256: wf_log_pkg.string(wf_log_pkg.level_statement, l_module,
257: 'Standard Code ' || l_standard_code);
258: wf_log_pkg.string(wf_log_pkg.level_statement, l_module,
259: 'Debug Mode ' || debug_level);
260: --Party_site_id added for Bug #2183619
261: wf_log_pkg.string(wf_log_pkg.level_statement, l_module,
269: tp_header_id
270: into i_queue_name,
271: l_tp_header_id
272: from ecx_ext_processes eep,
273: ecx_standards es,
274: ecx_tp_details etd
275: where eep.ext_type = l_transaction_type
276: and eep.ext_subtype = l_transaction_subtype
277: and eep.direction = 'IN'
274: ecx_tp_details etd
275: where eep.ext_type = l_transaction_type
276: and eep.ext_subtype = l_transaction_subtype
277: and eep.direction = 'IN'
278: and eep.standard_id = es.standard_id
279: and es.standard_code = l_standard_code
280: and es.standard_type = l_standard_type
281: and etd.ext_process_id = eep.ext_process_id
282: and etd.source_tp_location_code = l_party_site_id;
275: where eep.ext_type = l_transaction_type
276: and eep.ext_subtype = l_transaction_subtype
277: and eep.direction = 'IN'
278: and eep.standard_id = es.standard_id
279: and es.standard_code = l_standard_code
280: and es.standard_type = l_standard_type
281: and etd.ext_process_id = eep.ext_process_id
282: and etd.source_tp_location_code = l_party_site_id;
283: Exception
276: and eep.ext_subtype = l_transaction_subtype
277: and eep.direction = 'IN'
278: and eep.standard_id = es.standard_id
279: and es.standard_code = l_standard_code
280: and es.standard_type = l_standard_type
281: and etd.ext_process_id = eep.ext_process_id
282: and etd.source_tp_location_code = l_party_site_id;
283: Exception
284: WHEN NO_DATA_FOUND THEN
573: return 'ERROR';
574: when invalid_tp_setup then
575:
576: ecx_debug.setErrorInfo(2,30,'ECX_RULE_INVALID_TP_SETUP',
577: 'p_standard_code',
578: l_standard_code,
579: 'p_transaction_type',
580: l_transaction_type,
581: 'p_transaction_subtype',
574: when invalid_tp_setup then
575:
576: ecx_debug.setErrorInfo(2,30,'ECX_RULE_INVALID_TP_SETUP',
577: 'p_standard_code',
578: l_standard_code,
579: 'p_transaction_type',
580: l_transaction_type,
581: 'p_transaction_subtype',
582: l_transaction_subtype,
593: ecx_utils.i_errparams);
594:
595: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
596: wf_log_pkg.string(wf_log_pkg.level_error, l_module,
597: 'The Standard:'||l_standard_code||
598: ' Transaction Type:'||l_transaction_type||
599: ' SubType:'||l_transaction_subtype||
600: ' Location Code'||l_party_site_id||
601: ' is not enabled in the XML Gateway Server. Pls check your Setup');
712: return 'ERROR';
713: end;
714:
715: -- process
716: ECX_STANDARD.ProcessXmlCover(i_map_code=> mapcode,
717: i_inpayload => p_event.GetEventData(),
718: i_debug_level => dbg);
719:
720: return 'SUCCESS';
758: 'exec_wf');
759: end if;
760:
761: select out_agent_guid, to_agent_guid, wf_process_type, wf_process_name,
762: priority, parameters, map_code, standard_type, standard_code
763: into l_out_guid, l_to_guid, l_wftype, l_wfname, l_pri, l_subparams,
764: l_map_code, l_std_type, l_std_code
765: from wf_event_subscriptions
766: where guid = p_subscription_guid;
786: wf_event.AddParameterToList('ECX_MAP_CODE', l_map_code, l_paramlist);
787: end if;
788: end if;
789:
790: if p_event.getValueForParameter('ECX_MESSAGE_STANDARD') is null then
791: if l_std_code is not null then
792: wf_event.AddParameterToList('ECX_MESSAGE_STANDARD', l_std_code, l_paramlist);
793: end if;
794: end if;
788: end if;
789:
790: if p_event.getValueForParameter('ECX_MESSAGE_STANDARD') is null then
791: if l_std_code is not null then
792: wf_event.AddParameterToList('ECX_MESSAGE_STANDARD', l_std_code, l_paramlist);
793: end if;
794: end if;
795:
796: if p_event.getValueForParameter('ECX_MESSAGE_TYPE') is null then
921: 'Mesage Type from doclogs: '|| p_message_type);
922: end if;
923: p_event.addParameterToList('ECX_MSGID', p_msgid);
924: p_event.addParameterToList('ECX_MESSAGE_TYPE', p_message_type);
925: p_event.addParameterToList('ECX_MESSAGE_STANDARD', p_message_code);
926: p_event.addParameterToList('ECX_DOCUMENT_ID', p_document_number);
927: p_event.addParameterToList('ECX_PARTY_ID', p_party_id);
928: p_event.addParameterToList('ECX_PARTY_SITE_ID', p_party_site_id);
929: p_event.addParameterToList('ECX_PARTY_TYPE', l_party_type);
1044:
1045: function isTPEnabled (
1046: p_transaction_type in varchar2,
1047: p_transaction_subtype in varchar2,
1048: p_standard_code in varchar2,
1049: p_standard_type in varchar2,
1050: p_party_site_id in varchar2,
1051: x_queue_name out nocopy varchar2,
1052: x_tp_header_id out nocopy number)
1045: function isTPEnabled (
1046: p_transaction_type in varchar2,
1047: p_transaction_subtype in varchar2,
1048: p_standard_code in varchar2,
1049: p_standard_type in varchar2,
1050: p_party_site_id in varchar2,
1051: x_queue_name out nocopy varchar2,
1052: x_tp_header_id out nocopy number)
1053:
1061: tp_header_id
1062: into x_queue_name,
1063: x_tp_header_id
1064: from ecx_ext_processes eep,
1065: ecx_standards es,
1066: ecx_tp_details etd
1067: where eep.ext_type = p_transaction_type
1068: and eep.ext_subtype = p_transaction_subtype
1069: and eep.direction = 'IN'
1066: ecx_tp_details etd
1067: where eep.ext_type = p_transaction_type
1068: and eep.ext_subtype = p_transaction_subtype
1069: and eep.direction = 'IN'
1070: and eep.standard_id = es.standard_id
1071: and es.standard_code = p_standard_code
1072: and es.standard_type = p_standard_type
1073: and etd.ext_process_id = eep.ext_process_id
1074: and etd.source_tp_location_code = p_party_site_id;
1067: where eep.ext_type = p_transaction_type
1068: and eep.ext_subtype = p_transaction_subtype
1069: and eep.direction = 'IN'
1070: and eep.standard_id = es.standard_id
1071: and es.standard_code = p_standard_code
1072: and es.standard_type = p_standard_type
1073: and etd.ext_process_id = eep.ext_process_id
1074: and etd.source_tp_location_code = p_party_site_id;
1075:
1068: and eep.ext_subtype = p_transaction_subtype
1069: and eep.direction = 'IN'
1070: and eep.standard_id = es.standard_id
1071: and es.standard_code = p_standard_code
1072: and es.standard_type = p_standard_type
1073: and etd.ext_process_id = eep.ext_process_id
1074: and etd.source_tp_location_code = p_party_site_id;
1075:
1076: return true;
1228: end setDebugMode;
1229:
1230: --
1231: -- TPPreProcessing
1232: -- Standard XML Gateway Subscription to perform User to TP and TP to
1233: -- transaction validation and also to perform the initial logging
1234: -- IN:
1235: -- p_subscription_guid - GUID of Subscription to be processed
1236: -- p_event - Event to be processed
1310:
1311: l_tran_type := p_event.getValueForParameter('ECX_TRANSACTION_TYPE');
1312: l_tran_subtype := p_event.getValueForParameter('ECX_TRANSACTION_SUBTYPE');
1313: l_std_type := p_event.getValueForParameter('ECX_MESSAGE_TYPE');
1314: l_std_code := p_event.getValueForParameter('ECX_MESSAGE_STANDARD');
1315: l_party_site_id := p_event.getValueForParameter('ECX_PARTY_SITE_ID');
1316: l_tp_user := p_event.getValueForParameter('ECX_TP_USER');
1317:
1318: if (wf_log_pkg.level_statement >= fnd_log.g_current_runtime_level) then
1336:
1337: is_valid := ecx_trading_partner_pvt.validateTPUser(
1338: p_transaction_type => l_tran_type,
1339: p_transaction_subtype => l_tran_subtype,
1340: p_standard_code => l_std_code,
1341: p_standard_type => l_std_type,
1342: p_party_site_id => l_party_site_id,
1343: p_user_name => l_tp_user,
1344: x_tp_header_id => p_tp_header_id,
1337: is_valid := ecx_trading_partner_pvt.validateTPUser(
1338: p_transaction_type => l_tran_type,
1339: p_transaction_subtype => l_tran_subtype,
1340: p_standard_code => l_std_code,
1341: p_standard_type => l_std_type,
1342: p_party_site_id => l_party_site_id,
1343: p_user_name => l_tp_user,
1344: x_tp_header_id => p_tp_header_id,
1345: retcode => p_ret_code,
1417: err_msg => null,
1418: receipt_msgid => l_msgid,
1419: trigger_id => l_trigger_id,
1420: message_type => l_std_type,
1421: message_standard => l_std_code,
1422: transaction_type => l_tran_type,
1423: transaction_subtype => l_tran_subtype,
1424: document_number => l_doc_number,
1425: partyid => l_party_id,
1474: p_event.AddParameterToList('ECX_PARTY_ID',l_party_id);
1475: p_event.AddParameterToList('ECX_PARTY_SITE_ID',l_party_site_id);
1476: p_event.AddParameterToList('ECX_PARTY_TYPE',l_party_type);
1477: p_event.addParameterToList('ECX_DIRECTION','IN');
1478: p_event.addParameterToList('ECX_MESSAGE_STANDARD',l_std_code);
1479: p_event.addParameterToList('ECX_MESSAGE_TYPE', l_std_type);
1480: p_event.addParameterToList('ECX_DOCUMENT_NUMBER', l_doc_number);
1481: return 'ERROR';
1482: end TPPreProcessing;
1483:
1484:
1485:
1486: -- ReceiveTPMessage
1487: -- Standard XML Gateway Subscription rule function for inbound B2B
1488: -- IN:
1489: -- p_subscription_guid - GUID of Subscription to be processed
1490: -- p_event - Event to be processes
1491: -- NOTE: Determines the Inbound Transaction Queue
1489: -- p_subscription_guid - GUID of Subscription to be processed
1490: -- p_event - Event to be processes
1491: -- NOTE: Determines the Inbound Transaction Queue
1492: --
1493: -- Standard B2B inbound function
1494:
1495: function ReceiveTPMessage(
1496: p_subscription_guid in raw,
1497: p_event in out nocopy wf_event_t
1677: end if;
1678:
1679: l_transaction_type := p_event.getValueForParameter('ECX_TRANSACTION_TYPE');
1680: l_transaction_subtype := p_event.getValueForParameter('ECX_TRANSACTION_SUBTYPE');
1681: l_message_code := nvl(p_event.getValueForParameter('ECX_MESSAGE_STANDARD'), 'OAG');
1682: l_message_type := nvl(p_event.getValueForParameter('ECX_MESSAGE_TYPE'), 'XML');
1683: l_document_number := p_event.getValueForParameter('ECX_DOCUMENT_NUMBER');
1684: if(l_document_number is null) then
1685: l_document_number := l_trigger_id;
1765: l_queue_name, l_tp_header_id) then
1766:
1767: if (wf_log_pkg.level_error >= fnd_log.g_current_runtime_level) then
1768: wf_log_pkg.string(wf_log_pkg.level_error, l_module,
1769: 'The Standard: '||l_message_code|| ',' ||
1770: 'Transaction Type: '||l_transaction_type|| ',' ||
1771: 'SubType:'||l_transaction_subtype|| ',' ||
1772: 'Location Code'||l_party_site_id||
1773: ' is not enabled in the XML Gateway Server. '||
1774: ' Pls check your Setup');
1775: end if;
1776:
1777: ecx_debug.setErrorInfo(2,30,'ECX_RULE_INVALID_TP_SETUP',
1778: 'p_standard_code', l_message_code,
1779: 'p_transaction_type', l_transaction_type,
1780: 'p_transaction_subtype', l_transaction_subtype,
1781: 'p_party_site_id', l_party_site_id);
1782:
1910: p_event.AddParameterToList('ECX_PARTY_ID',l_party_id);
1911: p_event.AddParameterToList('ECX_PARTY_SITE_ID',l_party_site_id);
1912: p_event.AddParameterToList('ECX_PARTY_TYPE',l_party_type);
1913: p_event.addParameterToList('ECX_DIRECTION','IN');
1914: p_event.addParameterToList('ECX_MESSAGE_STANDARD',l_message_code);
1915: p_event.addParameterToList('ECX_MESSAGE_TYPE', l_message_type);
1916: p_event.addParameterToList('ECX_DOCUMENT_ID', l_document_number);
1917:
1918: return 'ERROR';