1 PACKAGE BODY HZ_EXTRACT_PERSON_CUST_BO_PVT AS
2 /*$Header: ARHEPAVB.pls 120.10 2008/02/06 10:15:55 vsegu ship $ */
3 /*
4 * This package contains the private APIs for logical person_cust.
5 * @rep:scope private
6 * @rep:product HZ
7 * @rep:displayname Person Customer
8 * @rep:category BUSINESS_ENTITY HZ_PARTIES
9 * @rep:lifecycle active
10 * @rep:doccd 115hztig.pdf Person Customer Get APIs
11 */
12
13 --------------------------------------
14 --
15 -- PROCEDURE get_person_cust_bo
16 --
17 -- DESCRIPTION
18 -- Get a logical person customer.
19 --
20 -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
21 --
22 -- ARGUMENTS
23 -- IN:
24 -- p_init_msg_list Initialize message stack if it is set to
25 -- p_person_id Person ID.
26 -- FND_API.G_TRUE. Default is FND_API.G_FALSE.
27 -- OUT:
28 -- x_person_cust_obj Logical person customer record.
29 -- x_return_status Return status after the call. The status can
30 -- be fnd_api.g_ret_sts_success (success),
31 -- fnd_api.g_ret_sts_error (error),
32 -- FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
33 -- x_msg_count Number of messages in message stack.
34 -- x_msg_data Message text if x_msg_count is 1.
35 --
36 -- NOTES
37 --
38 -- MODIFICATION HISTORY
39 --
40 --
41 -- 10-JUN-2005 AWU Created.
42 --
43
44 /*
45 The Get Person Customer API Procedure is a retrieval service that returns a full Person Customer business object.
46 The user identifies a particular Person Customer business object using the TCA identifier and/or
47 the object Source System information. Upon proper validation of the object,
48 the full Person Customer business object is returned. The object consists of all data included within
49 the Person Customer business object, at all embedded levels. This includes the set of all data stored
50 in the TCA tables for each embedded entity.
51
52 To retrieve the appropriate embedded business objects within the Person Customer business object,
53 the Get procedure calls the equivalent procedure for the following embedded objects:
54
55 Embedded BO Mandatory Multiple Logical API Procedure Comments
56
57 Person Y N get_person_bo
58 Customer Account Y Y get_cust_acct_bo Called for each Customer Account object for the Person Customer
59
60 */
61
62
63
64 PROCEDURE get_person_cust_bo(
65 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
66 p_person_id IN NUMBER,
67 p_action_type IN VARCHAR2 := NULL,
68 x_person_cust_obj OUT NOCOPY HZ_PERSON_CUST_BO,
69 x_return_status OUT NOCOPY VARCHAR2,
70 x_msg_count OUT NOCOPY NUMBER,
71 x_msg_data OUT NOCOPY VARCHAR2
72 ) is
73
74 l_debug_prefix VARCHAR2(30) := '';
75
76 begin
77 -- initialize API return status to success.
78 x_return_status := FND_API.G_RET_STS_SUCCESS;
79
80 -- Initialize message list if p_init_msg_list is set to TRUE
81 IF FND_API.to_Boolean(p_init_msg_list) THEN
82 FND_MSG_PUB.initialize;
83 END IF;
84
85
86 -- Debug info.
87 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
88 hz_utility_v2pub.debug(p_message=>'get_person_cust_bo(+)',
89 p_prefix=>l_debug_prefix,
90 p_msg_level=>fnd_log.level_procedure);
91 END IF;
92
93 x_person_cust_obj := HZ_PERSON_CUST_BO(p_action_type, NULL, NULL);
94
95 HZ_EXTRACT_PERSON_BO_PVT.get_person_bo(
96 p_init_msg_list => fnd_api.g_false,
97 p_person_id => p_person_id,
98 p_action_type => p_action_type,
99 x_person_obj => x_person_cust_obj.person_obj,
100 x_return_status => x_return_status,
101 x_msg_count => x_msg_count,
102 x_msg_data => x_msg_data);
103
104 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
105 RAISE FND_API.G_EXC_ERROR;
106 END IF;
107
108
109 HZ_EXTRACT_CUST_ACCT_BO_PVT.get_cust_acct_bos(
110 p_init_msg_list => fnd_api.g_false,
111 p_parent_id => p_person_id,
112 p_cust_acct_id => NULL,
113 p_action_type => p_action_type,
114 x_cust_acct_objs => x_person_cust_obj.account_objs,
115 x_return_status => x_return_status,
116 x_msg_count => x_msg_count,
117 x_msg_data => x_msg_data);
118
119 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
120 RAISE FND_API.G_EXC_ERROR;
121 END IF;
122
123
124 -- Debug info.
125 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
126 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
127 p_msg_data=>x_msg_data,
128 p_msg_type=>'WARNING',
129 p_msg_level=>fnd_log.level_exception);
130 END IF;
131
132 -- Debug info.
133 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
134 hz_utility_v2pub.debug(p_message=>'get_person_cust_bo (-)',
135 p_prefix=>l_debug_prefix,
136 p_msg_level=>fnd_log.level_procedure);
137 END IF;
138
139
140 EXCEPTION
141
142 WHEN fnd_api.g_exc_error THEN
143 x_return_status := fnd_api.g_ret_sts_error;
144
145 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
146 p_count => x_msg_count,
147 p_data => x_msg_data);
148
149 -- Debug info.
150 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
151 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
152 p_msg_data=>x_msg_data,
153 p_msg_type=>'ERROR',
154 p_msg_level=>fnd_log.level_error);
155 END IF;
156 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
157 hz_utility_v2pub.debug(p_message=>'get_person_cust_bo (-)',
158 p_prefix=>l_debug_prefix,
159 p_msg_level=>fnd_log.level_procedure);
160 END IF;
161 WHEN fnd_api.g_exc_unexpected_error THEN
162 x_return_status := fnd_api.g_ret_sts_unexp_error;
163
164 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
165 p_count => x_msg_count,
166 p_data => x_msg_data);
167
168 -- Debug info.
169 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
170 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
171 p_msg_data=>x_msg_data,
172 p_msg_type=>'UNEXPECTED ERROR',
173 p_msg_level=>fnd_log.level_error);
174 END IF;
175 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
176 hz_utility_v2pub.debug(p_message=>'get_person_cust_bo (-)',
177 p_prefix=>l_debug_prefix,
178 p_msg_level=>fnd_log.level_procedure);
179 END IF;
180 WHEN OTHERS THEN
181 x_return_status := fnd_api.g_ret_sts_unexp_error;
182
183 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
184 fnd_message.set_token('ERROR' ,SQLERRM);
185 fnd_msg_pub.add;
186
187 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
188 p_count => x_msg_count,
189 p_data => x_msg_data);
190
191 -- Debug info.
192 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
193 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
194 p_msg_data=>x_msg_data,
195 p_msg_type=>'SQL ERROR',
196 p_msg_level=>fnd_log.level_error);
197 END IF;
198 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
199 hz_utility_v2pub.debug(p_message=>'get_person_cust_bo (-)',
200 p_prefix=>l_debug_prefix,
201 p_msg_level=>fnd_log.level_procedure);
202 END IF;
203
204 end;
205
206 function get_person_operation_type(p_event_id in number) return varchar2 is
207
208
209 cursor check_person_action_type_csr is
210 select child_operation_flag
211 from hz_bus_obj_tracking
212 where event_id = p_event_id
213 and child_bo_code = 'PERSON'
214 and parent_bo_code = 'PERSON_CUST';
215
216 l_child_operation_flag varchar2(1);
217 begin
218
219 open check_person_action_type_csr;
220 fetch check_person_action_type_csr into l_child_operation_flag;
221 close check_person_action_type_csr;
222
223 return l_child_operation_flag;
224 end;
225
226 --------------------------------------
227 --
228 -- PROCEDURE get_person_custs_created
229 --
230 -- DESCRIPTION
231 --The caller provides an identifier for the Person Customers created business event and
232 --the procedure returns database objects of the type HZ_PERSON CUSTOMER_BO for all of
233 --the Person Customer business objects from the business event.
234
235 --
236 -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
237 --
238 -- ARGUMENTS
239 -- IN:
240 -- p_init_msg_list Initialize message stack if it is set to
241 -- p_event_id BES Event identifier.
242 -- FND_API.G_TRUE. Default is FND_API.G_FALSE.
243 -- OUT:
244 -- x_person_cust_objs One or more created logical person customer.
245 -- x_return_status Return status after the call. The status can
246 -- be fnd_api.g_ret_sts_success (success),
247 -- fnd_api.g_ret_sts_error (error),
248 -- FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
249 -- x_msg_count Number of messages in message stack.
250 -- x_msg_data Message text if x_msg_count is 1.
251 --
252 -- NOTES
253 --
254 -- MODIFICATION HISTORY
255 --
256 -- 10-JUN-2005 AWU Created.
257 --
258
259
260
261 /*
262 The Get Person customers Created procedure is a service to retrieve all of the Person Customer business objects
263 whose creations have been captured by a logical business event. Each Person Customers Created
264 business event signifies that one or more Person Customer business objects have been created.
265 The caller provides an identifier for the Person Customers Created business event and the procedure
266 returns all of the Person Customer business objects from the business event. For each business object
267 creation captured in the business event, the procedure calls the generic Get operation:
268 HZ_PERSON_BO_PVT.get_person_bo
269
270 Gathering all of the returned business objects from those API calls, the procedure packages
271 them in a table structure and returns them to the caller.
272 */
273
274
275 PROCEDURE get_person_custs_created(
276 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
277 p_event_id IN NUMBER,
278 x_person_cust_objs OUT NOCOPY HZ_PERSON_CUST_BO_TBL,
279 x_return_status OUT NOCOPY VARCHAR2,
280 x_msg_count OUT NOCOPY NUMBER,
281 x_msg_data OUT NOCOPY VARCHAR2
282 ) is
283
284 l_obj_root_ids HZ_EXTRACT_BO_UTIL_PVT.BO_ID_TBL;
285 l_debug_prefix VARCHAR2(30) := '';
286 L_CHILD_OPERATION_FLAG varchar2(1);
287 l_action_type varchar2(30);
288
289 begin
290
291 -- initialize API return status to success.
292 x_return_status := FND_API.G_RET_STS_SUCCESS;
293
294 -- Initialize message list if p_init_msg_list is set to TRUE
295 IF FND_API.to_Boolean(p_init_msg_list) THEN
296 FND_MSG_PUB.initialize;
297 END IF;
298
299
300 -- Debug info.
301 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
302 hz_utility_v2pub.debug(p_message=>'get_person_cust_created(+)',
303 p_prefix=>l_debug_prefix,
304 p_msg_level=>fnd_log.level_procedure);
305 END IF;
306
307
308 HZ_EXTRACT_BO_UTIL_PVT.get_bo_root_ids(
309 p_init_msg_list => fnd_api.g_false,
310 p_event_id => p_event_id,
311 x_obj_root_ids => l_obj_root_ids,
312 x_return_status => x_return_status,
313 x_msg_count => x_msg_count,
314 x_msg_data => x_msg_data);
315
316 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
317 RAISE FND_API.G_EXC_ERROR;
318 END IF;
319
320 x_person_cust_objs := HZ_PERSON_CUST_BO_TBL();
321 l_child_operation_flag:= get_person_operation_type(p_event_id);
322
323 if L_CHILD_OPERATION_FLAG = 'I'
324 then
325 l_action_type := 'CREATED';
326 else
327 l_action_type := 'UNCHANGED'; -- default to unchanged.
328 end if;
329
330 for i in 1..l_obj_root_ids.count loop
331
332 x_person_cust_objs.extend;
333
334 x_person_cust_objs(i) := HZ_PERSON_CUST_BO('UNCHANGED', NULL, NULL);
335 HZ_EXTRACT_PERSON_BO_PVT.get_person_bo(
336 p_init_msg_list => fnd_api.g_false,
337 p_person_id => l_obj_root_ids(i),
338 p_action_type => l_action_type,
339 x_person_obj => x_person_cust_objs(i).person_obj,
340 x_return_status => x_return_status,
341 x_msg_count => x_msg_count,
342 x_msg_data => x_msg_data);
343
344 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
345 RAISE FND_API.G_EXC_ERROR;
346 END IF;
347
348 if L_CHILD_OPERATION_FLAG = 'U'
349 then
350 HZ_EXTRACT_PERSON_BO_PVT.set_person_bo_action_type(p_event_id =>p_event_id,
351 p_root_id => l_obj_root_ids(i),
352 px_person_obj => x_person_cust_objs(i).person_obj,
353 x_return_status => x_return_status);
354
355 end if;
356
357 HZ_EXTRACT_CUST_ACCT_BO_PVT.get_cust_acct_bos(
358 p_init_msg_list => fnd_api.g_false,
359 p_parent_id => l_obj_root_ids(i),
360 p_cust_acct_id => NULL,
361 p_action_type => 'CREATED',
362 x_cust_acct_objs => x_person_cust_objs(i).account_objs,
363 x_return_status => x_return_status,
364 x_msg_count => x_msg_count,
365 x_msg_data => x_msg_data);
366
367 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
368 RAISE FND_API.G_EXC_ERROR;
369 END IF;
370 if L_CHILD_OPERATION_FLAG = 'I'
371 then
372 x_person_cust_objs(i).action_type := 'CREATED';
373 else
374 x_person_cust_objs(i).action_type := 'CHILD_UPDATED';
375 end if;
376 end loop;
377
378 -- Debug info.
379 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
380 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
381 p_msg_data=>x_msg_data,
382 p_msg_type=>'WARNING',
383 p_msg_level=>fnd_log.level_exception);
384 END IF;
385
386 -- Debug info.
387 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
388 hz_utility_v2pub.debug(p_message=>'get_person_cust_created (-)',
389 p_prefix=>l_debug_prefix,
390 p_msg_level=>fnd_log.level_procedure);
391 END IF;
392
393
394 EXCEPTION
395
396 WHEN fnd_api.g_exc_error THEN
397 x_return_status := fnd_api.g_ret_sts_error;
398
399 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
400 p_count => x_msg_count,
401 p_data => x_msg_data);
402
403 -- Debug info.
404 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
405 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
406 p_msg_data=>x_msg_data,
407 p_msg_type=>'ERROR',
408 p_msg_level=>fnd_log.level_error);
409 END IF;
410 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
411 hz_utility_v2pub.debug(p_message=>'get_person_cust_created(-)',
412 p_prefix=>l_debug_prefix,
413 p_msg_level=>fnd_log.level_procedure);
414 END IF;
415 WHEN fnd_api.g_exc_unexpected_error THEN
416 x_return_status := fnd_api.g_ret_sts_unexp_error;
417
418 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
419 p_count => x_msg_count,
420 p_data => x_msg_data);
421
422 -- Debug info.
423 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
424 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
425 p_msg_data=>x_msg_data,
426 p_msg_type=>'UNEXPECTED ERROR',
427 p_msg_level=>fnd_log.level_error);
428 END IF;
429 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
430 hz_utility_v2pub.debug(p_message=>'get_person_cust_created(-)',
431 p_prefix=>l_debug_prefix,
432 p_msg_level=>fnd_log.level_procedure);
433 END IF;
434 WHEN OTHERS THEN
435 x_return_status := fnd_api.g_ret_sts_unexp_error;
436
437 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
438 fnd_message.set_token('ERROR' ,SQLERRM);
439 fnd_msg_pub.add;
440
441 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
442 p_count => x_msg_count,
443 p_data => x_msg_data);
444
445 -- Debug info.
446 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
447 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
448 p_msg_data=>x_msg_data,
449 p_msg_type=>'SQL ERROR',
450 p_msg_level=>fnd_log.level_error);
451 END IF;
452 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
453 hz_utility_v2pub.debug(p_message=>'get_person_cust_created(-)',
454 p_prefix=>l_debug_prefix,
455 p_msg_level=>fnd_log.level_procedure);
456 END IF;
457
458 end;
459
460
461 --------------------------------------
462 --
463 -- PROCEDURE get_person_custs_updated
464 --
465 -- DESCRIPTION
466 --The caller provides an identifier for the Person Customers update business event and
467 --the procedure returns database objects of the type HZ_PERSON_CUST_BO for all of
468 --the Person Customer business objects from the business event.
469
470 --
471 -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
472 --
473 -- ARGUMENTS
474 -- IN:
475 -- p_init_msg_list Initialize message stack if it is set to
476 -- p_event_id BES Event identifier.
477 -- FND_API.G_TRUE. Default is FND_API.G_FALSE.
478 -- OUT:
479 -- x_person_cust_objs One or more created logical person.
480 -- x_return_status Return status after the call. The status can
481 -- be fnd_api.g_ret_sts_success (success),
482 -- fnd_api.g_ret_sts_error (error),
483 -- FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
484 -- x_msg_count Number of messages in message stack.
485 -- x_msg_data Message text if x_msg_count is 1.
486 --
487 -- NOTES
488 --
489 -- MODIFICATION HISTORY
490 --
491 -- 10-JUN-2005 AWU Created.
492 --
493
494
495
496 /*
497 The Get Person Customers Updated procedure is a service to retrieve all of the Person Customer business objects
498 whose updates have been captured by the logical business event. Each Person Customers Updated business event signifies
499 that one or more Person Customer business objects have been updated.
500 The caller provides an identifier for the Person Customers Update business event and the procedure returns database
501 objects of the type HZ_PERSON_CUST_BO for all of the Person Customer business objects from the business event.
502 Gathering all of the returned database objects from those API calls, the procedure packages them in a table structure
503 and returns them to the caller.
504 */
505
506 PROCEDURE get_person_custs_updated(
507 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
508 p_event_id IN NUMBER,
509 x_person_cust_objs OUT NOCOPY HZ_PERSON_CUST_BO_TBL,
510 x_return_status OUT NOCOPY VARCHAR2,
511 x_msg_count OUT NOCOPY NUMBER,
512 x_msg_data OUT NOCOPY VARCHAR2
513 ) is
514
515 l_obj_root_ids HZ_EXTRACT_BO_UTIL_PVT.BO_ID_TBL;
516 l_debug_prefix VARCHAR2(30) := '';
517
518 begin
519
520 -- initialize API return status to success.
521 x_return_status := FND_API.G_RET_STS_SUCCESS;
522
523 -- Initialize message list if p_init_msg_list is set to TRUE
524 IF FND_API.to_Boolean(p_init_msg_list) THEN
525 FND_MSG_PUB.initialize;
526 END IF;
527
528
529 -- Debug info.
530 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
531 hz_utility_v2pub.debug(p_message=>'get_person_custs_updated(+)',
532 p_prefix=>l_debug_prefix,
533 p_msg_level=>fnd_log.level_procedure);
534 END IF;
535
536
537 HZ_EXTRACT_BO_UTIL_PVT.get_bo_root_ids(
538 p_init_msg_list => fnd_api.g_false,
539 p_event_id => p_event_id,
540 x_obj_root_ids => l_obj_root_ids,
541 x_return_status => x_return_status,
542 x_msg_count => x_msg_count,
543 x_msg_data => x_msg_data);
544
545 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
546 RAISE FND_API.G_EXC_ERROR;
547 END IF;
548
549 -- call event API get_person_cust_updated for each id.
550
551 x_person_cust_objs := HZ_PERSON_CUST_BO_TBL();
552
553 for i in 1..l_obj_root_ids.count loop
554
555 x_person_cust_objs.extend;
556 get_person_cust_updated(
557 p_init_msg_list => fnd_api.g_false,
558 p_event_id => p_event_id,
559 p_person_cust_id => l_obj_root_ids(i),
560 x_person_cust_obj => x_person_cust_objs(i),
561 x_return_status => x_return_status,
562 x_msg_count => x_msg_count,
563 x_msg_data => x_msg_data);
564
565 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
566 RAISE FND_API.G_EXC_ERROR;
567 END IF;
568
569
570 end loop;
571
572
573 -- Debug info.
574 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
575 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
576 p_msg_data=>x_msg_data,
577 p_msg_type=>'WARNING',
578 p_msg_level=>fnd_log.level_exception);
579 END IF;
580
581 -- Debug info.
582 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
583 hz_utility_v2pub.debug(p_message=>'get_person_custs_updated (-)',
584 p_prefix=>l_debug_prefix,
585 p_msg_level=>fnd_log.level_procedure);
586 END IF;
587
588
589 EXCEPTION
590
591 WHEN fnd_api.g_exc_error THEN
592 x_return_status := fnd_api.g_ret_sts_error;
593
594 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
595 p_count => x_msg_count,
596 p_data => x_msg_data);
597
598 -- Debug info.
599 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
600 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
601 p_msg_data=>x_msg_data,
602 p_msg_type=>'ERROR',
603 p_msg_level=>fnd_log.level_error);
604 END IF;
605 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
606 hz_utility_v2pub.debug(p_message=>'get_person_custs_updated(-)',
607 p_prefix=>l_debug_prefix,
608 p_msg_level=>fnd_log.level_procedure);
609 END IF;
610 WHEN fnd_api.g_exc_unexpected_error THEN
611 x_return_status := fnd_api.g_ret_sts_unexp_error;
612
613 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
614 p_count => x_msg_count,
615 p_data => x_msg_data);
616
617 -- Debug info.
618 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
619 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
620 p_msg_data=>x_msg_data,
621 p_msg_type=>'UNEXPECTED ERROR',
622 p_msg_level=>fnd_log.level_error);
623 END IF;
624 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
625 hz_utility_v2pub.debug(p_message=>'get_person_custs_updated(-)',
626 p_prefix=>l_debug_prefix,
627 p_msg_level=>fnd_log.level_procedure);
628 END IF;
629 WHEN OTHERS THEN
630 x_return_status := fnd_api.g_ret_sts_unexp_error;
631
632 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
633 fnd_message.set_token('ERROR' ,SQLERRM);
634 fnd_msg_pub.add;
635
636 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
637 p_count => x_msg_count,
638 p_data => x_msg_data);
639
640 -- Debug info.
641 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
642 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
643 p_msg_data=>x_msg_data,
644 p_msg_type=>'SQL ERROR',
645 p_msg_level=>fnd_log.level_error);
646 END IF;
647 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
648 hz_utility_v2pub.debug(p_message=>'get_person_custs_updated(-)',
649 p_prefix=>l_debug_prefix,
650 p_msg_level=>fnd_log.level_procedure);
651 END IF;
652
653 end;
654
655 procedure set_per_acct_bo_action_type(p_node_path IN VARCHAR2,
656 p_child_id IN NUMBER,
657 p_action_type IN VARCHAR2,
658 p_child_entity_name IN VARCHAR2,
659 px_cust_acct_obj IN OUT NOCOPY HZ_CUST_ACCT_BO) is
660 l_child_upd_flag varchar2(1):='N';
661 begin
662
663 -- check root level entities
664 if p_child_entity_name = 'HZ_CUST_ACCOUNTS'
665 then
666 if px_cust_acct_obj.cust_acct_id = p_child_id
667 then
668 PX_CUST_ACCT_OBJ.action_type := p_action_type;
669 l_child_upd_flag := 'N';
670 end if;
671 end if;
672
673 -- check first level objs
674
675
676 if p_child_entity_name = 'IBY_FNDCPT_PAYER_ASSGN_INSTR_V' then
677 for i in 1..PX_CUST_ACCT_OBJ.BANK_ACCT_USE_OBJS.COUNT
678 loop
679 if PX_CUST_ACCT_OBJ.BANK_ACCT_USE_OBJS(i).BANK_ACCT_USE_ID = p_child_id
680 then PX_CUST_ACCT_OBJ.BANK_ACCT_USE_OBJS(i).action_type := p_action_type;
681 l_child_upd_flag := 'Y';
682 end if;
683 end loop;
684 elsif p_child_entity_name = 'HZ_CUST_ACCT_RELATE_ALL' then
685 for i in 1..PX_CUST_ACCT_OBJ.ACCT_RELATE_OBJS.COUNT
686 loop
687 if PX_CUST_ACCT_OBJ.ACCT_RELATE_OBJS(i).RELATED_CUST_ACCT_ID = p_child_id
688 then PX_CUST_ACCT_OBJ.ACCT_RELATE_OBJS(i).action_type := p_action_type;
689 l_child_upd_flag := 'Y';
690 end if;
691 end loop;
692 elsif p_child_entity_name = 'RA_CUST_RECEIPT_METHODS' then
693
694 if PX_CUST_ACCT_OBJ.PAYMENT_METHOD_OBJ.PAYMENT_METHOD_ID = p_child_id
695 then PX_CUST_ACCT_OBJ.PAYMENT_METHOD_OBJ.action_type := p_action_type;
696 l_child_upd_flag := 'Y';
697 end if;
698 end if;
699 if px_cust_acct_obj.action_type = 'UNCHANGED' and l_child_upd_flag = 'Y'
700 then
701 px_cust_acct_obj.action_type := 'CHILD_UPDATED';
702 end if;
703
704
705 -- check customer porfile obj
706 if instr(p_node_path, 'PERSON_CUST/CUST_ACCT/CUST_PROFILE') > 0
707 then
708 if p_child_entity_name = 'HZ_CUSTOMER_PROFILES'
709 then
710 if PX_CUST_ACCT_OBJ.CUST_PROFILE_OBJ.CUST_ACCT_PROFILE_ID = p_child_id
711 then
712 PX_CUST_ACCT_OBJ.CUST_PROFILE_OBJ.action_type := p_action_type;
713 l_child_upd_flag := 'N';
714 end if;
715 end if;
716
717 if p_child_entity_name = 'HZ_CUST_PROFILE_AMTS'
718 then
719 for i in 1..PX_CUST_ACCT_OBJ.CUST_PROFILE_OBJ.CUST_PROFILE_AMT_OBJS.COUNT
720 loop
721 if PX_CUST_ACCT_OBJ.CUST_PROFILE_OBJ.CUST_PROFILE_AMT_OBJS(i).CUST_ACCT_PROFILE_AMT_ID = p_child_id
722 then PX_CUST_ACCT_OBJ.CUST_PROFILE_OBJ.CUST_PROFILE_AMT_OBJS(i).action_type := p_action_type;
723 l_child_upd_flag := 'Y';
724 end if;
725 end loop;
726 end if;
727
728 if px_cust_acct_obj.CUST_PROFILE_OBJ.action_type = 'UNCHANGED' and l_child_upd_flag = 'Y'
729 then
730 px_cust_acct_obj.CUST_PROFILE_OBJ.action_type := 'CHILD_UPDATED';
731 end if;
732
733 end if;
734
735 -- check account contact obj
736
737 if instr(p_node_path, 'PERSON_CUST/CUST_ACCT/CUST_ACCT_CONTACT') > 0
738 then
739 for i in 1..PX_CUST_ACCT_OBJ.CUST_ACCT_CONTACT_OBJS.COUNT
740 loop
741 if p_child_entity_name = 'HZ_CUST_ACCOUNT_ROLES'
742 then
743 if PX_CUST_ACCT_OBJ.CUST_ACCT_CONTACT_OBJS(i).CUST_ACCT_CONTACT_ID = p_child_id
744 then
745 PX_CUST_ACCT_OBJ.CUST_ACCT_CONTACT_OBJS(i).action_type := p_action_type;
746 l_child_upd_flag := 'N';
747 end if;
748 end if;
749
750
751 if p_child_entity_name = 'HZ_ROLE_RESPONSIBILITY'
752 then
753 for j in 1..PX_CUST_ACCT_OBJ.CUST_ACCT_CONTACT_OBJS(i).CONTACT_ROLE_OBJS.COUNT
754 loop
755 if PX_CUST_ACCT_OBJ.CUST_ACCT_CONTACT_OBJS(i).CONTACT_ROLE_OBJS(j).RESPONSIBILITY_ID = p_child_id
756 then PX_CUST_ACCT_OBJ.CUST_ACCT_CONTACT_OBJS(i).CONTACT_ROLE_OBJS(j).action_type := p_action_type;
757 l_child_upd_flag := 'Y';
758 end if;
759 end loop;
760 end if;
761 if PX_CUST_ACCT_OBJ.CUST_ACCT_CONTACT_OBJS(i).action_type = 'UNCHANGED'
762 and l_child_upd_flag = 'Y'
763 then PX_CUST_ACCT_OBJ.CUST_ACCT_CONTACT_OBJS(i).action_type := 'CHILD_UPDATED';
764 end if;
765 end loop;
766
767 end if;
768
769 -- check account site obj
770
771 if instr(p_node_path, 'PERSON_CUST/CUST_ACCT/CUST_ACCT_SITE') > 0
772 then
773 for i in 1..PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS.COUNT
774 loop
775 if p_child_entity_name = 'HZ_CUST_ACCT_SITES_ALL'
776 then
777 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).cust_acct_site_id = p_child_id
778 then
779 PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).action_type := p_action_type;
780 l_child_upd_flag := 'N';
781 end if;
782 end if;
783
784 for j in 1..PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS.COUNT
785 loop
786 if p_child_entity_name = 'HZ_CUST_SITE_USES_ALL'
787 then
788
789 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).SITE_USE_ID = p_child_id
790 then PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).action_type := p_action_type;
791 l_child_upd_flag := 'Y';
792 end if;
793 end if;
794
795 if p_child_entity_name = 'IBY_FNDCPT_PAYER_ASSGN_INSTR_V' then
796 for k in 1..PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).BANK_ACCT_USE_OBJS.COUNT
797 loop
798 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).BANK_ACCT_USE_OBJS(k).BANK_ACCT_USE_ID = p_child_id
799 then PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).BANK_ACCT_USE_OBJS(k).action_type := p_action_type;
800 l_child_upd_flag := 'Y';
801 end if;
802 end loop;
803 elsif p_child_entity_name = 'RA_CUST_RECEIPT_METHODS' then
804
805 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).PAYMENT_METHOD_OBJ.PAYMENT_METHOD_ID = p_child_id
806 then PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).PAYMENT_METHOD_OBJ.action_type := p_action_type;
807 l_child_upd_flag := 'Y';
808 end if;
809
810 elsif p_child_entity_name = 'HZ_CUSTOMER_PROFILES' then
811
812 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).SITE_USE_PROFILE_OBJ.CUST_ACCT_PROFILE_ID = p_child_id
813 then PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).SITE_USE_PROFILE_OBJ.action_type := p_action_type;
814 l_child_upd_flag := 'Y';
815 end if;
816
817 end if;
818
819 end loop; -- CUST_ACCT_SITE_USE_OBJS.COUNT
820
821 for j in 1..PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS.COUNT
822 loop
823
824 if p_child_entity_name = 'HZ_CUST_ACCOUNT_ROLES'
825 then
826 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).CUST_ACCT_CONTACT_ID = p_child_id
827 then
828 PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).action_type := p_action_type;
829 l_child_upd_flag := 'N';
830 end if;
831 end if;
832
833
834 if p_child_entity_name = 'HZ_ROLE_RESPONSIBILITY'
835 then
836 for k in 1..PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j). CONTACT_ROLE_OBJS.COUNT
837 loop
838 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).CONTACT_ROLE_OBJS(k).RESPONSIBILITY_ID = p_child_id
839 then PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).CONTACT_ROLE_OBJS(k).action_type := p_action_type;
840 l_child_upd_flag := 'Y';
841 end if;
842 end loop;
843 end if;
844 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).action_type = 'UNCHANGED'
845 and l_child_upd_flag = 'Y'
846 then PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).action_type := 'CHILD_UPDATED';
847 end if;
848 end loop; -- CUST_ACCT_CONTACT_OBJS.COUNT
849 if PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).action_type = 'UNCHANGED'
850 and l_child_upd_flag = 'Y'
851 then PX_CUST_ACCT_OBJ.CUST_ACCT_SITE_OBJS(i).action_type := 'CHILD_UPDATED';
852 end if;
853 if PX_CUST_ACCT_OBJ.action_type = 'UNCHANGED' and l_child_upd_flag = 'Y'
854 then PX_CUST_ACCT_OBJ.action_type := 'CHILD_UPDATED';
855 end if;
856 end loop; -- acct site obj
857 end if;
858
859 end set_per_acct_bo_action_type;
860
861 procedure set_person_cust_bo_action_type(p_event_id IN NUMBER,
862 p_root_id IN NUMBER,
863 px_person_cust_obj IN OUT NOCOPY HZ_PERSON_CUST_BO,
864 x_return_status OUT NOCOPY VARCHAR2) is
865 cursor c1 is
866
867 SELECT
868 sys_connect_by_path(CHILD_BO_CODE, '/') node_path,
869 CHILD_OPERATION_FLAG,
870 CHILD_BO_CODE,
871 CHILD_ENTITY_NAME,
872 CHILD_ID,
873 populated_flag
874 FROM HZ_BUS_OBJ_TRACKING
875 where event_id = p_event_id
876 START WITH child_id = p_root_id
877 AND child_entity_name = 'HZ_PARTIES'
878 AND PARENT_BO_CODE IS NULL
879 AND event_id = p_event_id
880 AND CHILD_BO_CODE = 'PERSON_CUST' --(or ORG, PERSON_CUST, ORG_CUST).
881 CONNECT BY PARENT_ENTITY_NAME = PRIOR CHILD_ENTITY_NAME
882 AND PARENT_ID = PRIOR CHILD_ID
883 AND parent_bo_code = PRIOR child_bo_code
884 and event_id = PRIOR event_id;
885
886 cursor c2 is
887 select child_event_id,creation_date
888 FROM HZ_BUS_OBJ_TRACKING
889 where event_id = p_event_id
890 and parent_bo_code is null
891 and rownum = 1;
892
893 CURSOR c_get_child_event_id(cp_creation_date DATE) IS
894
895 SELECT event_id
896 FROM HZ_BUS_OBJ_TRACKING
897 WHERE creation_date = cp_creation_date
898 AND child_id = p_root_id
899 AND child_event_id IS NULL
900 and event_id <> p_event_id
901 and rownum = 1;
902
903
904
905 L_CHILD_OPERATION_FLAG VARCHAR2(1);
906 L_CHILD_BO_CODE VARCHAR2(30);
907 L_CHILD_ENTITY_NAME VARCHAR2(30);
908 L_CHILD_ID NUMBER;
909 l_action_type varchar2(30);
910 l_node_path varchar2(2000);
911 l_populated_flag varchar2(1);
912 l_child_upd_flag varchar2(1);
913 l_child_event_id number;
914 l_creation_date date;
915
916 begin
917 -- initialize API return status to success.
918 x_return_status := FND_API.G_RET_STS_SUCCESS;
919
920 open c2;
921 fetch c2 into l_child_event_id, l_creation_date;
922 close c2;
923
924 if l_child_event_id is null
925 then
926 OPEN c_get_child_event_id(l_creation_date);
927 FETCH c_get_child_event_id INTO l_child_event_id;
928 close c_get_child_event_id;
929 end if;
930
931 if l_child_event_id is not null
932 then
933 HZ_EXTRACT_PERSON_BO_PVT.set_person_bo_action_type(p_event_id => l_child_event_id,
934 p_root_id => p_root_id,
935 px_person_obj =>PX_PERSON_CUST_OBJ.PERSON_OBJ,
936 x_return_status => x_return_status);
937 l_child_upd_flag := 'Y';
938
939 end if;
940
941
942 open c1;
943 loop
944 fetch c1 into L_NODE_PATH, L_CHILD_OPERATION_FLAG,L_CHILD_BO_CODE,
945 L_CHILD_ENTITY_NAME, L_CHILD_ID, l_populated_flag;
946 exit when c1%NOTFOUND;
947 if l_populated_flag = 'N'
948 then
949 if L_CHILD_OPERATION_FLAG = 'I'
950 then l_action_type := 'CREATED';
951 elsif L_CHILD_OPERATION_FLAG = 'U'
952 then l_action_type := 'UPDATED';
953 end if;
954
955 -- check account objects
956 if instr(l_node_path, 'PERSON_CUST/CUST_ACCT') > 0
957 then
958 for i in 1..PX_PERSON_CUST_OBJ.ACCOUNT_OBJS.COUNT
959 loop
960 set_per_acct_bo_action_type(p_node_path => l_node_path,
961 p_child_id => l_child_id,
962 p_action_type => l_action_type,
963 p_child_entity_name => l_child_entity_name,
964 px_cust_acct_obj => PX_PERSON_CUST_OBJ.ACCOUNT_OBJS(i) );
965 l_child_upd_flag := 'Y';
966 end loop;
967 end if;
968 end if; -- populated_flag = 'N'
969 end loop;
970 close c1;
971
972 if PX_PERSON_CUST_OBJ.action_type = 'UNCHANGED'
973 and l_child_upd_flag = 'Y'
974 then PX_PERSON_CUST_OBJ.action_type := 'CHILD_UPDATED';
975 end if;
976
977 EXCEPTION
978
979
980 WHEN fnd_api.g_exc_unexpected_error THEN
981 x_return_status := fnd_api.g_ret_sts_unexp_error;
982
983
984 WHEN OTHERS THEN
985 x_return_status := fnd_api.g_ret_sts_unexp_error;
986
987 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
988 fnd_message.set_token('ERROR' ,SQLERRM);
989 fnd_msg_pub.add;
990
991 end set_person_cust_bo_action_type;
992
993 --------------------------------------
994 --
995 -- PROCEDURE get_person_cust_updated
996 --
997 -- DESCRIPTION
998 --The caller provides an identifier for the Person customer update business event and person id
999 --the procedure returns one database object of the type HZ_PERSON_CUST_BO
1000 --
1001 -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
1002 --
1003 -- ARGUMENTS
1004 -- IN:
1005 -- p_init_msg_list Initialize message stack if it is set to
1006 -- p_event_id BES Event identifier.
1007 -- p_person_cust_id Person customer identifier.
1008 -- FND_API.G_TRUE. Default is FND_API.G_FALSE.
1009 -- OUT:
1010 -- x_person_cust_obj One updated logical person.
1011 -- x_return_status Return status after the call. The status can
1012 -- be fnd_api.g_ret_sts_success (success),
1013 -- fnd_api.g_ret_sts_error (error),
1014 -- FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1015 -- x_msg_count Number of messages in message stack.
1016 -- x_msg_data Message text if x_msg_count is 1.
1017 --
1018 -- NOTES
1019 --
1020 -- MODIFICATION HISTORY
1021 --
1022 -- 06-JUN-2005 AWU Created.
1023 --
1024
1025 PROCEDURE get_person_cust_updated(
1026 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
1027 p_event_id IN NUMBER,
1028 p_person_cust_id IN NUMBER,
1029 x_person_cust_obj OUT NOCOPY HZ_PERSON_CUST_BO,
1030 x_return_status OUT NOCOPY VARCHAR2,
1031 x_msg_count OUT NOCOPY NUMBER,
1032 x_msg_data OUT NOCOPY VARCHAR2
1033 ) is
1034
1035 l_obj_root_ids HZ_EXTRACT_BO_UTIL_PVT.BO_ID_TBL;
1036 l_debug_prefix VARCHAR2(30) := '';
1037 l_person_cust_obj HZ_PERSON_CUST_BO;
1038 begin
1039
1040 -- initialize API return status to success.
1041 x_return_status := FND_API.G_RET_STS_SUCCESS;
1042
1043 -- Initialize message list if p_init_msg_list is set to TRUE
1044 IF FND_API.to_Boolean(p_init_msg_list) THEN
1045 FND_MSG_PUB.initialize;
1046 END IF;
1047
1048
1049 -- Debug info.
1050 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1051 hz_utility_v2pub.debug(p_message=>'get_person_cust_updated(+)',
1052 p_prefix=>l_debug_prefix,
1053 p_msg_level=>fnd_log.level_procedure);
1054 END IF;
1055 /* moved to public api
1056 HZ_EXTRACT_BO_UTIL_PVT.validate_event_id(p_event_id => p_event_id,
1057 p_party_id => p_person_cust_id,
1058 x_return_status => x_return_status);
1059
1060 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1061 RAISE FND_API.G_EXC_ERROR;
1062 END IF;
1063 */
1064 -- Set action type to 'UNCHANGED' by default
1065
1066 get_person_cust_bo(
1067 p_init_msg_list => fnd_api.g_false,
1068 p_person_id => p_person_cust_id,
1069 p_action_type => 'UNCHANGED',
1070 x_person_cust_obj => x_person_cust_obj,
1071 x_return_status => x_return_status,
1072 x_msg_count => x_msg_count,
1073 x_msg_data => x_msg_data);
1074
1075 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1076 RAISE FND_API.G_EXC_ERROR;
1077 END IF;
1078
1079
1080 -- Based on BOT, for updated branch, set action_type = 'UPDATED'/'CREATED'
1081
1082 l_person_cust_obj := x_person_cust_obj;
1083 set_person_cust_bo_action_type(p_event_id => p_event_id,
1084 p_root_id => p_person_cust_id,
1085 px_person_cust_obj => l_person_cust_obj,
1086 x_return_status => x_return_status
1087 );
1088 x_person_cust_obj := l_person_cust_obj;
1089
1090 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1091 RAISE FND_API.G_EXC_ERROR;
1092 END IF;
1093
1094
1095
1096 -- Debug info.
1097 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
1098 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1099 p_msg_data=>x_msg_data,
1100 p_msg_type=>'WARNING',
1101 p_msg_level=>fnd_log.level_exception);
1102 END IF;
1103
1104 -- Debug info.
1105 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1106 hz_utility_v2pub.debug(p_message=>'get_person_cust_updated (-)',
1107 p_prefix=>l_debug_prefix,
1108 p_msg_level=>fnd_log.level_procedure);
1109 END IF;
1110
1111
1112 EXCEPTION
1113
1114 WHEN fnd_api.g_exc_error THEN
1115 x_return_status := fnd_api.g_ret_sts_error;
1116
1117 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1118 p_count => x_msg_count,
1119 p_data => x_msg_data);
1120
1121 -- Debug info.
1122 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1123 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1124 p_msg_data=>x_msg_data,
1125 p_msg_type=>'ERROR',
1126 p_msg_level=>fnd_log.level_error);
1127 END IF;
1128 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1129 hz_utility_v2pub.debug(p_message=>'get_person_cust_updated(-)',
1130 p_prefix=>l_debug_prefix,
1131 p_msg_level=>fnd_log.level_procedure);
1132 END IF;
1133 WHEN fnd_api.g_exc_unexpected_error THEN
1134 x_return_status := fnd_api.g_ret_sts_unexp_error;
1135
1136 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1137 p_count => x_msg_count,
1138 p_data => x_msg_data);
1139
1140 -- Debug info.
1141 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1142 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1143 p_msg_data=>x_msg_data,
1144 p_msg_type=>'UNEXPECTED ERROR',
1145 p_msg_level=>fnd_log.level_error);
1146 END IF;
1147 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1148 hz_utility_v2pub.debug(p_message=>'get_person_cust_updated(-)',
1149 p_prefix=>l_debug_prefix,
1150 p_msg_level=>fnd_log.level_procedure);
1151 END IF;
1152 WHEN OTHERS THEN
1153 x_return_status := fnd_api.g_ret_sts_unexp_error;
1154
1155 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
1156 fnd_message.set_token('ERROR' ,SQLERRM);
1157 fnd_msg_pub.add;
1158
1159 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1160 p_count => x_msg_count,
1161 p_data => x_msg_data);
1162
1163 -- Debug info.
1164 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1165 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1166 p_msg_data=>x_msg_data,
1167 p_msg_type=>'SQL ERROR',
1168 p_msg_level=>fnd_log.level_error);
1169 END IF;
1170 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1171 hz_utility_v2pub.debug(p_message=>'get_person_cust_updated(-)',
1172 p_prefix=>l_debug_prefix,
1173 p_msg_level=>fnd_log.level_procedure);
1174 END IF;
1175
1176 end;
1177
1178 --------------------------------------
1179 --
1180 -- PROCEDURE get_person_cust_v2_bo
1181 --
1182 -- DESCRIPTION
1183 -- Get a logical person customer.
1184 --
1185 -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
1186 --
1187 -- ARGUMENTS
1188 -- IN:
1189 -- p_init_msg_list Initialize message stack if it is set to
1190 -- p_person_id Person ID.
1191 -- FND_API.G_TRUE. Default is FND_API.G_FALSE.
1192 -- OUT:
1193 -- x_person_cust_v2_obj Logical person customer record.
1194 -- x_return_status Return status after the call. The status can
1195 -- be fnd_api.g_ret_sts_success (success),
1196 -- fnd_api.g_ret_sts_error (error),
1197 -- FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1198 -- x_msg_count Number of messages in message stack.
1199 -- x_msg_data Message text if x_msg_count is 1.
1200 --
1201 -- NOTES
1202 --
1203 -- MODIFICATION HISTORY
1204 --
1205 --
1206 -- 1-FEB-2008 VSEGU Created.
1207 --
1208
1209 /*
1210 The Get Person Customer API Procedure is a retrieval service that returns a full Person Customer business object.
1211 The user identifies a particular Person Customer business object using the TCA identifier and/or
1212 the object Source System information. Upon proper validation of the object,
1213 the full Person Customer business object is returned. The object consists of all data included within
1214 the Person Customer business object, at all embedded levels. This includes the set of all data stored
1215 in the TCA tables for each embedded entity.
1216
1217 To retrieve the appropriate embedded business objects within the Person Customer business object,
1218 the Get procedure calls the equivalent procedure for the following embedded objects:
1219
1220 Embedded BO Mandatory Multiple Logical API Procedure Comments
1221
1222 Person Y N get_person_bo
1223 Customer Account Y Y get_cust_acct_v2_bo Called for each Customer Account object for the Person Customer
1224
1225 */
1226
1227
1228
1229 PROCEDURE get_person_cust_v2_bo(
1230 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
1231 p_person_id IN NUMBER,
1232 p_action_type IN VARCHAR2 := NULL,
1233 x_person_cust_v2_obj OUT NOCOPY HZ_PERSON_CUST_V2_BO,
1234 x_return_status OUT NOCOPY VARCHAR2,
1235 x_msg_count OUT NOCOPY NUMBER,
1236 x_msg_data OUT NOCOPY VARCHAR2
1237 ) is
1238
1239 l_debug_prefix VARCHAR2(30) := '';
1240
1241 begin
1242 -- initialize API return status to success.
1243 x_return_status := FND_API.G_RET_STS_SUCCESS;
1244
1245 -- Initialize message list if p_init_msg_list is set to TRUE
1246 IF FND_API.to_Boolean(p_init_msg_list) THEN
1247 FND_MSG_PUB.initialize;
1248 END IF;
1249
1250
1251 -- Debug info.
1252 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1253 hz_utility_v2pub.debug(p_message=>'get_person_cust_v2_bo(+)',
1254 p_prefix=>l_debug_prefix,
1255 p_msg_level=>fnd_log.level_procedure);
1256 END IF;
1257
1258 x_person_cust_v2_obj := HZ_PERSON_CUST_V2_BO(p_action_type, NULL, NULL);
1259
1260 HZ_EXTRACT_PERSON_BO_PVT.get_person_bo(
1261 p_init_msg_list => fnd_api.g_false,
1262 p_person_id => p_person_id,
1263 p_action_type => p_action_type,
1264 x_person_obj => x_person_cust_v2_obj.person_obj,
1265 x_return_status => x_return_status,
1266 x_msg_count => x_msg_count,
1267 x_msg_data => x_msg_data);
1268
1269 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1270 RAISE FND_API.G_EXC_ERROR;
1271 END IF;
1272
1273
1274 HZ_EXTRACT_CUST_ACCT_BO_PVT.get_cust_acct_v2_bos(
1275 p_init_msg_list => fnd_api.g_false,
1276 p_parent_id => p_person_id,
1277 p_cust_acct_id => NULL,
1278 p_action_type => p_action_type,
1279 x_cust_acct_v2_objs => x_person_cust_v2_obj.account_objs,
1280 x_return_status => x_return_status,
1281 x_msg_count => x_msg_count,
1282 x_msg_data => x_msg_data);
1283
1284 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1285 RAISE FND_API.G_EXC_ERROR;
1286 END IF;
1287
1288
1289 -- Debug info.
1290 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
1291 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1292 p_msg_data=>x_msg_data,
1293 p_msg_type=>'WARNING',
1294 p_msg_level=>fnd_log.level_exception);
1295 END IF;
1296
1297 -- Debug info.
1298 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1299 hz_utility_v2pub.debug(p_message=>'get_person_cust_v2_bo (-)',
1300 p_prefix=>l_debug_prefix,
1301 p_msg_level=>fnd_log.level_procedure);
1302 END IF;
1303
1304
1305 EXCEPTION
1306
1307 WHEN fnd_api.g_exc_error THEN
1308 x_return_status := fnd_api.g_ret_sts_error;
1309
1310 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1311 p_count => x_msg_count,
1312 p_data => x_msg_data);
1313
1314 -- Debug info.
1315 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1316 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1317 p_msg_data=>x_msg_data,
1318 p_msg_type=>'ERROR',
1319 p_msg_level=>fnd_log.level_error);
1320 END IF;
1321 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1322 hz_utility_v2pub.debug(p_message=>'get_person_cust_v2_bo (-)',
1323 p_prefix=>l_debug_prefix,
1324 p_msg_level=>fnd_log.level_procedure);
1325 END IF;
1326 WHEN fnd_api.g_exc_unexpected_error THEN
1327 x_return_status := fnd_api.g_ret_sts_unexp_error;
1328
1329 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1330 p_count => x_msg_count,
1331 p_data => x_msg_data);
1332
1333 -- Debug info.
1334 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1335 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1336 p_msg_data=>x_msg_data,
1337 p_msg_type=>'UNEXPECTED ERROR',
1338 p_msg_level=>fnd_log.level_error);
1339 END IF;
1340 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1341 hz_utility_v2pub.debug(p_message=>'get_person_cust_v2_bo (-)',
1342 p_prefix=>l_debug_prefix,
1343 p_msg_level=>fnd_log.level_procedure);
1344 END IF;
1345 WHEN OTHERS THEN
1346 x_return_status := fnd_api.g_ret_sts_unexp_error;
1347
1348 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
1349 fnd_message.set_token('ERROR' ,SQLERRM);
1350 fnd_msg_pub.add;
1351
1352 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1353 p_count => x_msg_count,
1354 p_data => x_msg_data);
1355
1356 -- Debug info.
1357 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1358 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1359 p_msg_data=>x_msg_data,
1360 p_msg_type=>'SQL ERROR',
1361 p_msg_level=>fnd_log.level_error);
1362 END IF;
1363 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1364 hz_utility_v2pub.debug(p_message=>'get_person_cust_v2_bo (-)',
1365 p_prefix=>l_debug_prefix,
1366 p_msg_level=>fnd_log.level_procedure);
1367 END IF;
1368
1369 end;
1370
1371
1372 --------------------------------------
1373 --
1374 -- PROCEDURE get_v2_person_custs_created
1375 --
1376 -- DESCRIPTION
1377 --The caller provides an identifier for the Person Customers created business event and
1378 --the procedure returns database objects of the type HZ_PERSON CUSTOMER_BO for all of
1379 --the Person Customer business objects from the business event.
1380
1381 --
1382 -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
1383 --
1384 -- ARGUMENTS
1385 -- IN:
1386 -- p_init_msg_list Initialize message stack if it is set to
1387 -- p_event_id BES Event identifier.
1388 -- FND_API.G_TRUE. Default is FND_API.G_FALSE.
1389 -- OUT:
1390 -- x_person_cust_v2_objs One or more created logical person customer.
1391 -- x_return_status Return status after the call. The status can
1392 -- be fnd_api.g_ret_sts_success (success),
1393 -- fnd_api.g_ret_sts_error (error),
1394 -- FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1395 -- x_msg_count Number of messages in message stack.
1396 -- x_msg_data Message text if x_msg_count is 1.
1397 --
1398 -- NOTES
1399 --
1400 -- MODIFICATION HISTORY
1401 --
1402 -- 4-FEB-2008 VSEGU Created.
1403 --
1404
1405
1406
1407 /*
1408 The Get Person customers Created procedure is a service to retrieve all of the Person Customer business objects
1409 whose creations have been captured by a logical business event. Each Person Customers Created
1410 business event signifies that one or more Person Customer business objects have been created.
1411 The caller provides an identifier for the Person Customers Created business event and the procedure
1412 returns all of the Person Customer business objects from the business event. For each business object
1413 creation captured in the business event, the procedure calls the generic Get operation:
1414 HZ_PERSON_BO_PVT.get_person_bo
1415
1416 Gathering all of the returned business objects from those API calls, the procedure packages
1417 them in a table structure and returns them to the caller.
1418 */
1419
1420
1421 PROCEDURE get_v2_person_custs_created(
1422 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
1423 p_event_id IN NUMBER,
1424 x_person_cust_v2_objs OUT NOCOPY HZ_PERSON_CUST_V2_BO_TBL,
1425 x_return_status OUT NOCOPY VARCHAR2,
1426 x_msg_count OUT NOCOPY NUMBER,
1427 x_msg_data OUT NOCOPY VARCHAR2
1428 ) is
1429
1430 l_obj_root_ids HZ_EXTRACT_BO_UTIL_PVT.BO_ID_TBL;
1431 l_debug_prefix VARCHAR2(30) := '';
1432 L_CHILD_OPERATION_FLAG varchar2(1);
1433 l_action_type varchar2(30);
1434
1435 begin
1436
1437 -- initialize API return status to success.
1438 x_return_status := FND_API.G_RET_STS_SUCCESS;
1439
1440 -- Initialize message list if p_init_msg_list is set to TRUE
1441 IF FND_API.to_Boolean(p_init_msg_list) THEN
1442 FND_MSG_PUB.initialize;
1443 END IF;
1444
1445
1446 -- Debug info.
1447 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1448 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_created(+)',
1449 p_prefix=>l_debug_prefix,
1450 p_msg_level=>fnd_log.level_procedure);
1451 END IF;
1452
1453
1454 HZ_EXTRACT_BO_UTIL_PVT.get_bo_root_ids(
1455 p_init_msg_list => fnd_api.g_false,
1456 p_event_id => p_event_id,
1457 x_obj_root_ids => l_obj_root_ids,
1458 x_return_status => x_return_status,
1459 x_msg_count => x_msg_count,
1460 x_msg_data => x_msg_data);
1461
1462 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1463 RAISE FND_API.G_EXC_ERROR;
1464 END IF;
1465
1466 x_person_cust_v2_objs := HZ_PERSON_CUST_V2_BO_TBL();
1467 l_child_operation_flag:= get_person_operation_type(p_event_id);
1468
1469 if L_CHILD_OPERATION_FLAG = 'I'
1470 then
1471 l_action_type := 'CREATED';
1472 else
1473 l_action_type := 'UNCHANGED'; -- default to unchanged.
1474 end if;
1475
1476 for i in 1..l_obj_root_ids.count loop
1477
1478 x_person_cust_v2_objs.extend;
1479
1480 x_person_cust_v2_objs(i) := HZ_PERSON_CUST_V2_BO('UNCHANGED', NULL, NULL);
1481 HZ_EXTRACT_PERSON_BO_PVT.get_person_bo(
1482 p_init_msg_list => fnd_api.g_false,
1483 p_person_id => l_obj_root_ids(i),
1484 p_action_type => l_action_type,
1485 x_person_obj => x_person_cust_v2_objs(i).person_obj,
1486 x_return_status => x_return_status,
1487 x_msg_count => x_msg_count,
1488 x_msg_data => x_msg_data);
1489
1490 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1491 RAISE FND_API.G_EXC_ERROR;
1492 END IF;
1493
1494 if L_CHILD_OPERATION_FLAG = 'U'
1495 then
1496 HZ_EXTRACT_PERSON_BO_PVT.set_person_bo_action_type(p_event_id =>p_event_id,
1497 p_root_id => l_obj_root_ids(i),
1498 px_person_obj => x_person_cust_v2_objs(i).person_obj,
1499 x_return_status => x_return_status);
1500
1501 end if;
1502
1503 HZ_EXTRACT_CUST_ACCT_BO_PVT.get_cust_acct_v2_bos(
1504 p_init_msg_list => fnd_api.g_false,
1505 p_parent_id => l_obj_root_ids(i),
1506 p_cust_acct_id => NULL,
1507 p_action_type => 'CREATED',
1508 x_cust_acct_v2_objs => x_person_cust_v2_objs(i).account_objs,
1509 x_return_status => x_return_status,
1510 x_msg_count => x_msg_count,
1511 x_msg_data => x_msg_data);
1512
1513 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1514 RAISE FND_API.G_EXC_ERROR;
1515 END IF;
1516 if L_CHILD_OPERATION_FLAG = 'I'
1517 then
1518 x_person_cust_v2_objs(i).action_type := 'CREATED';
1519 else
1520 x_person_cust_v2_objs(i).action_type := 'CHILD_UPDATED';
1521 end if;
1522 end loop;
1523
1524 -- Debug info.
1525 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
1526 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1527 p_msg_data=>x_msg_data,
1528 p_msg_type=>'WARNING',
1529 p_msg_level=>fnd_log.level_exception);
1530 END IF;
1531
1532 -- Debug info.
1533 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1534 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_created (-)',
1535 p_prefix=>l_debug_prefix,
1536 p_msg_level=>fnd_log.level_procedure);
1537 END IF;
1538
1539
1540 EXCEPTION
1541
1542 WHEN fnd_api.g_exc_error THEN
1543 x_return_status := fnd_api.g_ret_sts_error;
1544
1545 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1546 p_count => x_msg_count,
1547 p_data => x_msg_data);
1548
1549 -- Debug info.
1550 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1551 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1552 p_msg_data=>x_msg_data,
1553 p_msg_type=>'ERROR',
1554 p_msg_level=>fnd_log.level_error);
1555 END IF;
1556 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1557 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_created(-)',
1558 p_prefix=>l_debug_prefix,
1559 p_msg_level=>fnd_log.level_procedure);
1560 END IF;
1561 WHEN fnd_api.g_exc_unexpected_error THEN
1562 x_return_status := fnd_api.g_ret_sts_unexp_error;
1563
1564 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1565 p_count => x_msg_count,
1566 p_data => x_msg_data);
1567
1568 -- Debug info.
1569 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1570 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1571 p_msg_data=>x_msg_data,
1572 p_msg_type=>'UNEXPECTED ERROR',
1573 p_msg_level=>fnd_log.level_error);
1574 END IF;
1575 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1576 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_created(-)',
1577 p_prefix=>l_debug_prefix,
1578 p_msg_level=>fnd_log.level_procedure);
1579 END IF;
1580 WHEN OTHERS THEN
1581 x_return_status := fnd_api.g_ret_sts_unexp_error;
1582
1583 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
1584 fnd_message.set_token('ERROR' ,SQLERRM);
1585 fnd_msg_pub.add;
1586
1587 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1588 p_count => x_msg_count,
1589 p_data => x_msg_data);
1590
1591 -- Debug info.
1592 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1593 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1594 p_msg_data=>x_msg_data,
1595 p_msg_type=>'SQL ERROR',
1596 p_msg_level=>fnd_log.level_error);
1597 END IF;
1598 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1599 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_created(-)',
1600 p_prefix=>l_debug_prefix,
1601 p_msg_level=>fnd_log.level_procedure);
1602 END IF;
1603
1604 end;
1605
1606
1607
1608 --------------------------------------
1609 --
1610 -- PROCEDURE get_v2_person_custs_updated
1611 --
1612 -- DESCRIPTION
1613 --The caller provides an identifier for the Person Customers update business event and
1614 --the procedure returns database objects of the type HZ_PERSON_CUST_V2_BO for all of
1615 --the Person Customer business objects from the business event.
1616
1617 --
1618 -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
1619 --
1620 -- ARGUMENTS
1621 -- IN:
1622 -- p_init_msg_list Initialize message stack if it is set to
1623 -- p_event_id BES Event identifier.
1624 -- FND_API.G_TRUE. Default is FND_API.G_FALSE.
1625 -- OUT:
1626 -- x_person_cust_v2_objs One or more created logical person.
1627 -- x_return_status Return status after the call. The status can
1628 -- be fnd_api.g_ret_sts_success (success),
1629 -- fnd_api.g_ret_sts_error (error),
1630 -- FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
1631 -- x_msg_count Number of messages in message stack.
1632 -- x_msg_data Message text if x_msg_count is 1.
1633 --
1634 -- NOTES
1635 --
1636 -- MODIFICATION HISTORY
1637 --
1638 -- 10-JUN-2005 AWU Created.
1639 --
1640
1641
1642
1643 /*
1644 The Get Person Customers Updated procedure is a service to retrieve all of the Person Customer business objects
1645 whose updates have been captured by the logical business event. Each Person Customers Updated business event signifies
1646 that one or more Person Customer business objects have been updated.
1647 The caller provides an identifier for the Person Customers Update business event and the procedure returns database
1648 objects of the type HZ_PERSON_CUST_V2_BO for all of the Person Customer business objects from the business event.
1649 Gathering all of the returned database objects from those API calls, the procedure packages them in a table structure
1650 and returns them to the caller.
1651 */
1652
1653 PROCEDURE get_v2_person_custs_updated(
1654 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
1655 p_event_id IN NUMBER,
1656 x_person_cust_v2_objs OUT NOCOPY HZ_PERSON_CUST_V2_BO_TBL,
1657 x_return_status OUT NOCOPY VARCHAR2,
1658 x_msg_count OUT NOCOPY NUMBER,
1659 x_msg_data OUT NOCOPY VARCHAR2
1660 ) is
1661
1662 l_obj_root_ids HZ_EXTRACT_BO_UTIL_PVT.BO_ID_TBL;
1663 l_debug_prefix VARCHAR2(30) := '';
1664
1665 begin
1666
1667 -- initialize API return status to success.
1668 x_return_status := FND_API.G_RET_STS_SUCCESS;
1669
1670 -- Initialize message list if p_init_msg_list is set to TRUE
1671 IF FND_API.to_Boolean(p_init_msg_list) THEN
1672 FND_MSG_PUB.initialize;
1673 END IF;
1674
1675
1676 -- Debug info.
1677 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1678 hz_utility_v2pub.debug(p_message=>'get_v2_person_custs_updated(+)',
1679 p_prefix=>l_debug_prefix,
1680 p_msg_level=>fnd_log.level_procedure);
1681 END IF;
1682
1683
1684 HZ_EXTRACT_BO_UTIL_PVT.get_bo_root_ids(
1685 p_init_msg_list => fnd_api.g_false,
1686 p_event_id => p_event_id,
1687 x_obj_root_ids => l_obj_root_ids,
1688 x_return_status => x_return_status,
1689 x_msg_count => x_msg_count,
1690 x_msg_data => x_msg_data);
1691
1692 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1693 RAISE FND_API.G_EXC_ERROR;
1694 END IF;
1695
1696 -- call event API get_person_cust_updated for each id.
1697
1698 x_person_cust_v2_objs := HZ_PERSON_CUST_V2_BO_TBL();
1699
1700 for i in 1..l_obj_root_ids.count loop
1701
1702 x_person_cust_v2_objs.extend;
1703 get_v2_person_cust_updated(
1704 p_init_msg_list => fnd_api.g_false,
1705 p_event_id => p_event_id,
1706 p_person_cust_id => l_obj_root_ids(i),
1707 x_person_cust_v2_obj => x_person_cust_v2_objs(i),
1708 x_return_status => x_return_status,
1709 x_msg_count => x_msg_count,
1710 x_msg_data => x_msg_data);
1711
1712 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1713 RAISE FND_API.G_EXC_ERROR;
1714 END IF;
1715
1716
1717 end loop;
1718
1719
1720 -- Debug info.
1721 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
1722 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1723 p_msg_data=>x_msg_data,
1724 p_msg_type=>'WARNING',
1725 p_msg_level=>fnd_log.level_exception);
1726 END IF;
1727
1728 -- Debug info.
1729 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1730 hz_utility_v2pub.debug(p_message=>'get_v2_person_custs_updated (-)',
1731 p_prefix=>l_debug_prefix,
1732 p_msg_level=>fnd_log.level_procedure);
1733 END IF;
1734
1735
1736 EXCEPTION
1737
1738 WHEN fnd_api.g_exc_error THEN
1739 x_return_status := fnd_api.g_ret_sts_error;
1740
1741 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1742 p_count => x_msg_count,
1743 p_data => x_msg_data);
1744
1745 -- Debug info.
1746 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1747 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1748 p_msg_data=>x_msg_data,
1749 p_msg_type=>'ERROR',
1750 p_msg_level=>fnd_log.level_error);
1751 END IF;
1752 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1753 hz_utility_v2pub.debug(p_message=>'get_v2_person_custs_updated(-)',
1754 p_prefix=>l_debug_prefix,
1755 p_msg_level=>fnd_log.level_procedure);
1756 END IF;
1757 WHEN fnd_api.g_exc_unexpected_error THEN
1758 x_return_status := fnd_api.g_ret_sts_unexp_error;
1759
1760 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1761 p_count => x_msg_count,
1762 p_data => x_msg_data);
1763
1764 -- Debug info.
1765 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1766 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1767 p_msg_data=>x_msg_data,
1768 p_msg_type=>'UNEXPECTED ERROR',
1769 p_msg_level=>fnd_log.level_error);
1770 END IF;
1771 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1772 hz_utility_v2pub.debug(p_message=>'get_v2_person_custs_updated(-)',
1773 p_prefix=>l_debug_prefix,
1774 p_msg_level=>fnd_log.level_procedure);
1775 END IF;
1776 WHEN OTHERS THEN
1777 x_return_status := fnd_api.g_ret_sts_unexp_error;
1778
1779 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
1780 fnd_message.set_token('ERROR' ,SQLERRM);
1781 fnd_msg_pub.add;
1782
1783 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
1784 p_count => x_msg_count,
1785 p_data => x_msg_data);
1786
1787 -- Debug info.
1788 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
1789 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
1790 p_msg_data=>x_msg_data,
1791 p_msg_type=>'SQL ERROR',
1792 p_msg_level=>fnd_log.level_error);
1793 END IF;
1794 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
1795 hz_utility_v2pub.debug(p_message=>'get_v2_person_custs_updated(-)',
1796 p_prefix=>l_debug_prefix,
1797 p_msg_level=>fnd_log.level_procedure);
1798 END IF;
1799
1800 end;
1801
1802 procedure set_v2_per_acct_bo_action_type(p_node_path IN VARCHAR2,
1803 p_child_id IN NUMBER,
1804 p_action_type IN VARCHAR2,
1805 p_child_entity_name IN VARCHAR2,
1806 px_cust_acct_v2_obj IN OUT NOCOPY HZ_CUST_ACCT_V2_BO) is
1807 l_child_upd_flag varchar2(1):='N';
1808 begin
1809
1810 -- check root level entities
1811 if p_child_entity_name = 'HZ_CUST_ACCOUNTS'
1812 then
1813 if px_cust_acct_v2_obj.cust_acct_id = p_child_id
1814 then
1815 px_cust_acct_v2_obj.action_type := p_action_type;
1816 l_child_upd_flag := 'N';
1817 end if;
1818 end if;
1819
1820 -- check first level objs
1821
1822
1823 if p_child_entity_name = 'IBY_FNDCPT_PAYER_ASSGN_INSTR_V' then
1824 for i in 1..px_cust_acct_v2_obj.BANK_ACCT_USE_OBJS.COUNT
1825 loop
1826 if px_cust_acct_v2_obj.BANK_ACCT_USE_OBJS(i).BANK_ACCT_USE_ID = p_child_id
1827 then px_cust_acct_v2_obj.BANK_ACCT_USE_OBJS(i).action_type := p_action_type;
1828 l_child_upd_flag := 'Y';
1829 end if;
1830 end loop;
1831 elsif p_child_entity_name = 'HZ_CUST_ACCT_RELATE_ALL' then
1832 for i in 1..px_cust_acct_v2_obj.ACCT_RELATE_OBJS.COUNT
1833 loop
1834 if px_cust_acct_v2_obj.ACCT_RELATE_OBJS(i).RELATED_CUST_ACCT_ID = p_child_id
1835 then px_cust_acct_v2_obj.ACCT_RELATE_OBJS(i).action_type := p_action_type;
1836 l_child_upd_flag := 'Y';
1837 end if;
1838 end loop;
1839 elsif p_child_entity_name = 'RA_CUST_RECEIPT_METHODS' then
1840 for i in 1..px_cust_acct_v2_obj.PAYMENT_METHOD_OBJS.COUNT
1841 loop
1842 if px_cust_acct_v2_obj.PAYMENT_METHOD_OBJS(i).PAYMENT_METHOD_ID = p_child_id
1843 then px_cust_acct_v2_obj.PAYMENT_METHOD_OBJS(i).action_type := p_action_type;
1844 l_child_upd_flag := 'Y';
1845 end if;
1846 end loop;
1847 end if;
1848 if px_cust_acct_v2_obj.action_type = 'UNCHANGED' and l_child_upd_flag = 'Y'
1849 then
1850 px_cust_acct_v2_obj.action_type := 'CHILD_UPDATED';
1851 end if;
1852
1853
1854 -- check customer porfile obj
1855 if instr(p_node_path, 'PERSON_CUST/CUST_ACCT/CUST_PROFILE') > 0
1856 then
1857 if p_child_entity_name = 'HZ_CUSTOMER_PROFILES'
1858 then
1859 if px_cust_acct_v2_obj.CUST_PROFILE_OBJ.CUST_ACCT_PROFILE_ID = p_child_id
1860 then
1861 px_cust_acct_v2_obj.CUST_PROFILE_OBJ.action_type := p_action_type;
1862 l_child_upd_flag := 'N';
1863 end if;
1864 end if;
1865
1866 if p_child_entity_name = 'HZ_CUST_PROFILE_AMTS'
1867 then
1868 for i in 1..px_cust_acct_v2_obj.CUST_PROFILE_OBJ.CUST_PROFILE_AMT_OBJS.COUNT
1869 loop
1870 if px_cust_acct_v2_obj.CUST_PROFILE_OBJ.CUST_PROFILE_AMT_OBJS(i).CUST_ACCT_PROFILE_AMT_ID = p_child_id
1871 then px_cust_acct_v2_obj.CUST_PROFILE_OBJ.CUST_PROFILE_AMT_OBJS(i).action_type := p_action_type;
1872 l_child_upd_flag := 'Y';
1873 end if;
1874 end loop;
1875 end if;
1876
1877 if px_cust_acct_v2_obj.CUST_PROFILE_OBJ.action_type = 'UNCHANGED' and l_child_upd_flag = 'Y'
1878 then
1879 px_cust_acct_v2_obj.CUST_PROFILE_OBJ.action_type := 'CHILD_UPDATED';
1880 end if;
1881
1882 end if;
1883
1884 -- check account contact obj
1885
1886 if instr(p_node_path, 'PERSON_CUST/CUST_ACCT/CUST_ACCT_CONTACT') > 0
1887 then
1888 for i in 1..px_cust_acct_v2_obj.CUST_ACCT_CONTACT_OBJS.COUNT
1889 loop
1890 if p_child_entity_name = 'HZ_CUST_ACCOUNT_ROLES'
1891 then
1892 if px_cust_acct_v2_obj.CUST_ACCT_CONTACT_OBJS(i).CUST_ACCT_CONTACT_ID = p_child_id
1893 then
1894 px_cust_acct_v2_obj.CUST_ACCT_CONTACT_OBJS(i).action_type := p_action_type;
1895 l_child_upd_flag := 'N';
1896 end if;
1897 end if;
1898
1899
1900 if p_child_entity_name = 'HZ_ROLE_RESPONSIBILITY'
1901 then
1902 for j in 1..px_cust_acct_v2_obj.CUST_ACCT_CONTACT_OBJS(i).CONTACT_ROLE_OBJS.COUNT
1903 loop
1904 if px_cust_acct_v2_obj.CUST_ACCT_CONTACT_OBJS(i).CONTACT_ROLE_OBJS(j).RESPONSIBILITY_ID = p_child_id
1905 then px_cust_acct_v2_obj.CUST_ACCT_CONTACT_OBJS(i).CONTACT_ROLE_OBJS(j).action_type := p_action_type;
1906 l_child_upd_flag := 'Y';
1907 end if;
1908 end loop;
1909 end if;
1910 if px_cust_acct_v2_obj.CUST_ACCT_CONTACT_OBJS(i).action_type = 'UNCHANGED'
1911 and l_child_upd_flag = 'Y'
1912 then px_cust_acct_v2_obj.CUST_ACCT_CONTACT_OBJS(i).action_type := 'CHILD_UPDATED';
1913 end if;
1914 end loop;
1915
1916 end if;
1917
1918 -- check account site obj
1919
1920 if instr(p_node_path, 'PERSON_CUST/CUST_ACCT/CUST_ACCT_SITE') > 0
1921 then
1922 for i in 1..px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS.COUNT
1923 loop
1924 if p_child_entity_name = 'HZ_CUST_ACCT_SITES_ALL'
1925 then
1926 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).cust_acct_site_id = p_child_id
1927 then
1928 px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).action_type := p_action_type;
1929 l_child_upd_flag := 'N';
1930 end if;
1931 end if;
1932
1933 for j in 1..px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS.COUNT
1934 loop
1935 if p_child_entity_name = 'HZ_CUST_SITE_USES_ALL'
1936 then
1937
1938 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).SITE_USE_ID = p_child_id
1939 then px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).action_type := p_action_type;
1940 l_child_upd_flag := 'Y';
1941 end if;
1942 end if;
1943
1944 if p_child_entity_name = 'IBY_FNDCPT_PAYER_ASSGN_INSTR_V' then
1945 for k in 1..px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).BANK_ACCT_USE_OBJS.COUNT
1946 loop
1947 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).BANK_ACCT_USE_OBJS(k).BANK_ACCT_USE_ID = p_child_id
1948 then px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).BANK_ACCT_USE_OBJS(k).action_type := p_action_type;
1949 l_child_upd_flag := 'Y';
1950 end if;
1951 end loop;
1952 elsif p_child_entity_name = 'RA_CUST_RECEIPT_METHODS' then
1953 for k in 1..px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).PAYMENT_METHOD_OBJS.COUNT
1954 loop
1955 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).PAYMENT_METHOD_OBJS(k).PAYMENT_METHOD_ID = p_child_id
1956 then px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).PAYMENT_METHOD_OBJS(k).action_type := p_action_type;
1957 l_child_upd_flag := 'Y';
1958 end if;
1959 end loop;
1960
1961 elsif p_child_entity_name = 'HZ_CUSTOMER_PROFILES' then
1962
1963 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).SITE_USE_PROFILE_OBJ.CUST_ACCT_PROFILE_ID = p_child_id
1964 then px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_SITE_USE_OBJS(j).SITE_USE_PROFILE_OBJ.action_type := p_action_type;
1965 l_child_upd_flag := 'Y';
1966 end if;
1967
1968 end if;
1969
1970 end loop; -- CUST_ACCT_SITE_USE_OBJS.COUNT
1971
1972 for j in 1..px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS.COUNT
1973 loop
1974
1975 if p_child_entity_name = 'HZ_CUST_ACCOUNT_ROLES'
1976 then
1977 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).CUST_ACCT_CONTACT_ID = p_child_id
1978 then
1979 px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).action_type := p_action_type;
1980 l_child_upd_flag := 'N';
1981 end if;
1982 end if;
1983
1984
1985 if p_child_entity_name = 'HZ_ROLE_RESPONSIBILITY'
1986 then
1987 for k in 1..px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j). CONTACT_ROLE_OBJS.COUNT
1988 loop
1989 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).CONTACT_ROLE_OBJS(k).RESPONSIBILITY_ID = p_child_id
1990 then px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).CONTACT_ROLE_OBJS(k).action_type := p_action_type;
1991 l_child_upd_flag := 'Y';
1992 end if;
1993 end loop;
1994 end if;
1995 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).action_type = 'UNCHANGED'
1996 and l_child_upd_flag = 'Y'
1997 then px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).CUST_ACCT_CONTACT_OBJS(j).action_type := 'CHILD_UPDATED';
1998 end if;
1999 end loop; -- CUST_ACCT_CONTACT_OBJS.COUNT
2000 if px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).action_type = 'UNCHANGED'
2001 and l_child_upd_flag = 'Y'
2002 then px_cust_acct_v2_obj.CUST_ACCT_SITE_OBJS(i).action_type := 'CHILD_UPDATED';
2003 end if;
2004 if px_cust_acct_v2_obj.action_type = 'UNCHANGED' and l_child_upd_flag = 'Y'
2005 then px_cust_acct_v2_obj.action_type := 'CHILD_UPDATED';
2006 end if;
2007 end loop; -- acct site obj
2008 end if;
2009
2010 end set_v2_per_acct_bo_action_type;
2011
2012
2013 procedure set_person_cust_bo_action_type(p_event_id IN NUMBER,
2014 p_root_id IN NUMBER,
2015 px_person_cust_v2_obj IN OUT NOCOPY HZ_PERSON_CUST_V2_BO,
2016 x_return_status OUT NOCOPY VARCHAR2) is
2017 cursor c1 is
2018
2019 SELECT
2020 sys_connect_by_path(CHILD_BO_CODE, '/') node_path,
2021 CHILD_OPERATION_FLAG,
2022 CHILD_BO_CODE,
2023 CHILD_ENTITY_NAME,
2024 CHILD_ID,
2025 populated_flag
2026 FROM HZ_BUS_OBJ_TRACKING
2027 where event_id = p_event_id
2028 START WITH child_id = p_root_id
2029 AND child_entity_name = 'HZ_PARTIES'
2030 AND PARENT_BO_CODE IS NULL
2031 AND event_id = p_event_id
2032 AND CHILD_BO_CODE = 'PERSON_CUST' --(or ORG, PERSON_CUST, ORG_CUST).
2033 CONNECT BY PARENT_ENTITY_NAME = PRIOR CHILD_ENTITY_NAME
2034 AND PARENT_ID = PRIOR CHILD_ID
2035 AND parent_bo_code = PRIOR child_bo_code
2036 and event_id = PRIOR event_id;
2037
2038 cursor c2 is
2039 select child_event_id,creation_date
2040 FROM HZ_BUS_OBJ_TRACKING
2041 where event_id = p_event_id
2042 and parent_bo_code is null
2043 and rownum = 1;
2044
2045 CURSOR c_get_child_event_id(cp_creation_date DATE) IS
2046
2047 SELECT event_id
2048 FROM HZ_BUS_OBJ_TRACKING
2049 WHERE creation_date = cp_creation_date
2050 AND child_id = p_root_id
2051 AND child_event_id IS NULL
2052 and event_id <> p_event_id
2053 and rownum = 1;
2054
2055
2056
2057 L_CHILD_OPERATION_FLAG VARCHAR2(1);
2058 L_CHILD_BO_CODE VARCHAR2(30);
2059 L_CHILD_ENTITY_NAME VARCHAR2(30);
2060 L_CHILD_ID NUMBER;
2061 l_action_type varchar2(30);
2062 l_node_path varchar2(2000);
2063 l_populated_flag varchar2(1);
2064 l_child_upd_flag varchar2(1);
2065 l_child_event_id number;
2066 l_creation_date date;
2067
2068 begin
2069 -- initialize API return status to success.
2070 x_return_status := FND_API.G_RET_STS_SUCCESS;
2071
2072 open c2;
2073 fetch c2 into l_child_event_id, l_creation_date;
2074 close c2;
2075
2076 if l_child_event_id is null
2077 then
2078 OPEN c_get_child_event_id(l_creation_date);
2079 FETCH c_get_child_event_id INTO l_child_event_id;
2080 close c_get_child_event_id;
2081 end if;
2082
2083 if l_child_event_id is not null
2084 then
2085 HZ_EXTRACT_PERSON_BO_PVT.set_person_bo_action_type(p_event_id => l_child_event_id,
2086 p_root_id => p_root_id,
2087 px_person_obj =>PX_PERSON_CUST_V2_OBJ.PERSON_OBJ,
2088 x_return_status => x_return_status);
2089 l_child_upd_flag := 'Y';
2090
2091 end if;
2092
2093
2094 open c1;
2095 loop
2096 fetch c1 into L_NODE_PATH, L_CHILD_OPERATION_FLAG,L_CHILD_BO_CODE,
2097 L_CHILD_ENTITY_NAME, L_CHILD_ID, l_populated_flag;
2098 exit when c1%NOTFOUND;
2099 if l_populated_flag = 'N'
2100 then
2101 if L_CHILD_OPERATION_FLAG = 'I'
2102 then l_action_type := 'CREATED';
2103 elsif L_CHILD_OPERATION_FLAG = 'U'
2104 then l_action_type := 'UPDATED';
2105 end if;
2106
2107 -- check account objects
2108 if instr(l_node_path, 'PERSON_CUST/CUST_ACCT') > 0
2109 then
2110 for i in 1..PX_PERSON_CUST_V2_OBJ.ACCOUNT_OBJS.COUNT
2111 loop
2112 set_v2_per_acct_bo_action_type(p_node_path => l_node_path,
2113 p_child_id => l_child_id,
2114 p_action_type => l_action_type,
2115 p_child_entity_name => l_child_entity_name,
2116 px_cust_acct_v2_obj => PX_PERSON_CUST_V2_OBJ.ACCOUNT_OBJS(i) );
2117 l_child_upd_flag := 'Y';
2118 end loop;
2119 end if;
2120 end if; -- populated_flag = 'N'
2121 end loop;
2122 close c1;
2123
2124 if PX_PERSON_CUST_V2_OBJ.action_type = 'UNCHANGED'
2125 and l_child_upd_flag = 'Y'
2126 then PX_PERSON_CUST_V2_OBJ.action_type := 'CHILD_UPDATED';
2127 end if;
2128
2129 EXCEPTION
2130
2131
2132 WHEN fnd_api.g_exc_unexpected_error THEN
2133 x_return_status := fnd_api.g_ret_sts_unexp_error;
2134
2135
2136 WHEN OTHERS THEN
2137 x_return_status := fnd_api.g_ret_sts_unexp_error;
2138
2139 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
2140 fnd_message.set_token('ERROR' ,SQLERRM);
2141 fnd_msg_pub.add;
2142
2143 end set_person_cust_bo_action_type;
2144
2145 --------------------------------------
2146 --
2147 -- PROCEDURE get_v2_person_cust_updated
2148 --
2149 -- DESCRIPTION
2150 --The caller provides an identifier for the Person customer update business event and person id
2151 --the procedure returns one database object of the type HZ_PERSON_CUST_V2_BO
2152 --
2153 -- EXTERNAL PROCEDURES/FUNCTIONS ACCESSED
2154 --
2155 -- ARGUMENTS
2156 -- IN:
2157 -- p_init_msg_list Initialize message stack if it is set to
2158 -- p_event_id BES Event identifier.
2159 -- p_person_cust_id Person customer identifier.
2160 -- FND_API.G_TRUE. Default is FND_API.G_FALSE.
2161 -- OUT:
2162 -- x_person_cust_v2_obj One updated logical person.
2163 -- x_return_status Return status after the call. The status can
2164 -- be fnd_api.g_ret_sts_success (success),
2165 -- fnd_api.g_ret_sts_error (error),
2166 -- FND_API.G_RET_STS_UNEXP_ERROR (unexpected error).
2167 -- x_msg_count Number of messages in message stack.
2168 -- x_msg_data Message text if x_msg_count is 1.
2169 --
2170 -- NOTES
2171 --
2172 -- MODIFICATION HISTORY
2173 --
2174 -- 04-FEB-2008 vsegu Created.
2175 --
2176
2177 PROCEDURE get_v2_person_cust_updated(
2178 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
2179 p_event_id IN NUMBER,
2180 p_person_cust_id IN NUMBER,
2181 x_person_cust_v2_obj OUT NOCOPY HZ_PERSON_CUST_V2_BO,
2182 x_return_status OUT NOCOPY VARCHAR2,
2183 x_msg_count OUT NOCOPY NUMBER,
2184 x_msg_data OUT NOCOPY VARCHAR2
2185 ) is
2186
2187 l_obj_root_ids HZ_EXTRACT_BO_UTIL_PVT.BO_ID_TBL;
2188 l_debug_prefix VARCHAR2(30) := '';
2189 l_person_cust_obj HZ_PERSON_CUST_V2_BO;
2190 begin
2191
2192 -- initialize API return status to success.
2193 x_return_status := FND_API.G_RET_STS_SUCCESS;
2194
2195 -- Initialize message list if p_init_msg_list is set to TRUE
2196 IF FND_API.to_Boolean(p_init_msg_list) THEN
2197 FND_MSG_PUB.initialize;
2198 END IF;
2199
2200
2201 -- Debug info.
2202 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2203 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_updated(+)',
2204 p_prefix=>l_debug_prefix,
2205 p_msg_level=>fnd_log.level_procedure);
2206 END IF;
2207 /* moved to public api
2208 HZ_EXTRACT_BO_UTIL_PVT.validate_event_id(p_event_id => p_event_id,
2209 p_party_id => p_person_cust_id,
2210 x_return_status => x_return_status);
2211
2212 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2213 RAISE FND_API.G_EXC_ERROR;
2214 END IF;
2215 */
2216 -- Set action type to 'UNCHANGED' by default
2217
2218 get_person_cust_v2_bo(
2219 p_init_msg_list => fnd_api.g_false,
2220 p_person_id => p_person_cust_id,
2221 p_action_type => 'UNCHANGED',
2222 x_person_cust_v2_obj => x_person_cust_v2_obj,
2223 x_return_status => x_return_status,
2224 x_msg_count => x_msg_count,
2225 x_msg_data => x_msg_data);
2226
2227 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2228 RAISE FND_API.G_EXC_ERROR;
2229 END IF;
2230
2231
2232 -- Based on BOT, for updated branch, set action_type = 'UPDATED'/'CREATED'
2233
2234 l_person_cust_obj := x_person_cust_v2_obj;
2235 set_person_cust_bo_action_type(p_event_id => p_event_id,
2236 p_root_id => p_person_cust_id,
2237 px_person_cust_v2_obj => l_person_cust_obj,
2238 x_return_status => x_return_status
2239 );
2240 x_person_cust_v2_obj := l_person_cust_obj;
2241
2242 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2243 RAISE FND_API.G_EXC_ERROR;
2244 END IF;
2245
2246
2247
2248 -- Debug info.
2249 IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
2250 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2251 p_msg_data=>x_msg_data,
2252 p_msg_type=>'WARNING',
2253 p_msg_level=>fnd_log.level_exception);
2254 END IF;
2255
2256 -- Debug info.
2257 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2258 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_updated (-)',
2259 p_prefix=>l_debug_prefix,
2260 p_msg_level=>fnd_log.level_procedure);
2261 END IF;
2262
2263
2264 EXCEPTION
2265
2266 WHEN fnd_api.g_exc_error THEN
2267 x_return_status := fnd_api.g_ret_sts_error;
2268
2269 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
2270 p_count => x_msg_count,
2271 p_data => x_msg_data);
2272
2273 -- Debug info.
2274 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2275 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2276 p_msg_data=>x_msg_data,
2277 p_msg_type=>'ERROR',
2278 p_msg_level=>fnd_log.level_error);
2279 END IF;
2280 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2281 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_updated(-)',
2282 p_prefix=>l_debug_prefix,
2283 p_msg_level=>fnd_log.level_procedure);
2284 END IF;
2285 WHEN fnd_api.g_exc_unexpected_error THEN
2286 x_return_status := fnd_api.g_ret_sts_unexp_error;
2287
2288 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
2289 p_count => x_msg_count,
2290 p_data => x_msg_data);
2291
2292 -- Debug info.
2293 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2294 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2295 p_msg_data=>x_msg_data,
2296 p_msg_type=>'UNEXPECTED ERROR',
2297 p_msg_level=>fnd_log.level_error);
2298 END IF;
2299 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2300 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_updated(-)',
2301 p_prefix=>l_debug_prefix,
2302 p_msg_level=>fnd_log.level_procedure);
2303 END IF;
2304 WHEN OTHERS THEN
2305 x_return_status := fnd_api.g_ret_sts_unexp_error;
2306
2307 fnd_message.set_name('AR', 'HZ_API_OTHERS_EXCEP');
2308 fnd_message.set_token('ERROR' ,SQLERRM);
2309 fnd_msg_pub.add;
2310
2311 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
2312 p_count => x_msg_count,
2313 p_data => x_msg_data);
2314
2315 -- Debug info.
2316 IF fnd_log.level_error>=fnd_log.g_current_runtime_level THEN
2317 hz_utility_v2pub.debug_return_messages(p_msg_count=>x_msg_count,
2318 p_msg_data=>x_msg_data,
2319 p_msg_type=>'SQL ERROR',
2320 p_msg_level=>fnd_log.level_error);
2321 END IF;
2322 IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
2323 hz_utility_v2pub.debug(p_message=>'get_v2_person_cust_updated(-)',
2324 p_prefix=>l_debug_prefix,
2325 p_msg_level=>fnd_log.level_procedure);
2326 END IF;
2327
2328 end;
2329
2330 END HZ_EXTRACT_PERSON_CUST_BO_PVT;