1 PACKAGE BODY OKC_REP_PARTY_MERGE_GRP AS
2 /* $Header: OKCGREPMERGEB.pls 120.0 2005/05/25 22:49:48 appldev noship $ */
3
4
5 ---------------------------------------------------------------------------
6 -- START: Procedures and Functions
7 ---------------------------------------------------------------------------
8
9 -- Start of comments
10 --API name : party_merge
11 --Type : Group.
12 --Procedure : Merge Parties from HZ_PARTIES table that are referenced from
13 -- OKC_REP_CONTRACT_PARTIES table.
14 --Pre-reqs : None.
15 --Parameters :
16 --IN : p_entity_name IN HZ_MERGE_DICTIONARY.ENTITY_NAME%TYPE
17 -- : p_entity_name is the registered entity for which
18 -- : this routine is being called. It should have the value
19 -- : OKC_REP_CONTRACT_PARTIES.
20 -- :
21 -- : p_from_id IN ROWID
22 -- : PK of the entity that is being merged.
23 -- :
24 -- : x_to_id OUT ROWID
25 --
26 -- : p_from_fk_id IN NUMBER
27 -- : Old PK of the entity being merged.
28 -- :
29 -- : p_to_fk_id IN NUMBER
30 -- : New PK of the entity being merged.
31 -- :
32 -- : p_parent_entity_name IN HZ_MERGE_DICTIONARY.PARENT_ENTITY_NAME%TYPE
33 -- : Entity name of the parent which is being merged.
34 -- : This should have the value HZ_PARTIES.
35 -- :
36 -- : p_batch_id IN NUMBER
37 -- : ID of the batch.
38 -- :
39 -- : p_batch_party_id IN NUMBER
40 -- : ID that uniquely identifies the batch and
41 -- : party record that is being merged.
42 -- End of comments
43
44 PROCEDURE party_merge(p_entity_name IN HZ_MERGE_DICTIONARY.ENTITY_NAME%TYPE,
45 p_from_id IN ROWID,
46 x_to_id IN OUT NOCOPY ROWID,
47 p_from_fk_id IN NUMBER,
48 p_to_fk_id IN NUMBER,
49 p_parent_entity_name IN HZ_MERGE_DICTIONARY.PARENT_ENTITY_NAME%TYPE,
50 p_batch_id IN NUMBER,
51 p_batch_party_id IN NUMBER)
52
53
54 IS
55
56 l_api_name VARCHAR2(30);
57 l_msg_data FND_NEW_MESSAGES.MESSAGE_TEXT%TYPE;
58 l_return_status VARCHAR2(1);
59 l_msg_count NUMBER;
60
61
62 BEGIN
63 NULL;
64 /*
65 l_api_name := 'party_merge';
66
67 --
68 -- Party Merge Routine. Verify that this routine is being
69 -- called for the appropriate parent entity merge
70 -- and child entity merge.
71 --
72
73 IF (p_parent_entity_name = G_HZ_PARTY_ENTITY AND
74 p_entity_name = G_OKC_REP_PARTY_ENTITY)
75 THEN
76
77 IF p_from_fk_id = p_to_fk_id
78 THEN
79 x_to_id := p_from_id;
80 RETURN;
81 END IF;
82
83 --
84 -- Update PARTY_ID with P_FROM_FK_ID to
85 -- new merged PARTY_ID of P_TO_FK_ID.
86 --
87
88 IF p_from_fk_id <> p_to_fk_id
89 THEN
90
91 UPDATE okc_rep_contract_parties
92 SET party_id = p_to_fk_id,
93 last_update_date = sysdate,
94 last_updated_by = fnd_global.user_id,
95 last_update_login = fnd_global.user_id,
96 object_version_number = object_version_number+1
97 WHERE party_id = p_from_fk_id
98 AND party_role_code IN (G_PARTNER_ROLE, G_CUSTOMER_ROLE);
99
100
101 END IF; -- End p_from_fk_id <> p_to_fk_id
102
103
104 --
105 -- Call Deliverables Merge. This will take care of 'PARTNER_ORG' and 'CUSTOMER_ORG' roles.
106 --
107 OKC_MANAGE_DELIVERABLES_GRP.mergeExtPartyOnDeliverables (
108 p_api_version => 1.0,
109 p_init_msg_list => FND_API.G_FALSE,
110 p_commit => FND_API.G_FALSE,
111 p_document_class => G_OKC_REP_DOCUMENT_CLASS,
112 p_from_external_party_id => p_from_fk_id,
113 p_from_external_party_site_id => NULL,
114 p_to_external_party_id => p_to_fk_id,
115 p_to_external_party_site_id => NULL,
116 x_msg_data => l_msg_data,
117 x_msg_count => l_msg_count,
118 x_return_status => l_return_status);
119
120
121
122 END IF; -- End p_parent_entity = G_HZ_PARTY_ENTITY
123
124
125 EXCEPTION
126
127
128 WHEN others THEN
129
130 l_msg_data := substr(SQLERRM,1,70);
131 arp_message.set_error(G_PACKAGE_NAME || '.' || l_api_name, l_msg_data);
132 RAISE;
133 */
134 END; -- party_merge procedure
135
136
137
138 ---------------------------------------------------------------------------
139 -- START: Procedures and Functions
140 ---------------------------------------------------------------------------
141
142 -- Start of comments
143 --API name : party_site_merge
144 --Type : Group.
145 --Procedure : Merge Parties from HZ_PARTY_SITES table that are referenced from
146 -- OKC_REP_CONTRACT_PARTIES.location_id table.
147 --Pre-reqs : None.
148 --Parameters :
149 --IN : p_entity_name IN HZ_MERGE_DICTIONARY.ENTITY_NAME%TYPE
150 -- : p_entity_name is the registered entity for which
151 -- : this routine is being called. It should have the value
152 -- : OKC_REP_CONTRACT_PARTIES.
153 -- :
154 -- : p_from_id IN ROWID
155 -- : PK of the entity that is being merged.
156 -- :
157 -- : x_to_id OUT ROWID
158 --
159 -- : p_from_fk_id IN NUMBER
160 -- : Old PK of the entity being merged.
161 -- :
162 -- : p_to_fk_id IN NUMBER
163 -- : New PK of the entity being merged.
164 -- :
165 -- : p_parent_entity_name IN HZ_MERGE_DICTIONARY.PARENT_ENTITY_NAME%TYPE
166 -- : Entity name of the parent which is being merged.
167 -- : This should have the value HZ_PARTIES.
168 -- :
169 -- : p_batch_id IN NUMBER
170 -- : ID of the batch.
171 -- :
172 -- : p_batch_party_id IN NUMBER
173 -- : ID that uniquely identifies the batch and
174 -- : party record that is being merged.
175 -- End of comments
176
177 PROCEDURE party_site_merge(p_entity_name IN HZ_MERGE_DICTIONARY.ENTITY_NAME%TYPE,
178 p_from_id IN ROWID,
179 x_to_id IN OUT NOCOPY ROWID,
180 p_from_fk_id IN NUMBER,
181 p_to_fk_id IN NUMBER,
182 p_parent_entity_name IN HZ_MERGE_DICTIONARY.PARENT_ENTITY_NAME%TYPE,
183 p_batch_id IN NUMBER,
184 p_batch_party_id IN NUMBER)
185
186
187 IS
188 l_api_name VARCHAR2(30);
189 l_error_msg VARCHAR2(2000);
190 l_msg_data VARCHAR2(2000);
191 l_return_status VARCHAR2(1);
192 l_msg_count NUMBER;
193
194
195 BEGIN
196 NULL;
197 /*
198 l_api_name := 'party_site_merge';
199
200 --
201 -- Party Site Merge Routine. Verify that this routine is being
202 -- called for the appropriate parent entity merge
203 -- and child entity merge.
204 --
205
206 IF (p_parent_entity_name = G_HZ_PARTY_SITES_ENTITY AND
207 p_entity_name = G_OKC_REP_PARTY_ENTITY)
208 THEN
209
210 IF p_from_fk_id = p_to_fk_id
211 THEN
212 x_to_id := p_from_id;
213 RETURN;
214 END IF;
215
216 --
217 -- Update PARTY_ID with P_FROM_FK_ID to
218 -- new merged PARTY_ID of P_TO_FK_ID.
219 --
220
221 IF p_from_fk_id <> p_to_fk_id
222 THEN
223
224 UPDATE okc_rep_contract_parties
225 SET party_location_id = p_to_fk_id,
226 last_update_date = sysdate,
227 last_updated_by = fnd_global.user_id,
228 last_update_login = fnd_global.user_id,
229 object_version_number = object_version_number+1
230 WHERE party_location_id = p_from_fk_id
231 AND party_role_code IN (G_PARTNER_ROLE, G_CUSTOMER_ROLE);
232
233
234 --
235 -- Call Deliverables Merge. This will take care of 'PARTNER_ORG' and 'CUSTOMER_ORG' roles.
236 --
237 OKC_MANAGE_DELIVERABLES_GRP.mergeExtPartyOnDeliverables (
238 p_api_version => 1.0,
239 p_init_msg_list => FND_API.G_FALSE,
240 p_commit => FND_API.G_FALSE,
241 p_document_class => G_OKC_REP_DOCUMENT_CLASS,
242 p_from_external_party_id => NULL,
243 p_from_external_party_site_id => p_from_fk_id,
244 p_to_external_party_id => NULL,
245 p_to_external_party_site_id => p_to_fk_id,
246 x_msg_data => l_msg_data,
247 x_msg_count => l_msg_count,
248 x_return_status => l_return_status);
249
250
251
252 END IF; -- End p_from_fk_id <> p_to_fk_id
253
254 END IF; -- End p_parent_entity = G_HZ_PARTY_SITES_ENTITY
255
256
257 EXCEPTION
258
259
260 WHEN others THEN
261
262 l_error_msg := substr(SQLERRM,1,70);
263 arp_message.set_error(G_PACKAGE_NAME || '.' || l_api_name, l_error_msg);
264 RAISE;
265 */
266 END; -- party_site_merge procedure
267
268 ---------------------------------------------------------------------------
269 -- START: Procedures and Functions
270 ---------------------------------------------------------------------------
271
272 -- Start of comments
273 --API name : party_merge
274 --Type : Group.
275 --Procedure : Merge Parties from PO_VENDORS table that are referenced from
276 -- OKC_REP_CONTRACT_PARTIES table.
277 --Pre-reqs : None.
278 --Parameters :
279 --IN : p_entity_name IN p_entity_name is the registered entity for which
280 -- : this routine is being called. It should have the value
281 -- : OKC_REP_CONTRACT_PARTIES.
282 -- :
283 -- : p_from_id IN ROWID
284 -- : PK of the entity that is being merged.
285 -- :
286 -- : x_to_id OUT ROWID
287 --
288 -- : p_from_fk_id IN NUMBER
289 -- : Old PK of the entity being merged.
290 -- :
291 -- : p_to_fk_id IN NUMBER
292 -- : New PK of the entity being merged.
293 -- :
294 -- : p_parent_entity_name IN p_parent_entity_name is
295 -- : entity name of the parent which is being merged.
296 -- : This should have the value PO_VENDORS.
297 -- :
298 -- : p_batch_id IN NUMBER
299 -- : ID of the batch.
300 -- :
301 -- : p_batch_party_id IN NUMBER
302 -- : ID that uniquely identifies the batch and
303 -- : party record that is being merged.
304 -- End of comments
305
306 PROCEDURE vendor_merge(p_entity_name IN VARCHAR2,
307 p_from_id IN ROWID,
308 x_to_id IN OUT NOCOPY ROWID,
309 p_from_fk_id IN NUMBER,
310 p_to_fk_id IN NUMBER,
311 p_parent_entity_name IN VARCHAR2,
312 p_batch_id IN NUMBER,
313 p_batch_party_id IN NUMBER)
314
315
316 IS
317 l_api_name VARCHAR2(30);
318 l_msg_data VARCHAR2(2000);
319 l_return_status VARCHAR2(1);
320 l_msg_count NUMBER;
321
322
323 BEGIN
324
325 NULL;
326 /*
327 l_api_name := 'vendor_merge';
328 --
329 -- Party Merge Routine. Verify that this routine is being
330 -- called for the appropriate parent entity merge
331 -- and child entity merge.
332 --
333
334 IF (p_parent_entity_name = G_HZ_PARTY_ENTITY AND
335 p_entity_name = G_OKC_REP_PARTY_ENTITY)
336 THEN
337
338 IF p_from_fk_id = p_to_fk_id
339 THEN
340 x_to_id := p_from_id;
341 RETURN;
342 END IF;
343
344 --
345 -- Update PARTY_ID with P_FROM_FK_ID to
346 -- new merged PARTY_ID of P_TO_FK_ID.
347 --
348
349 IF p_from_fk_id <> p_to_fk_id
350 THEN
351
352 UPDATE okc_rep_contract_parties
353 SET party_id = p_to_fk_id,
354 last_update_date = sysdate,
355 last_updated_by = fnd_global.user_id,
356 last_update_login = fnd_global.user_id,
357 object_version_number = object_version_number+1
358 WHERE party_id = p_from_fk_id
359 AND party_role_code = G_SUPPLIER_ROLE;
360
361
362 END IF; -- End p_from_fk_id <> p_to_fk_id
366 -- Call Deliverables Merge for 'SUPPLIER_ORG' Party Role
363
364
365 --
367 --
368 OKC_MANAGE_DELIVERABLES_GRP.updateExtPartyOnDeliverables(
369 p_api_version => 1.0,
370 p_init_msg_list => FND_API.G_FALSE,
371 p_commit => FND_API.G_FALSE,
372 p_document_class => G_OKC_REP_DOCUMENT_CLASS,
373 p_from_external_party_id => p_from_fk_id,
374 p_from_external_party_site_id => NULL,
375 p_to_external_party_id => p_to_fk_id,
376 p_to_external_party_site_id => NULL,
377 x_msg_data => l_msg_data,
378 x_msg_count => l_msg_count,
379 x_return_status => l_return_status);
380
381
382 END IF; -- End vendor_merge = G_HZ_PARTY_ENTITY
383
384
385 EXCEPTION
386
387
388 WHEN others THEN
389
390 l_msg_data := substr(SQLERRM,1,70);
391 arp_message.set_error(G_PACKAGE_NAME || '.' || l_api_name, l_msg_data);
392 RAISE;
393
394 */
395
396 END; -- vendor_merge procedure
397
398
399
400 ---------------------------------------------------------------------------
401 -- START: Procedures and Functions
402 ---------------------------------------------------------------------------
403
404 -- Start of comments
405 --API name : party_site_merge
406 --Type : Group.
407 --Procedure : Merge Parties from HZ_PARTY_SITES table that are referenced from
408 -- OKC_REP_CONTRACT_PARTIES.location_id table.
409 --Pre-reqs : None.
410 --Parameters :
411 --IN : vendor_site_merge IN p_entity_name is the registered entity for which
412 -- : this routine is being called. It should have the value
413 -- : OKC_REP_CONTRACT_PARTIES.
414 -- :
415 -- : p_from_id IN ROWID
416 -- : PK of the entity that is being merged.
417 -- :
418 -- : x_to_id OUT ROWID
419 --
420 -- : p_from_fk_id IN NUMBER
421 -- : Old PK of the entity being merged.
422 -- :
423 -- : p_to_fk_id IN NUMBER
424 -- : New PK of the entity being merged.
425 -- :
426 -- : p_parent_entity_name IN p_parent_entity_name is
427 -- : entity name of the parent which is being merged.
428 -- : This should have the value PO_VENDORS.
429 -- :
430 -- : p_batch_id IN NUMBER
431 -- : ID of the batch.
432 -- :
433 -- : p_batch_party_id IN NUMBER
434 -- : ID that uniquely identifies the batch and
435 -- : party record that is being merged.
436 -- End of comments
437
438 PROCEDURE vendor_site_merge(p_entity_name IN VARCHAR2,
439 p_from_id IN ROWID,
440 x_to_id IN OUT NOCOPY ROWID,
441 p_from_fk_id IN NUMBER,
442 p_to_fk_id IN NUMBER,
443 p_parent_entity_name IN VARCHAR2,
444 p_batch_id IN NUMBER,
445 p_batch_party_id IN NUMBER)
446
447
448 IS
449 l_api_name VARCHAR2(30);
450 l_error_msg VARCHAR2(2000);
451 l_msg_data VARCHAR2(2000);
452 l_return_status VARCHAR2(1);
453 l_msg_count NUMBER;
454
455
456 BEGIN
457 NULL;
458 /*
459 l_api_name := 'vendor_site_merge';
460 --
461 -- Party Site Merge Routine. Verify that this routine is being
462 -- called for the appropriate parent entity merge
463 -- and child entity merge.
464 --
465
466 IF (p_parent_entity_name = G_HZ_PARTY_SITES_ENTITY AND
467 p_entity_name = G_OKC_REP_PARTY_ENTITY)
468 THEN
469
470 IF p_from_fk_id = p_to_fk_id
471 THEN
472 x_to_id := p_from_id;
473 RETURN;
474 END IF;
475
476 --
477 -- Update PARTY_ID with P_FROM_FK_ID to
478 -- new merged PARTY_ID of P_TO_FK_ID.
479 --
480
481 IF p_from_fk_id <> p_to_fk_id
482 THEN
483
484 UPDATE okc_rep_contract_parties
485 SET party_location_id = p_to_fk_id,
486 last_update_date = sysdate,
487 last_updated_by = fnd_global.user_id,
488 last_update_login = fnd_global.user_id,
489 object_version_number = object_version_number+1
490 WHERE party_location_id = p_from_fk_id
491 AND party_role_code = G_SUPPLIER_ROLE;
492
493 --
494 -- Call Deliverables Merge for 'SUPPLIER_ORG' Party Role
495 --
496 OKC_MANAGE_DELIVERABLES_GRP.mergeExtPartyOnDeliverables (
497 p_api_version => 1.0,
498 p_init_msg_list => FND_API.G_FALSE,
499 p_commit => FND_API.G_FALSE,
500 p_document_class => G_OKC_REP_DOCUMENT_CLASS,
501 p_external_party_role => G_SUPPLIER_ROLE,
502 p_from_external_party_id => NULL,
503 p_from_external_party_site_id => p_from_fk_id,
504 p_to_external_party_id => NULL,
505 p_to_external_party_site_id => p_to_fk_id,
506 x_msg_data => l_msg_data,
507 x_msg_count => l_msg_count,
511 END IF; -- End p_from_fk_id <> p_to_fk_id
508 x_return_status => l_return_status);
509
510
512
513 END IF; -- End p_parent_entity = G_HZ_PARTY_SITES_ENTITY
514
515
516 EXCEPTION
517
518
519 WHEN others THEN
520
521 l_error_msg := substr(SQLERRM,1,70);
522 arp_message.set_error(G_PACKAGE_NAME || '.' || l_api_name, l_error_msg);
523 RAISE;
524 */
525 END; -- vendor_site_merge procedure
526
527 END OKC_REP_PARTY_MERGE_GRP;