1 PACKAGE PV_ASSIGNMENT_PUB AUTHID CURRENT_USER as
2 /* $Header: pvxasgns.pls 120.5 2006/05/12 10:38:13 dhii noship $ */
3 /*#
4 * This is the public interface that contains procedures that process both
5 * opportunity routing and partner and channel manager responses to routing assignments.
6 * Specifically, the interface contains procedures that handle the following opportunity assignment tasks:
7 * assignment of an opportunity to one or more partners; channel manager approval or rejection of an assignment;
8 * partner acceptance or rejection of an assignment; partner abandonment of an accepted assignment;
9 * and channel manager withdrawal of an assignment
10 * @rep:scope public
11 * @rep:product PV
12 * @rep:displayname Opportunity Assignment
13 * @rep:lifecycle active
14 * @rep:compatibility S
15 * @rep:category BUSINESS_ENTITY PV_OPPORTUNITY
16 */
17
18 -- Start of Comments
19
20 -- Package name : PV_ASSIGNMENT_PUB
21 -- Purpose :
22 -- History :
23 --
24 -- NOTE :
25 -- End of Comments
26 --
27
28 -- person resource category
29
30 g_resource_party CONSTANT VARCHAR2(30) := 'PARTY';
31 g_resource_employee CONSTANT VARCHAR2(30) := 'EMPLOYEE';
32
33 -- organization type
34
35 g_vendor_org CONSTANT VARCHAR2(30) := 'VENDOR';
36 g_external_org CONSTANT VARCHAR2(30) := 'EXTERNAL';
37
38 -- assignment access codes
39
40 g_assign_access_view CONSTANT VARCHAR2(20) := 'VIEW';
41 g_assign_access_update CONSTANT VARCHAR2(20) := 'UPDATE';
42 g_assign_access_none CONSTANT VARCHAR2(20) := 'NO_ACCESS';
43
44 -- Assignment statuses
45
46 g_la_status_assigned CONSTANT varchar2(20) := 'ASSIGNED';
47 g_la_status_cm_rejected CONSTANT varchar2(20) := 'CM_REJECTED';
48 g_la_status_cm_added CONSTANT varchar2(20) := 'CM_ADDED';
49 g_la_status_cm_add_app_for_pt CONSTANT varchar2(20) := 'CM_ADD_APP_FOR_PT';
50 g_la_status_cm_approved CONSTANT varchar2(20) := 'CM_APPROVED';
51 g_la_status_cm_bypassed CONSTANT varchar2(20) := 'CM_BYPASSED';
52 g_la_status_cm_timeout CONSTANT varchar2(20) := 'CM_TIMEOUT';
53 g_la_status_cm_app_for_pt CONSTANT varchar2(20) := 'CM_APP_FOR_PT';
54 g_la_status_match_withdrawn CONSTANT varchar2(20) := 'MATCH_WITHDRAWN'; -- to be added in code
55
56 g_la_status_pt_created CONSTANT varchar2(20) := 'PT_CREATED';
57 g_la_status_pt_approved CONSTANT varchar2(20) := 'PT_APPROVED';
58 g_la_status_pt_rejected CONSTANT varchar2(20) := 'PT_REJECTED';
59 g_la_status_pt_timeout CONSTANT varchar2(20) := 'PT_TIMEOUT';
60 g_la_status_offer_withdrawn CONSTANT varchar2(20) := 'OFFER_WITHDRAWN'; -- to be added in code
61 g_la_status_lost_chance CONSTANT varchar2(20) := 'LOST_CHANCE';
62 g_la_status_pt_abandoned CONSTANT varchar2(20) := 'PT_ABANDONED';
63 -- vansub:rivendell
64 g_la_status_active_withdrawn CONSTANT varchar2(20) := 'ACTIVE_WITHDRAWN';
65 -- vansub:rivendell
66
67 -- Assignment source types
68
69 g_la_src_type_matching CONSTANT varchar2(20) := 'MATCHING';
70
71
72 -- routing statuses
73
74 g_r_status_active CONSTANT varchar2(20) := 'ACTIVE';
75 g_r_status_matched CONSTANT varchar2(20) := 'MATCHED';
76 g_r_status_offered CONSTANT varchar2(20) := 'OFFERED';
77 g_r_status_recycled CONSTANT varchar2(20) := 'RECYCLED';
78 g_r_status_unassigned CONSTANT varchar2(20) := 'UNASSIGNED';
79 g_r_status_withdrawn CONSTANT varchar2(20) := 'WITHDRAWN';
80 g_r_status_abandoned CONSTANT varchar2(20) := 'ABANDONED';
81 g_r_status_failed_auto CONSTANT varchar2(20) := 'FAILED_AUTO_ASSIGN';
82
83
84 -- workflow statuses
85
86 g_wf_status_open CONSTANT varchar2(20) := 'OPEN';
87 g_wf_status_closed CONSTANT varchar2(20) := 'CLOSED';
88
89
90 -- updateAssignment action modes
91
92 g_asgn_action_status_update CONSTANT varchar2(20) := 'STATUS_UPDATE';
93 g_asgn_action_move_to_log CONSTANT varchar2(20) := 'MOVE_TO_LOG';
94
95
96 -- updateAccess access type
97
98 G_CM_ACCESS CONSTANT NUMBER := 1;
99 G_PT_ACCESS CONSTANT NUMBER := 2;
100 G_PT_ORG_ACCESS CONSTANT NUMBER := 3;
101
102
103 -- updateAccess access action
104
105 G_ADD_ACCESS CONSTANT NUMBER := 1;
106 G_REMOVE_ACCESS CONSTANT NUMBER := 2;
107
108
109 -- timeout types
110
111 g_matched_timeout CONSTANT VARCHAR2(30) := 'MATCHED_TIMEOUT';
112 g_offered_timeout CONSTANT VARCHAR2(30) := 'OFFERED_TIMEOUT';
113
114
115 -- notification types
116
117 g_notify_type_matched_to CONSTANT VARCHAR2(30) := 'MATCHED_TO';
118 g_notify_type_offered_to CONSTANT VARCHAR2(30) := 'OFFERED_TO';
119 g_notify_type_ptcr_fyi CONSTANT VARCHAR2(30) := 'PTCR_FYI';
120 g_notify_type_behalf_of CONSTANT VARCHAR2(30) := 'BEHALF_OF';
121 g_notify_type_abandoned_by CONSTANT VARCHAR2(30) := 'ABANDONED_BY';
122 -- vansub:rivendell
123 g_notify_type_withdrawn_by CONSTANT VARCHAR2(30) := 'WITHDRAWN_BY';
124 -- vansub:rivendell
125
126
127 -- pl/sql types
128
129 type g_number_table_type is TABLE of number;
130 type g_varchar_table_type is TABLE of varchar2(50);
131 type g_date_table_type is TABLE of DATE;
132
133 type g_ref_cursor_type is REF CURSOR;
134
135
136
137
138 /*#
139 * This procedure processes the assignment of opportunities to partners.
140 * This procedure is used when opportunity assignment is fully automated without user interaction,
141 * and when a user initiates the assignment and uses a matching rule to identify partners or performs a
142 * manual partner search. The procedure contains parameters that identify the assignment type
143 * (for example, SERIAL or JOINT), whether or not channel manager approval is required,
144 * the partners to whom the opportunity will be assigned, and the rule used for automatic matching (if in use).
145 * @param p_api_version_number Version of the API
146 * @param p_init_msg_list Indicator whether to initialize the message stack
147 * @param p_commit Indicator whether to commit within the program
148 * @param p_validation_level Indicator of FND validation levels
149 * @param p_entity Specifies the entity values are OPPORTUNITY or LEAD
150 * @param p_lead_id Opportunity ID
151 * @param p_creating_username User Name of the person initiating the assignment
152 * @param p_assignment_type Type of assignment values are SINGLE, SERIAL, JOINT or BROADCAST
153 * @param p_bypass_cm_ok_flag Flag to bypass channel manager approval for assignment
154 * @param p_partner_id_tbl List of partners whom the opportunity will be assigned
155 * @param p_rank_tbl List of rankings of partner
156 * @param p_partner_source_tbl List of sources through partner got into the system,values
157 * are MATCHING, SALESTEAM, TAP or CAMPAIGN
158 * @param p_process_rule_id Rule ID if it is a automatic matching
159 * @param x_return_status Status of the program
160 * @param x_msg_count Number of the messages returned by the program
161 * @param x_msg_data Return message by the program
162 * @rep:displayname Create Assignment
163 * @rep:scope public
164 * @rep:lifecycle active
165 * @rep:compatibility S
166 */
167
168 procedure CreateAssignment (
169 p_api_version_number IN NUMBER,
170 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
171 p_commit IN VARCHAR2 := FND_API.G_FALSE,
172 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
173 p_entity IN VARCHAR2,
174 p_lead_id in NUMBER,
175 p_creating_username IN VARCHAR2,
176 p_assignment_type in VARCHAR2,
177 p_bypass_cm_ok_flag in VARCHAR2,
178 p_partner_id_tbl in JTF_NUMBER_TABLE,
179 p_rank_tbl in JTF_NUMBER_TABLE,
180 p_partner_source_tbl in JTF_VARCHAR2_TABLE_100,
181 p_process_rule_id in NUMBER,
182 x_return_status OUT NOCOPY VARCHAR2,
183 x_msg_count OUT NOCOPY NUMBER,
184 x_msg_data OUT NOCOPY VARCHAR2);
185
186 /*#
187 * This procedure processes a channel manager's response to partner opportunity assignment
188 * and it is used when channel manager approval of opportunity assignment is required.
189 * @param p_api_version_number Version of the API
190 * @param p_init_msg_list Indicator whether to initialize the message stack
191 * @param p_commit Indicator whether to commit within the program
192 * @param p_validation_level Indicator of FND validation levels
193 * @param p_entity Specifies the entity values are OPPORTUNITY or LEAD
194 * @param p_user_name User Name of the Channel Manager Approving the Assignment
195 * @param p_lead_id Opportunity ID
196 * @param p_partyTbl List of partners whom the opportunity will be assigned
197 * @param p_rank_tbl List of rankings of partner
198 * @param p_statusTbl Channel Manager Response values are Approve, Reject , Approve on behalf of partner
199 * @param x_return_status Status of the program
200 * @param x_msg_count Number of the messages returned by the program
201 * @param x_msg_data Return message by the program
202 * @rep:displayname Create Assignment
203 * @rep:scope public
204 * @rep:lifecycle active
205 * @rep:compatibility S
206 */
207 procedure process_match_response (
208 p_api_version_number IN NUMBER,
209 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
210 p_commit IN VARCHAR2 := FND_API.G_FALSE,
211 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
212 p_entity IN VARCHAR2,
213 p_user_name IN VARCHAR2,
214 p_lead_id IN NUMBER,
215 p_partyTbl in JTF_NUMBER_TABLE,
216 p_rank_Tbl in JTF_NUMBER_TABLE,
217 p_statusTbl in JTF_VARCHAR2_TABLE_100, -- CM_APPROVED,CM_REJECTED,CM_ADDED,NOACTION
218 x_return_status OUT NOCOPY VARCHAR2,
219 x_msg_count OUT NOCOPY NUMBER,
220 x_msg_data OUT NOCOPY VARCHAR2);
221
222 /*#
223 * This procedure processes the partner's response to the opportunity assignment.
224 *
225 * @param p_api_version_number Version of the API
226 * @param p_init_msg_list Indicator whether to initialize the message stack
227 * @param p_commit Indicator whether to commit within the program
228 * @param p_validation_level Indicator of FND validation levels
229 * @param p_entity Specifies the entity, values are OPPORTUNITY or LEAD
230 * @param p_lead_id Opportunity ID
231 * @param p_partner_id Partner ID
232 * @param p_user_name User name of of partner
233 * @param p_pt_response Partner Response such as Approve/Reject
234 * @param p_reason_code Reason Code if partner is rejecting the assignment
235 * @param x_return_status Status of the program
236 * @param x_msg_count Number of the messages returned by the program
237 * @param x_msg_data Return message by the program
238 * @rep:displayname Create Assignment
239 * @rep:scope public
240 * @rep:lifecycle active
241 * @rep:compatibility S
242 */
243 procedure PROCESS_OFFER_RESPONSE (
244 p_api_version_number IN NUMBER
245 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
246 ,p_commit IN VARCHAR2 := FND_API.G_FALSE
247 ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
248 ,p_entity IN VARCHAR2
249 ,p_lead_id IN number
250 ,p_partner_id IN number
251 ,p_user_name IN VARCHAR2
252 ,p_pt_response IN varchar2
253 ,p_reason_code IN varchar2
254 ,x_return_status OUT NOCOPY VARCHAR2
255 ,x_msg_count OUT NOCOPY NUMBER
256 ,x_msg_data OUT NOCOPY VARCHAR2);
257
258 /*#
259 * This procedure is used when a channel manager withdraws an opportunity assignment from a partner.
260 * A channel manager can withdraw an opportunity either before or after a partner has accepted the opportunity.
261 * @param p_api_version_number Version of the API
262 * @param p_init_msg_list Indicator whether to initialize the message stack
263 * @param p_commit Indicator whether to commit within the program
264 * @param p_validation_level Indicator of FND validation levels
265 * @param p_entity Specifies the entity ,values are OPPORTUNITY or LEAD
266 * @param p_lead_id Opportunity ID
267 * @param p_user_name User Name of the Channel Manager withdrawing the Assignment
268 * @param x_return_status Status of the program
269 * @param x_msg_count Number of the messages returned by the program
270 * @param x_msg_data Return message by the program
271 * @rep:displayname Create Assignment
275 */
272 * @rep:scope public
273 * @rep:lifecycle active
274 * @rep:compatibility S
276
277 procedure WITHDRAW_ASSIGNMENT (
278 p_api_version_number IN NUMBER
279 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
280 ,p_commit IN VARCHAR2 := FND_API.G_FALSE
281 ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
282 ,p_entity IN VARCHAR2
283 ,p_lead_id IN NUMBER
284 ,p_user_name IN VARCHAR2
285 ,x_return_status OUT NOCOPY VARCHAR2
286 ,x_msg_count OUT NOCOPY NUMBER
287 ,x_msg_data OUT NOCOPY VARCHAR2);
288
289
290 /*#
291 * This procedure is used when a partner abandons an opportunity.
292 * A partner can abandon an opportunity only if it first accepted an opportunity.
293 * @param p_api_version_number Version of the API
294 * @param p_init_msg_list Indicator whether to initialize the message stack
295 * @param p_commit Indicator whether to commit within the program
296 * @param p_validation_level Indicator of FND validation levels
297 * @param p_entity Specifies the entity, values are OPPORTUNITY or LEAD
298 * @param p_lead_id Opportunity ID
299 * @param p_user_name User Name of the partner abandoning the Assignment
300 * @param p_reason_code Reason for abandoning
301 * @param x_return_status Status of the program
302 * @param x_msg_count Number of the messages returned by the program
303 * @param x_msg_data Return message by the program
304 * @rep:displayname Create Assignment
305 * @rep:scope public
306 * @rep:lifecycle active
307 * @rep:compatibility S
308 */
309
310 procedure ABANDON_ASSIGNMENT (
311 p_api_version_number IN NUMBER
312 ,p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE
313 ,p_commit IN VARCHAR2 := FND_API.G_FALSE
314 ,p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL
315 ,p_entity in VARCHAR2
316 ,p_lead_id IN NUMBER
317 ,p_user_name IN VARCHAR2
318 ,p_reason_code IN varchar2
319 ,x_return_status OUT NOCOPY VARCHAR2
320 ,x_msg_count OUT NOCOPY NUMBER
321 ,x_msg_data OUT NOCOPY VARCHAR2);
322
323
324
325
326 End PV_ASSIGNMENT_PUB;