[Home] [Help]
PACKAGE BODY: APPS.CLN_NP_CONC_API_CALL
Source
1 PACKAGE BODY CLN_NP_CONC_API_CALL as
2 /* $Header: ECXNPCRB.pls 120.0 2005/08/25 04:47:04 nparihar noship $ */
3 l_debug_level NUMBER := to_number(nvl(fnd_profile.value('CLN_DEBUG_LEVEL'), '5'));
4
5
6 -- Package: CLN_NP_CONC_API_CALL
7 --
8 -- Purpose: To run user defined PL/SQL function in concurrent mode
9 --
10 -- History
11 -- May-02-2002 Kodanda Ram Created
12
13 --
14 -- Name
15 -- CALL_API
16 -- Purpose
17 -- This procedure submits a concurrent request for the user defined PL/SQL function
18 --
19 -- Arguments
20 -- P_ITEMTYPE Item type
21 -- P_ITEMTYPE Item Key
22 -- P_ACTID Action ID
23 -- P_FUNCMODE Function Mode
24 -- X_RESULTOUT Result
25 --
26 -- Returns [ for functions ]
27 --
28 -- Notes
29 -- No specific notes
30
31
32
33
34 PROCEDURE CALL_API (
35 p_itemtype IN VARCHAR2,
36 p_itemkey IN VARCHAR2,
37 p_actid IN NUMBER,
38 p_funcmode IN VARCHAR2,
39 x_resultout IN OUT NOCOPY VARCHAR2)
40 IS
41 l_cln_not_parameters wf_parameter_list_t;
42 l_debug_mode VARCHAR2(255);
43 l_procedure_call_statement VARCHAR2(250);
44 l_procedure_name VARCHAR2(250);
45 l_application_id VARCHAR2(250);
46 l_collaboration_id VARCHAR2(250);
47 l_collaboration_type VARCHAR2(250);
48 l_reference_id VARCHAR2(250);
49 l_trading_partner_id VARCHAR2(250);
50 l_status VARCHAR2(250);
51 l_header_desc VARCHAR2(250);
52 l_notification_code VARCHAR2(250);
53 l_notification_desc VARCHAR2(250);
54 BEGIN
55 -- Sets the debug mode to be FILE
56 --l_debug_mode := ecx_cln_debug_pub.Set_Debug_Mode('FILE');
57 IF (l_Debug_Level <= 2) THEN
58 ecx_cln_debug_pub.Add('ENTERING CLN_NP_CONC_API_CALL.CALL_API', 2);
59 END IF;
60
61 IF (l_Debug_Level <= 1) THEN
62 ecx_cln_debug_pub.Add('With the following parameters:', 1);
63 ecx_cln_debug_pub.Add('p_itemtype:' || p_itemtype, 1);
64 ecx_cln_debug_pub.Add('p_itemkey:' || p_itemkey, 1);
65 ecx_cln_debug_pub.Add('p_actid:' || p_actid, 1);
66 ecx_cln_debug_pub.Add('p_funcmode:' || p_funcmode, 1);
67 END IF;
68
69
70 l_procedure_name := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'PROCEDURE_NAME');
71 IF (l_Debug_Level <= 1) THEN
72 ecx_cln_debug_pub.Add('l_procedure_name - ' || l_procedure_name, 2);
73 END IF;
74
75
76 l_application_id := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'APPLICATION_ID');
77 l_collaboration_id := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'COLLABORATION_ID');
78 l_collaboration_type := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'COLLABORATION_TYPE');
79 l_reference_id := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'REFERENCE_ID');
80 l_trading_partner_id := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'TRADING_PARTNER_ID');
81 l_status := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'STATUS');
82 l_header_desc := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'HEADER_DESC');
83 l_notification_code := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'NOTIFICATION_CODE');
84 l_notification_desc := wf_engine.GetActivityAttrText(p_itemtype,p_itemkey,p_actid, 'NOTIFICATION_DESC');
85
86 IF (l_Debug_Level <= 1) THEN
87 ecx_cln_debug_pub.Add('l_application_id - ' || l_application_id, 1);
88 ecx_cln_debug_pub.Add('l_collaboration_id - ' || l_collaboration_id, 1);
89 ecx_cln_debug_pub.Add('l_collaboration_type - ' || l_collaboration_type, 1);
90 ecx_cln_debug_pub.Add('l_reference_id - ' || l_reference_id, 1);
91 ecx_cln_debug_pub.Add('l_trading_partner_id - ' || l_trading_partner_id, 1);
92 ecx_cln_debug_pub.Add('l_status - ' || l_status, 1);
93 ecx_cln_debug_pub.Add('l_header_desc - ' || l_header_desc, 1);
94 ecx_cln_debug_pub.Add('l_notification_code - ' || l_notification_code, 1);
95 ecx_cln_debug_pub.Add('l_notification_desc - ' || l_notification_desc, 1);
96 END IF;
97
98
99 WF_EVENT.AddParameterToList('ApplicationId',l_application_id,l_cln_not_parameters);
100 WF_EVENT.AddParameterToList('CollaborationId',l_collaboration_id,l_cln_not_parameters);
101 WF_EVENT.AddParameterToList('CollaborationType',l_collaboration_type,l_cln_not_parameters);
102 WF_EVENT.AddParameterToList('ReferenceId',l_reference_id,l_cln_not_parameters);
103 WF_EVENT.AddParameterToList('TradingPartnerID',l_trading_partner_id,l_cln_not_parameters);
104 WF_EVENT.AddParameterToList('HeaderDescription',l_header_desc,l_cln_not_parameters);
105 WF_EVENT.AddParameterToList('NotificationDescription',l_notification_desc,l_cln_not_parameters);
106 WF_EVENT.AddParameterToList('NotificationCode',l_notification_code,l_cln_not_parameters);
107 WF_EVENT.AddParameterToList('Status',l_status,l_cln_not_parameters);
108 l_procedure_call_statement := 'begin ' || l_procedure_name || '(:l_cln_not_parameters); end;';
109 IF (l_Debug_Level <= 2) THEN
110 ecx_cln_debug_pub.Add('INVOKING PROCEDURE - ' || l_procedure_call_statement, 2);
111 END IF;
112
113 execute immediate l_procedure_call_statement using l_cln_not_parameters;
114 IF (l_Debug_Level <= 2) THEN
115 ecx_cln_debug_pub.Add('COMPLETED PROCEDURE - ' || l_procedure_call_statement, 2);
116 END IF;
117
118 x_resultout := 'Yes';
119 IF (l_Debug_Level <= 2) THEN
120 ecx_cln_debug_pub.Add('EXITING CLN_NP_CONC_API_CALL.CALL_API', 2);
121 END IF;
122
123 EXCEPTION
124 WHEN OTHERS THEN
125 -- Unexpected Exception
126 IF (l_Debug_Level <= 2) THEN
127 ecx_cln_debug_pub.Add('Unexpected Exception', 2);
128 END IF;
129
130 x_resultout :='Unexpected Exception';
131 RETURN;
132 END CALL_API;
133
134
135 END CLN_NP_CONC_API_CALL;