[Home] [Help]
PACKAGE BODY: APPS.HZ_ACCT_CREATE_PKG
Source
1 PACKAGE BODY hz_acct_create_pkg as
2 /* $Header: ARHACTFB.pls 120.4 2005/06/16 21:08:12 jhuang ship $ */
3
4 FUNCTION INIT_SWITCH
5 ( p_date IN DATE,
6 p_switch IN VARCHAR2 DEFAULT 'NULL_GMISS')
7 RETURN DATE
8 IS
9 res_date date;
10 BEGIN
11 IF p_switch = 'NULL_GMISS' THEN
12 IF p_date IS NULL THEN
13 res_date := FND_API.G_MISS_DATE;
14 ELSE
15 res_date := p_date;
16 END IF;
17 ELSIF p_switch = 'GMISS_NULL' THEN
18 IF p_date = FND_API.G_MISS_DATE THEN
19 res_date := NULL;
20 ELSE
21 res_date := p_date;
22 END IF;
23 ELSE
24 res_date := TO_DATE('31/12/1800','DD/MM/RRRR');
25 END IF;
26 RETURN res_date;
27 END;
28
29 FUNCTION INIT_SWITCH
30 ( p_char IN VARCHAR2,
31 p_switch IN VARCHAR2 DEFAULT 'NULL_GMISS')
32 RETURN VARCHAR2
33 IS
34 res_char varchar2(2000);
35 BEGIN
36 IF p_switch = 'NULL_GMISS' THEN
37 IF p_char IS NULL THEN
38 return FND_API.G_MISS_CHAR;
39 ELSE
40 return p_char;
41 END IF;
42 ELSIF p_switch = 'GMISS_NULL' THEN
43 IF p_char = FND_API.G_MISS_CHAR THEN
44 return NULL;
45 ELSE
46 return p_char;
47 END IF;
48 ELSE
49 return ('INCORRECT_P_SWITCH');
50 END IF;
51 END;
52
53 FUNCTION INIT_SWITCH
54 ( p_num IN NUMBER,
55 p_switch IN VARCHAR2 DEFAULT 'NULL_GMISS')
56 RETURN NUMBER
57 IS
58 BEGIN
59 IF p_switch = 'NULL_GMISS' THEN
60 IF p_num IS NULL THEN
61 return FND_API.G_MISS_NUM;
62 ELSE
63 return p_num;
64 END IF;
65 ELSIF p_switch = 'GMISS_NULL' THEN
66 IF p_num = FND_API.G_MISS_NUM THEN
67 return NULL;
68 ELSE
69 return p_num;
70 END IF;
71 ELSE
72 return ('9999999999');
73 END IF;
74 END;
75
76 PROCEDURE object_version_select
77 (p_table_name IN VARCHAR2,
78 p_col_id IN VARCHAR2,
79 x_rowid IN OUT NOCOPY ROWID,
80 x_object_version_number IN OUT NOCOPY NUMBER,
81 x_last_update_date IN OUT NOCOPY DATE,
82 x_id_value IN OUT NOCOPY NUMBER,
83 x_return_status IN OUT NOCOPY VARCHAR2,
84 x_msg_count IN OUT NOCOPY NUMBER,
85 x_msg_data IN OUT NOCOPY VARCHAR2 )
86 IS
87 CURSOR cu_cust_acct_version IS
88 SELECT ROWID,
89 OBJECT_VERSION_NUMBER,
90 LAST_UPDATE_DATE,
91 NULL
92 FROM HZ_CUST_ACCOUNTS
93 WHERE CUST_ACCOUNT_ID = p_col_id;
94
95 CURSOR cu_cust_prof_version IS
96 SELECT ROWID,
97 OBJECT_VERSION_NUMBER,
98 LAST_UPDATE_DATE,
99 CUST_ACCOUNT_ID
100 FROM HZ_CUSTOMER_PROFILES
101 WHERE CUST_ACCOUNT_PROFILE_ID = p_col_id;
102
103 CURSOR cu_org IS
104 SELECT ROWID,
105 OBJECT_VERSION_NUMBER,
106 LAST_UPDATE_DATE,
107 NULL
108 FROM HZ_PARTIES
109 WHERE PARTY_ID = p_col_id;
110
111 l_last_update_date DATE;
112 BEGIN
113 IF p_table_name = 'HZ_CUST_ACCOUNTS' THEN
114 OPEN cu_cust_acct_version;
115 FETCH cu_cust_acct_version INTO
116 x_rowid ,
117 x_object_version_number,
118 l_last_update_date ,
119 x_id_value;
120 CLOSE cu_cust_acct_version;
121 ELSIF p_table_name = 'HZ_CUSTOMER_PROFILES' THEN
122 OPEN cu_cust_prof_version;
123 FETCH cu_cust_prof_version INTO
124 x_rowid ,
125 x_object_version_number,
126 l_last_update_date ,
127 x_id_value;
128 CLOSE cu_cust_prof_version;
129 ELSIF p_table_name = 'HZ_ORG_PERS' THEN
130 OPEN cu_org;
131 FETCH cu_org INTO
132 x_rowid ,
133 x_object_version_number,
134 l_last_update_date ,
135 x_id_value;
136 CLOSE cu_org;
137 END IF;
138 IF x_rowid IS NULL THEN
139 FND_MESSAGE.SET_NAME('AR','HZ_API_NO_RECORD');
140 FND_MESSAGE.SET_TOKEN('RECORD',p_table_name);
141 FND_MESSAGE.SET_TOKEN('ID',p_col_id);
142 FND_MSG_PUB.ADD;
143 x_return_status := FND_API.G_RET_STS_ERROR;
144 ELSE
145 IF TO_CHAR(x_last_update_date,'DD-MON-YYYY HH:MI:SS') <>
146 TO_CHAR(l_last_update_date,'DD-MON-YYYY HH:MI:SS')
147 THEN
148 FND_MESSAGE.SET_NAME('AR', 'HZ_API_RECORD_CHANGED');
149 FND_MESSAGE.SET_TOKEN('TABLE', p_table_name);
150 FND_MSG_PUB.ADD;
151 x_return_status := FND_API.G_RET_STS_ERROR;
152 END IF;
153 END IF;
154 END;
155
156 PROCEDURE update_flag
157 ( p_party_id IN NUMBER,
158 p_flag_name IN VARCHAR2,
159 p_flag_value IN VARCHAR2,
160 x_return_status IN OUT NOCOPY VARCHAR2,
161 x_msg_data IN OUT NOCOPY VARCHAR2)
162 IS
163 CURSOR cu_party_update
164 IS
165 SELECT party_id
166 FROM hz_parties
167 WHERE party_id = p_party_id
168 FOR UPDATE OF party_id NOWAIT;
169 l_lock NUMBER;
170 BEGIN
171 OPEN cu_party_update;
172 FETCH cu_party_update INTO l_lock;
173 IF cu_party_update%FOUND THEN
174 IF p_flag_name = 'REFERENCE_FOR' THEN
175 UPDATE hz_parties
176 SET REFERENCE_USE_FLAG = p_flag_value
177 WHERE party_id = p_party_id;
178 ELSIF p_flag_name = 'PARTNER_OF' THEN
179 UPDATE hz_parties
180 SET THIRD_PARTY_FLAG = p_flag_value
181 WHERE party_id = p_party_id;
182 ELSIF p_flag_name = 'COMPETITOR_OF' THEN
183 UPDATE hz_parties
184 SET COMPETITOR_FLAG = p_flag_value
185 WHERE party_id = p_party_id;
186 END IF;
187 ELSE
188 FND_MESSAGE.SET_NAME('AR','HZ_API_NO_RECORD');
189 FND_MESSAGE.SET_TOKEN('RECORD','HZ_PARTIES');
190 FND_MESSAGE.SET_TOKEN('ID',p_party_id);
191 FND_MSG_PUB.ADD;
192 x_return_status := FND_API.G_RET_STS_ERROR;
193 END IF;
194 CLOSE cu_party_update;
195 EXCEPTION
196 WHEN OTHERS THEN
197 IF cu_party_update%ISOPEN THEN
198 CLOSE cu_party_update;
199 END IF;
200 FND_MESSAGE.SET_NAME( 'AR', 'HZ_API_OTHERS_EXCEP' );
201 FND_MESSAGE.SET_TOKEN( 'ERROR' ,SQLERRM );
202 FND_MSG_PUB.ADD;
203 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
204 END;
205
206 PROCEDURE SetFlagRelationship
207 (p_rel_code IN VARCHAR2,
208 c_flag IN VARCHAR2,
209 c_party_id IN VARCHAR2,
210 c_party_type IN VARCHAR2,
211 i_internal_party_id IN NUMBER,
212 i_internal_party_type IN VARCHAR2,
213 x_return_status IN OUT NOCOPY VARCHAR2,
214 x_msg_count IN OUT NOCOPY NUMBER,
215 x_msg_data IN OUT NOCOPY VARCHAR2,
216 x_end_date IN DATE DEFAULT SYSDATE)
217 IS
218 cursor C_REFERENCE_FOR is
219 select relationship_id ,
220 end_date
221 from hz_relationships
222 where subject_id = c_party_id
223 and relationship_code = 'REFERENCE_FOR'
224 and subject_table_name = 'HZ_PARTIES'
225 and object_table_name = 'HZ_PARTIES'
226 and directional_flag = 'F';
227
228 cursor C_PARTNER_OF is
229 select relationship_id ,
230 end_date
231 from hz_relationships
232 where subject_id = c_party_id
233 and relationship_code = 'PARTNER_OF'
234 and subject_table_name = 'HZ_PARTIES'
235 and object_table_name = 'HZ_PARTIES'
236 and directional_flag = 'F';
237
238 cursor C_COMPETITOR_OF is
239 select relationship_id,
240 end_date
241 from hz_relationships
242 where subject_id = c_party_id
243 and relationship_code = 'COMPETITOR_OF'
244 and subject_table_name = 'HZ_PARTIES'
245 and object_table_name = 'HZ_PARTIES'
246 and directional_flag = 'F';
247
248 l_party_rel_object_version NUMBER;
249 l_party_object_version NUMBER;
250 x_party_rel_last_update_date DATE;
251 x_party_last_update_date DATE;
252 prel_rec hz_relationship_v2pub.relationship_rec_type;
253 i_pr_party_relationship_id NUMBER;
254 i_pr_party_id NUMBER;
255 i_pr_party_number VARCHAR2(100);
256 x_party_rel_id NUMBER;
257 l_end_date DATE;
258
259 CURSOR cu_rel_type IS
260 SELECT relationship_type,
261 create_party_flag
262 FROM hz_relationship_types
263 WHERE forward_rel_code = p_rel_code
264 AND subject_type = c_party_type
265 AND object_type = i_internal_party_type
266 AND status = 'A'
267 AND rownum = 1;
268
269 l_rel_type VARCHAR2(30);
270 l_create_party VARCHAR2(1);
271
272 BEGIN
273
274 IF p_rel_code = 'REFERENCE_FOR' THEN
275 OPEN C_REFERENCE_FOR;
276 FETCH C_REFERENCE_FOR INTO x_party_rel_id, l_end_date;
277 CLOSE C_REFERENCE_FOR;
278 ELSIF p_rel_code = 'PARTNER_OF' THEN
279 OPEN C_PARTNER_OF;
280 FETCH C_PARTNER_OF INTO x_party_rel_id, l_end_date;
281 CLOSE C_PARTNER_OF;
282 ELSIF p_rel_code = 'COMPETITOR_OF' THEN
283 OPEN C_COMPETITOR_OF;
284 FETCH C_COMPETITOR_OF INTO x_party_rel_id, l_end_date;
285 CLOSE C_COMPETITOR_OF;
286 END IF;
287
288 IF x_party_rel_id IS NULL AND C_Flag = 'Y' THEN
289
290 OPEN cu_rel_type;
291 FETCH cu_rel_type INTO l_rel_type, l_create_party;
292 CLOSE cu_rel_type;
293
294 prel_rec.subject_id := c_party_id;
295 prel_rec.subject_table_name:= 'HZ_PARTIES';
296 prel_rec.subject_type := c_party_type;
297 prel_rec.object_id := i_internal_party_id;
298 prel_rec.object_table_name := 'HZ_PARTIES';
299 prel_rec.object_type := i_internal_party_type;
300 prel_rec.start_date := SYSDATE;
301 prel_rec.end_date := NULL;
302 prel_rec.relationship_type := l_rel_type;
303 prel_rec.relationship_code := p_rel_code;
304 prel_rec.status := 'A';
305 prel_rec.created_by_module := 'TCA_FORM_WRAPPER';
306
307 -- call V2 API.
308 HZ_RELATIONSHIP_V2PUB.create_relationship (
309 p_relationship_rec => prel_rec,
310 x_relationship_id => i_pr_party_relationship_id,
311 x_party_id => i_pr_party_id,
312 x_party_number => i_pr_party_number,
313 x_return_status => x_return_status,
314 x_msg_count => x_msg_count,
315 x_msg_data => x_msg_data );
316
317 ELSIF x_party_rel_id IS NOT NULL AND C_Flag = 'Y' THEN
318
319 IF TRUNC(l_end_date) <= TRUNC(SYSDATE) THEN
320
321 SELECT last_update_date ,
322 object_version_number
323 INTO x_party_rel_last_update_date ,
324 l_party_rel_object_version
325 FROM hz_relationships
326 WHERE relationship_id = x_party_rel_id
327 AND subject_table_name = 'HZ_PARTIES'
328 AND object_table_name = 'HZ_PARTIES'
329 AND directional_flag = 'F';
330
331 SELECT last_update_date,
332 object_version_number
333 INTO x_party_last_update_date,
334 l_party_object_version
335 FROM hz_parties
336 WHERE party_id = c_party_id;
337
338 prel_rec.relationship_id := x_party_rel_id;
339 prel_rec.subject_id := c_party_id;
340 prel_rec.subject_table_name:= 'HZ_PARTIES';
341 prel_rec.subject_type := c_party_type;
342 prel_rec.object_id := i_internal_party_id;
343 prel_rec.object_table_name := 'HZ_PARTIES';
344 prel_rec.object_type := i_internal_party_type;
345 prel_rec.end_date := TO_DATE('31124712','DDMMYYYY');
346 prel_rec.relationship_type := l_rel_type;
347 prel_rec.relationship_code := p_rel_code;
348 prel_rec.status := 'A';
349 -- prel_rec.created_by_module := 'TCA_FORM_WRAPPER';
350
351 x_party_last_update_date := NULL;
352
353 HZ_RELATIONSHIP_V2PUB.update_relationship (
354 p_relationship_rec => prel_rec,
355 p_object_version_number => l_party_rel_object_version,
356 p_party_object_version_number => l_party_object_version,
357 x_return_status => x_return_status,
358 x_msg_count => x_msg_count,
359 x_msg_data => x_msg_data );
360
361 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
362 update_flag(
363 p_party_id => c_party_id,
364 p_flag_name => p_rel_code,
365 p_flag_value => C_flag,
366 x_return_status => x_return_status,
367 x_msg_data => x_msg_data);
368 END IF;
369
370 END IF;
371
372 ELSIF x_party_rel_id IS NOT NULL AND C_Flag = 'N' THEN
373
374 IF TRUNC(l_end_date) > TRUNC(SYSDATE) THEN
375
376 SELECT last_update_date ,
377 object_version_number
378 INTO x_party_rel_last_update_date ,
379 l_party_rel_object_version
380 FROM hz_relationships
381 WHERE relationship_id = x_party_rel_id
382 AND subject_table_name = 'HZ_PARTIES'
383 AND object_table_name = 'HZ_PARTIES'
384 AND directional_flag = 'F';
385
386 SELECT last_update_date,
387 object_version_number
388 INTO x_party_last_update_date,
389 l_party_object_version
390 FROM hz_parties
391 WHERE party_id = c_party_id;
392
393 prel_rec.relationship_id := x_party_rel_id;
394 prel_rec.subject_id := c_party_id;
395 prel_rec.subject_table_name:= 'HZ_PARTIES';
396 prel_rec.subject_type := c_party_type;
397 prel_rec.object_id := i_internal_party_id;
398 prel_rec.object_table_name := 'HZ_PARTIES';
399 prel_rec.object_type := i_internal_party_type;
400 prel_rec.end_date := SYSDATE;
401 prel_rec.relationship_type := l_rel_type;
402 prel_rec.relationship_code := p_rel_code;
403 prel_rec.status := 'A';
404 -- prel_rec.created_by_module := 'TCA_FORM_WRAPPER';
405
406
407 x_party_last_update_date := NULL;
408
409 HZ_RELATIONSHIP_V2PUB.update_relationship (
410 p_relationship_rec => prel_rec,
411 p_object_version_number => l_party_rel_object_version,
412 p_party_object_version_number => l_party_object_version,
413 x_return_status => x_return_status,
414 x_msg_count => x_msg_count,
415 x_msg_data => x_msg_data );
416
417 -- Need to be commented on once HZ_RELATIONSHIP_V2PUB.update_relationship is fixed.
418 IF x_return_status = FND_API.G_RET_STS_SUCCESS THEN
419 update_flag(
420 p_party_id => c_party_id,
421 p_flag_name => p_rel_code,
422 p_flag_value => C_flag,
423 x_return_status => x_return_status,
424 x_msg_data => x_msg_data);
425 END IF;
426
427 END IF;
428
429 END IF;
430 END SetFlagRelationship;
431
432
433 PROCEDURE Ref_Part_Comp
434 (c_party_id IN VARCHAR2,
435 c_party_type IN VARCHAR2,
436 i_internal_party_id IN NUMBER,
437 C_Reference_Use_Flag IN VARCHAR2,
438 C_Third_Party_Flag IN VARCHAR2,
439 C_competitor_flag IN VARCHAr2,
440 x_return_status IN OUT NOCOPY VARCHAR2,
441 x_msg_count IN OUT NOCOPY NUMBER,
442 x_msg_data IN OUT NOCOPY VARCHAR2,
443 x_end_date IN DATE DEFAULT SYSDATE)
444 IS
445
446 CURSOR cu_internal_type IS
447 SELECT party_type
448 FROM hz_parties
449 WHERE party_id = i_internal_party_id;
450 l_internal_party_type VARCHAR2(30);
451
452 BEGIN
453 IF C_Reference_Use_Flag IS NOT NULL
454 OR C_Third_Party_Flag IS NOT NULL
455 OR c_competitor_flag IS NOT NULL
456 THEN
457 OPEN cu_internal_type;
458 FETCH cu_internal_type INTO l_internal_party_type;
459 CLOSE cu_internal_type;
460
461 IF C_Reference_Use_Flag IS NOT NULL then
462 SetFlagRelationship
463 ( p_rel_code => 'REFERENCE_FOR',
464 c_flag => C_Reference_Use_Flag,
465 c_party_id => c_party_id,
466 c_party_type => c_party_type,
467 i_internal_party_id => i_internal_party_id,
468 i_internal_party_type => l_internal_party_type,
469 x_return_status => x_return_status,
470 x_msg_count => x_msg_count,
471 x_msg_data => x_msg_data ,
472 x_end_date => x_end_date);
473
474 END IF;
475
476 IF C_Third_Party_Flag IS NOT NULL THEN
477 SetFlagRelationship
478 ( p_rel_code => 'PARTNER_OF',
479 c_flag => C_Third_Party_Flag ,
480 c_party_id => c_party_id,
481 c_party_type => c_party_type,
482 i_internal_party_id => i_internal_party_id,
483 i_internal_party_type => l_internal_party_type,
484 x_return_status => x_return_status,
485 x_msg_count => x_msg_count,
486 x_msg_data => x_msg_data ,
487 x_end_date => x_end_date);
488 END IF;
489
490 IF c_competitor_flag IS NOT NULL THEN
491 SetFlagRelationship
492 ( p_rel_code => 'COMPETITOR_OF',
493 c_flag => c_competitor_flag,
494 c_party_id => c_party_id,
495 c_party_type => c_party_type,
496 i_internal_party_id => i_internal_party_id,
497 i_internal_party_type => l_internal_party_type,
498 x_return_status => x_return_status,
499 x_msg_count => x_msg_count,
500 x_msg_data => x_msg_data ,
501 x_end_date => x_end_date);
502 END IF;
503 END IF;
504 END Ref_Part_Comp;
505
506 PROCEDURE insert_row(
507 c_cust_account_id IN OUT NOCOPY NUMBER ,
508 c_party_id IN OUT NOCOPY NUMBER,
509 c_account_number IN OUT NOCOPY VARCHAR2,
510 c_Attribute_Category IN VARCHAR2,
511 c_Attribute1 IN VARCHAR2,
512 c_Attribute2 IN VARCHAR2,
513 c_Attribute3 IN VARCHAR2,
514 c_Attribute4 IN VARCHAR2,
515 c_Attribute5 IN VARCHAR2,
516 c_Attribute6 IN VARCHAR2,
517 c_Attribute7 IN VARCHAR2,
518 c_Attribute8 IN VARCHAR2,
519 c_Attribute9 IN VARCHAR2,
520 c_Attribute10 IN VARCHAR2,
521 c_Attribute11 IN VARCHAR2,
522 c_Attribute12 IN VARCHAR2,
523 c_Attribute13 IN VARCHAR2,
524 c_Attribute14 IN VARCHAR2,
525 c_Attribute15 IN VARCHAR2,
526 c_Attribute16 IN VARCHAR2,
527 c_Attribute17 IN VARCHAR2,
528 c_Attribute18 IN VARCHAR2,
529 c_Attribute19 IN VARCHAR2,
530 c_Attribute20 IN VARCHAR2,
531 c_global_attribute_category IN VARCHAR2,
532 c_global_attribute1 IN VARCHAR2,
533 c_global_attribute2 IN VARCHAR2,
534 c_global_attribute3 IN VARCHAR2,
535 c_global_attribute4 IN VARCHAR2,
536 c_global_attribute5 IN VARCHAR2,
537 c_global_attribute6 IN VARCHAR2,
538 c_global_attribute7 IN VARCHAR2,
539 c_global_attribute8 IN VARCHAR2,
540 c_global_attribute9 IN VARCHAR2,
541 c_global_attribute10 IN VARCHAR2,
542 c_global_attribute11 IN VARCHAR2,
543 c_global_attribute12 IN VARCHAR2,
544 c_global_attribute13 IN VARCHAR2,
545 c_global_attribute14 IN VARCHAR2,
546 c_global_attribute15 IN VARCHAR2,
547 c_global_attribute16 IN VARCHAR2,
548 c_global_attribute17 IN VARCHAR2,
549 c_global_attribute18 IN VARCHAR2,
550 c_global_attribute19 IN VARCHAR2,
551 c_global_attribute20 IN VARCHAR2,
552 c_orig_system_reference IN VARCHAR2,
553 c_status IN VARCHAR2,
554 c_customer_type IN VARCHAR2,
555 c_customer_class_code IN VARCHAR2,
556 c_primary_salesrep_id IN NUMBER ,
557 c_sales_channel_code IN VARCHAR2,
558 c_order_type_id IN NUMBER,
559 c_price_list_id IN NUMBER ,
560 c_category_code IN VARCHAR2,
561 c_reference_use_flag IN VARCHAR2,
562 c_tax_code IN VARCHAR2,
563 c_third_party_flag IN VARCHAR2,
564 c_competitor_flag IN VARCHAR2,
565 c_fob_point IN VARCHAR2,
566 c_tax_header_level_flag IN VARCHAR2,
567 c_tax_rounding_rule IN VARCHAR2,
568 c_account_name IN VARCHAR2,
569 c_freight_term IN VARCHAR2,
570 c_ship_partial IN VARCHAR2,
571 c_ship_via IN VARCHAR2,
572 c_warehouse_id IN NUMBER,
573 c_payment_term_id IN NUMBER ,
574 c_DATES_NEGATIVE_TOLERANCE IN NUMBER,
575 c_DATES_POSITIVE_TOLERANCE IN NUMBER,
576 c_DATE_TYPE_PREFERENCE IN VARCHAR2,
577 c_OVER_SHIPMENT_TOLERANCE IN NUMBER,
578 c_UNDER_SHIPMENT_TOLERANCE IN NUMBER,
579 c_ITEM_CROSS_REF_PREF IN VARCHAR2,
580 c_OVER_RETURN_TOLERANCE IN NUMBER,
581 c_UNDER_RETURN_TOLERANCE IN NUMBER,
582 c_SHIP_SETS_INCLUDE_LINES_FLAG IN VARCHAR2,
583 c_ARRIVALSETS_INCL_LINES_FLAG IN VARCHAR2,
584 c_SCHED_DATE_PUSH_FLAG IN VARCHAR2,
585 c_INVOICE_QUANTITY_RULE IN VARCHAR2,
586 t_party_id IN NUMBER ,
587 t_party_number IN OUT NOCOPY VARCHAR2,
588 t_customer_key IN VARCHAR2,
589 t_Attribute_Category IN VARCHAR2,
590 t_Attribute1 IN VARCHAR2,
591 t_Attribute2 IN VARCHAR2,
592 t_Attribute3 IN VARCHAR2,
593 t_Attribute4 IN VARCHAR2,
594 t_Attribute5 IN VARCHAR2,
595 t_Attribute6 IN VARCHAR2,
596 t_Attribute7 IN VARCHAR2,
597 t_Attribute8 IN VARCHAR2,
598 t_Attribute9 IN VARCHAR2,
599 t_Attribute10 IN VARCHAR2,
600 t_Attribute11 IN VARCHAR2,
601 t_Attribute12 IN VARCHAR2,
602 t_Attribute13 IN VARCHAR2,
603 t_Attribute14 IN VARCHAR2,
604 t_Attribute15 IN VARCHAR2,
605 t_Attribute16 IN VARCHAR2,
606 t_Attribute17 IN VARCHAR2,
607 t_Attribute18 IN VARCHAR2,
608 t_Attribute19 IN VARCHAR2,
609 t_Attribute20 IN VARCHAR2,
610 t_global_attribute_category IN VARCHAR2,
611 t_global_attribute1 IN VARCHAR2,
612 t_global_attribute2 IN VARCHAR2,
613 t_global_attribute3 IN VARCHAR2,
614 t_global_attribute4 IN VARCHAR2,
615 t_global_attribute5 IN VARCHAR2,
616 t_global_attribute6 IN VARCHAR2,
617 t_global_attribute7 IN VARCHAR2,
618 t_global_attribute8 IN VARCHAR2,
619 t_global_attribute9 IN VARCHAR2,
620 t_global_attribute10 IN VARCHAR2,
621 t_global_attribute11 IN VARCHAR2,
622 t_global_attribute12 IN VARCHAR2,
623 t_global_attribute13 IN VARCHAR2,
624 t_global_attribute14 IN VARCHAR2,
625 t_global_attribute15 IN VARCHAR2,
626 t_global_attribute16 IN VARCHAR2,
627 t_global_attribute17 IN VARCHAR2,
628 t_global_attribute18 IN VARCHAR2,
629 t_global_attribute19 IN VARCHAR2,
630 t_global_attribute20 IN VARCHAR2,
631 o_party_name IN VARCHAR2,
632 o_sic_code IN VARCHAR2,
633 o_sic_code_type IN VARCHAR2,
634 o_analysis_fy IN VARCHAR2,
635 o_fiscal_yearend_month IN VARCHAR2,
636 o_num_of_employees IN NUMBER ,
637 o_curr_fy_potential_revenue IN NUMBER ,
638 o_next_fy_potential_revenue IN NUMBER ,
639 o_tax_reference IN VARCHAR2,
640 o_year_established IN NUMBER ,
641 o_gsa_indicator_flag IN VARCHAR2,
642 o_mission_statement IN VARCHAR2,
643 o_duns_number IN NUMBER,
644 o_tax_name IN VARCHAR2,
645 o_organization_type IN VARCHAR2,
646 o_taxpayer_id IN VARCHAR2,
647 o_party_name_phonetic IN VARCHAR2,
648 p_cust_account_profile_id IN NUMBER ,
649 p_cust_account_id IN NUMBER ,
650 p_status IN VARCHAR2,
651 p_collector_id IN NUMBER ,
652 p_credit_analyst_id IN NUMBER ,
653 p_credit_checking IN VARCHAR2,
654 p_next_credit_review_date DATE ,
655 p_tolerance IN NUMBER,
656 p_discount_terms IN VARCHAR2,
657 p_dunning_letters IN VARCHAR2,
658 p_interest_charges IN VARCHAR2,
659 p_send_statements IN VARCHAR2,
660 p_credit_balance_statements IN VARCHAR2,
661 p_credit_hold IN VARCHAR2,
662 p_profile_class_id IN NUMBER ,
663 p_site_use_id IN NUMBER ,
664 p_credit_rating IN VARCHAR2,
665 p_risk_code IN VARCHAR2,
666 p_standard_terms IN NUMBER ,
667 p_override_terms IN VARCHAR2,
668 p_dunning_letter_set_id IN NUMBER,
669 p_interest_period_days IN NUMBER,
670 p_payment_grace_days IN NUMBER,
671 p_discount_grace_days IN NUMBER,
672 p_statement_cycle_id IN NUMBER ,
673 p_account_status IN VARCHAR2,
674 p_percent_collectable IN NUMBER ,
675 p_autocash_hierarchy_id IN NUMBER,
676 p_Attribute_Category IN VARCHAR2,
677 p_Attribute1 IN VARCHAR2,
678 p_Attribute2 IN VARCHAR2,
679 p_Attribute3 IN VARCHAR2,
680 p_Attribute4 IN VARCHAR2,
681 p_Attribute5 IN VARCHAR2,
682 p_Attribute6 IN VARCHAR2,
683 p_Attribute7 IN VARCHAR2,
684 p_Attribute8 IN VARCHAR2,
685 p_Attribute9 IN VARCHAR2,
686 p_Attribute10 IN VARCHAR2,
687 p_Attribute11 IN VARCHAR2,
688 p_Attribute12 IN VARCHAR2,
689 p_Attribute13 IN VARCHAR2,
690 p_Attribute14 IN VARCHAR2,
691 p_Attribute15 IN VARCHAR2,
692 p_auto_rec_incl_disputed_flag IN VARCHAR2,
693 p_tax_printing_option IN VARCHAR2,
694 p_charge_on_fin_charge_flag IN VARCHAR2,
695 p_grouping_rule_id IN NUMBER ,
696 p_clearing_days IN NUMBER,
697 p_jgzz_attribute_category IN VARCHAR2,
698 p_jgzz_attribute1 IN VARCHAR2,
699 p_jgzz_attribute2 IN VARCHAR2,
700 p_jgzz_attribute3 IN VARCHAR2,
701 p_jgzz_attribute4 IN VARCHAR2,
702 p_jgzz_attribute5 IN VARCHAR2,
703 p_jgzz_attribute6 IN VARCHAR2,
704 p_jgzz_attribute7 IN VARCHAR2,
705 p_jgzz_attribute8 IN VARCHAR2,
706 p_jgzz_attribute9 IN VARCHAR2,
707 p_jgzz_attribute10 IN VARCHAR2,
708 p_jgzz_attribute11 IN VARCHAR2,
709 p_jgzz_attribute12 IN VARCHAR2,
710 p_jgzz_attribute13 IN VARCHAR2,
711 p_jgzz_attribute14 IN VARCHAR2,
712 p_jgzz_attribute15 IN VARCHAR2,
713 p_global_attribute_category IN VARCHAR2,
714 p_global_attribute1 IN VARCHAR2,
715 p_global_attribute2 IN VARCHAR2,
716 p_global_attribute3 IN VARCHAR2,
717 p_global_attribute4 IN VARCHAR2,
718 p_global_attribute5 IN VARCHAR2,
719 p_global_attribute6 IN VARCHAR2,
720 p_global_attribute7 IN VARCHAR2,
721 p_global_attribute8 IN VARCHAR2,
722 p_global_attribute9 IN VARCHAR2,
723 p_global_attribute10 IN VARCHAR2,
724 p_global_attribute11 IN VARCHAR2,
725 p_global_attribute12 IN VARCHAR2,
726 p_global_attribute13 IN VARCHAR2,
727 p_global_attribute14 IN VARCHAR2,
728 p_global_attribute15 IN VARCHAR2,
729 p_global_attribute16 IN VARCHAR2,
730 p_global_attribute17 IN VARCHAR2,
731 p_global_attribute18 IN VARCHAR2,
732 p_global_attribute19 IN VARCHAR2,
733 p_global_attribute20 IN VARCHAR2,
734 p_cons_inv_flag IN VARCHAR2,
735 p_cons_inv_type IN VARCHAR2,
736 p_autocash_hier_id_for_adr IN NUMBER ,
737 p_lockbox_matching_option IN VARCHAR2,
738 --{2310474
739 p_party_id IN NUMBER DEFAULT NULL,
740 p_review_cycle IN VARCHAR2 DEFAULT NULL,
741 p_credit_classification IN VARCHAR2 DEFAULT NULL,
742 p_last_credit_review_date IN DATE DEFAULT NULL,
743 --}
744 o_organization_profile_id IN OUT NOCOPY NUMBER,
745 x_msg_count OUT NOCOPY NUMBER,
746 x_msg_data OUT NOCOPY varchar2,
747 x_return_status OUT NOCOPY VARCHAR2,
748 o_duns_number_c IN VARCHAR2 DEFAULT FND_API.G_MISS_CHAR )
749
750 IS
751
752 -- acct_rec hz_customer_accounts_pub.account_rec_type;
753 -- party_rec hz_party_pub.party_rec_type;
754 -- org_rec hz_party_pub.organization_rec_type;
755 -- prel_rec hz_party_pub.party_rel_rec_type;
756 -- prof_rec hz_customer_accounts_pub.cust_profile_rec_type;
757
758 acct_rec hz_cust_account_v2pub.cust_account_rec_type;
759 party_rec hz_party_v2pub.party_rec_type;
760 org_rec hz_party_v2pub.organization_rec_type;
761 prel_rec hz_relationship_v2pub.relationship_rec_type;
762 prof_rec hz_customer_profile_v2pub.customer_profile_rec_type;
763
764 /*Bug 3013045*/
765 org_rec_update hz_party_v2pub.organization_rec_type;
766 l_flag BOOLEAN;
767 l_party_rowid ROWID;
768 l_party_last_update_date DATE;
769 l_dummy_id NUMBER;
770 /*End bug 3013045*/
771 tmp_var VARCHAR2(2000);
772 i NUMBER;
773 tmp_var1 VARCHAR2(2000);
774 x_customer_id NUMBER;
775 x_cust_account_number VARCHAR2(100);
776 x_party_id NUMBER;
777 x_party_number VARCHAR2(100);
778 i_internal_party_id NUMBER;
779 i_pr_party_relationship_id NUMBER;
780 i_pr_party_id NUMBER;
781 i_pr_party_number VARCHAR2(100);
782 -- create_internal_party VARCHAR2(1) := 'Y';
783 x_code_assignment_id NUMBER;
784 x_party_rel_id NUMBER;
785 l_party_rel_object_version NUMBER;
786 l_party_object_version NUMBER;
787
788 x_party_last_update_date date;
789 X_PARTY_REL_LAST_UPDATE_DATE date;
790
791 BEGIN
792
793 x_return_status := FND_API.G_RET_STS_SUCCESS;
794
795 /*Bug 3013045*/
796 IF c_party_id is not null
797 THEN
798 l_flag := TRUE;
799 END IF;
800
801 ---------------------------------
802 -- For Organization --
803 ---------------------------------
804 -- V2 REC TYPE Customer Account--
805 ---------------------------------
806 acct_rec.cust_account_id := C_Cust_account_Id;
807 -- acct_rec.party_id := C_Party_Id;
808 acct_rec.account_number := C_account_Number;
809 acct_rec.attribute_category := C_Attribute_Category;
810 acct_rec.attribute1 := C_Attribute1;
811 acct_rec.attribute2 := C_Attribute2;
812 acct_rec.attribute3 := C_Attribute3;
813 acct_rec.attribute4 := C_Attribute4;
814 acct_rec.attribute5 := C_Attribute5;
815 acct_rec.attribute6 := C_Attribute6;
816 acct_rec.attribute7 := C_Attribute7;
817 acct_rec.attribute8 := C_Attribute8;
818 acct_rec.attribute9 := C_Attribute9;
819 acct_rec.attribute10 := C_Attribute10;
820 acct_rec.attribute11 := C_Attribute11;
821 acct_rec.attribute12 := C_Attribute12;
822 acct_rec.attribute13 := C_Attribute13;
823 acct_rec.attribute14 := C_Attribute14;
824 acct_rec.attribute15 := C_Attribute15;
825 acct_rec.attribute16 := C_Attribute16;
826 acct_rec.attribute17 := C_Attribute17;
827 acct_rec.attribute18 := C_Attribute18;
828 acct_rec.attribute19 := C_Attribute19;
829 acct_rec.attribute20 := C_Attribute20;
830 acct_rec.global_attribute_category := C_Global_Attribute_Category;
831 acct_rec.global_attribute1 := C_Global_Attribute1;
832 acct_rec.global_attribute2 := C_Global_Attribute2;
833 acct_rec.global_attribute3 := C_Global_Attribute3;
834 acct_rec.global_attribute4 := C_Global_Attribute4;
835 acct_rec.global_attribute5 := C_Global_Attribute5;
836 acct_rec.global_attribute6 := C_Global_Attribute6;
837 acct_rec.global_attribute7 := C_Global_Attribute7;
838 acct_rec.global_attribute8 := C_Global_Attribute8;
839 acct_rec.global_attribute9 := C_Global_Attribute9;
840 acct_rec.global_attribute10 := C_Global_Attribute10;
841 acct_rec.global_attribute11 := C_Global_Attribute11;
842 acct_rec.global_attribute12 := C_Global_Attribute12;
843 acct_rec.global_attribute13 := C_Global_Attribute13;
844 acct_rec.global_attribute14 := C_Global_Attribute14;
845 acct_rec.global_attribute15 := C_Global_Attribute15;
846 acct_rec.global_attribute16 := C_Global_Attribute16;
847 acct_rec.global_attribute17 := C_Global_Attribute17;
848 acct_rec.global_attribute18 := C_Global_Attribute18;
849 acct_rec.global_attribute19 := C_Global_Attribute19;
850 acct_rec.global_attribute20 := C_Global_Attribute20;
851 acct_rec.orig_system_reference := C_Orig_System_Reference;
852 acct_rec.status := C_Status;
853 acct_rec.customer_type := c_customer_type;
854 acct_rec.customer_class_code := C_Customer_Class_Code;
855 acct_rec.primary_salesrep_id := C_Primary_Salesrep_Id;
856 acct_rec.sales_channel_code := C_Sales_Channel_Code;
857 acct_rec.order_type_id := C_Order_Type_Id;
858 acct_rec.price_list_id := C_Price_List_Id;
859 acct_rec.tax_code := C_Tax_Code;
860 acct_rec.fob_point := C_Fob_Point;
861 acct_rec.tax_header_level_flag := C_Tax_Header_Level_Flag;
862 acct_rec.tax_rounding_rule := C_Tax_Rounding_Rule;
863 acct_rec.primary_specialist_id := NULL;
864 acct_rec.secondary_specialist_id := NULL;
865 -- acct_rec.geo_code := NULL;
866 acct_rec.account_name := c_account_name;
867 acct_rec.freight_term := C_Freight_Term;
868 acct_rec.ship_partial := C_Ship_Partial;
869 acct_rec.ship_via := C_Ship_Via;
870 acct_rec.warehouse_id := C_Warehouse_Id;
871 -- acct_rec.payment_term_id := NULL;
872 acct_rec.account_liable_flag := NULL;
873 acct_rec.DATES_NEGATIVE_TOLERANCE:= c_DATES_NEGATIVE_TOLERANCE;
874 acct_rec.DATES_POSITIVE_TOLERANCE:= c_DATES_POSITIVE_TOLERANCE;
875 acct_rec.DATE_TYPE_PREFERENCE := c_DATE_TYPE_PREFERENCE;
876 acct_rec.OVER_SHIPMENT_TOLERANCE := c_OVER_SHIPMENT_TOLERANCE;
877 acct_rec.UNDER_SHIPMENT_TOLERANCE:= c_UNDER_SHIPMENT_TOLERANCE;
878 acct_rec.ITEM_CROSS_REF_PREF := c_ITEM_CROSS_REF_PREF;
879 acct_rec.SHIP_SETS_INCLUDE_LINES_FLAG := c_SHIP_SETS_INCLUDE_LINES_FLAG;
880 acct_rec.ARRIVALSETS_INCLUDE_LINES_FLAG := c_ARRIVALSETS_INCL_LINES_FLAG;
881 acct_rec.SCHED_DATE_PUSH_FLAG := c_SCHED_DATE_PUSH_FLAG;
882 acct_rec.INVOICE_QUANTITY_RULE := c_INVOICE_QUANTITY_RULE;
883 acct_rec.OVER_RETURN_TOLERANCE := c_OVER_RETURN_TOLERANCE;
884 acct_rec.UNDER_RETURN_TOLERANCE := c_UNDER_RETURN_TOLERANCE;
885 acct_rec.created_by_module := 'TCA_FORM_WRAPPER';
886
887
888 -------------------------------
889 -- V2 REC TYPE Organization
890 -------------------------------
891 org_rec.party_rec.party_id := c_party_id;
892 org_rec.organization_name := o_party_name;
893 org_rec.sic_code := o_sic_code;
894 org_rec.sic_code_type := o_sic_code_type;
895 org_rec.analysis_fy := o_analysis_fy;
896 org_rec.fiscal_yearend_month := o_fiscal_yearend_month;
897 org_rec.employees_total := o_num_of_employees;
898 org_rec.curr_fy_potential_revenue := o_curr_fy_potential_revenue;
899 org_rec.next_fy_potential_revenue := o_next_fy_potential_revenue;
900 org_rec.tax_reference := o_Tax_Reference;
901 org_rec.year_established := o_Year_Established;
902 org_rec.gsa_indicator_flag := o_Gsa_Indicator_flag;
903 org_rec.mission_statement := o_mission_statement;
904 -- org_rec.duns_number := o_duns_number;
905 org_rec.duns_number_c := o_duns_number_c;
906 -- org_rec.tax_name := NULL;
907 org_rec.organization_type := c_customer_type;
908 org_rec.jgzz_fiscal_code := o_taxpayer_id;
909 org_rec.business_scope := NULL;
910 org_rec.corporation_class := NULL;
911 org_rec.organization_name_phonetic := o_party_name_phonetic;
912 org_rec.created_by_module := 'TCA_FORM_WRAPPER';
913 --
914 org_rec.party_rec.party_id := t_party_id;
915 org_rec.party_rec.party_number := t_party_number;
916 org_rec.party_rec.validated_flag := NULL;
917 org_rec.party_rec.orig_system_reference := c_orig_system_reference;
918 -- org_rec.party_rec.customer_key := t_customer_key;
919 org_rec.party_rec.attribute_category := t_Attribute_Category;
920 org_rec.party_rec.attribute1 := t_Attribute1;
921 org_rec.party_rec.attribute2 := t_Attribute2;
922 org_rec.party_rec.attribute3 := t_Attribute3;
923 org_rec.party_rec.attribute4 := t_Attribute4;
924 org_rec.party_rec.attribute5 := t_Attribute5;
925 org_rec.party_rec.attribute6 := t_Attribute6;
926 org_rec.party_rec.attribute7 := t_Attribute7;
927 org_rec.party_rec.attribute8 := t_attribute8;
928 org_rec.party_rec.attribute9 := t_Attribute9;
929 org_rec.party_rec.attribute10 := t_Attribute10;
930 org_rec.party_rec.attribute11 := t_Attribute11;
931 org_rec.party_rec.attribute12 := t_Attribute12;
932 org_rec.party_rec.attribute13 := t_Attribute13;
933 org_rec.party_rec.attribute14 := t_Attribute14;
934 org_rec.party_rec.attribute15 := t_Attribute15;
935 org_rec.party_rec.attribute16 := t_Attribute16;
936 org_rec.party_rec.attribute17 := t_Attribute17;
937 org_rec.party_rec.attribute18 := t_Attribute18;
938 org_rec.party_rec.attribute19 := t_Attribute19;
939 org_rec.party_rec.attribute20 := t_Attribute20;
940 org_rec.party_rec.status := null;
941 org_rec.party_rec.category_code := C_Category_Code;
942 -- org_rec.party_rec.reference_use_flag := C_Reference_Use_Flag;
943 -- org_rec.party_rec.third_party_flag := C_Third_Party_Flag;
944 -- org_rec.party_rec.competitor_flag := c_competitor_flag;
945
946 -------------------------------
947 -- V2 REC TYPE Customer Profile
948 -------------------------------
949 prof_rec.cust_account_profile_id := p_cust_account_profile_id;
950 prof_rec.cust_account_id := p_cust_account_id;
951 prof_rec.status := p_status;
952 prof_rec.collector_id := p_collector_id;
953 prof_rec.credit_analyst_id := p_credit_analyst_id;
954 prof_rec.credit_checking := p_credit_checking;
955 prof_rec.next_credit_review_date := p_next_credit_review_date;
956 prof_rec.tolerance := p_tolerance;
957 prof_rec.discount_terms := p_discount_terms;
958 prof_rec.dunning_letters := p_dunning_letters;
959 prof_rec.interest_charges := p_interest_charges;
960 prof_rec.send_statements := p_send_statements;
961 prof_rec.credit_balance_statements := p_credit_balance_statements;
962 prof_rec.credit_hold := p_credit_hold;
963 prof_rec.profile_class_id := p_profile_class_id;
964 prof_rec.site_use_id := NULL;
965 prof_rec.credit_rating := p_credit_rating;
966 prof_rec.risk_code := p_risk_code;
967 prof_rec.standard_terms := p_standard_terms;
968 prof_rec.override_terms := p_override_terms;
969 prof_rec.dunning_letter_set_id := p_dunning_letter_set_id;
970 prof_rec.interest_period_days := p_interest_period_days;
971 prof_rec.payment_grace_days := p_payment_grace_days;
972 prof_rec.discount_grace_days := p_discount_grace_days;
973 prof_rec.statement_cycle_id := p_statement_cycle_id;
974 prof_rec.account_status := p_account_status;
975 prof_rec.percent_collectable := p_percent_collectable;
976 prof_rec.autocash_hierarchy_id := p_autocash_hierarchy_id;
977 prof_rec.attribute_category := p_attribute_category;
978 prof_rec.attribute1 := p_attribute1;
979 prof_rec.attribute2 := p_attribute2;
980 prof_rec.attribute3 := p_attribute3;
981 prof_rec.attribute4 := p_attribute4;
982 prof_rec.attribute5 := p_attribute5;
983 prof_rec.attribute6 := p_attribute6;
984 prof_rec.attribute7 := p_attribute7;
985 prof_rec.attribute8 := p_attribute8;
986 prof_rec.attribute9 := p_attribute9;
987 prof_rec.attribute10 := p_attribute10;
988 prof_rec.attribute11 := p_attribute11;
989 prof_rec.attribute12 := p_attribute12;
990 prof_rec.attribute13 := p_attribute13;
991 prof_rec.attribute14 := p_attribute14;
992 prof_rec.attribute15 := p_attribute15;
993 prof_rec.auto_rec_incl_disputed_flag := p_auto_rec_incl_disputed_flag;
994 prof_rec.tax_printing_option := p_tax_printing_option;
995 prof_rec.charge_on_finance_charge_flag := p_charge_on_fin_charge_flag;
996 prof_rec.grouping_rule_id := p_grouping_rule_id;
997 prof_rec.clearing_days := p_clearing_days;
998 prof_rec.jgzz_attribute_category := p_jgzz_attribute_category;
999 prof_rec.jgzz_attribute1 := p_jgzz_attribute1;
1000 prof_rec.jgzz_attribute2 := p_jgzz_attribute2;
1001 prof_rec.jgzz_attribute3 := p_jgzz_attribute3;
1002 prof_rec.jgzz_attribute4 := p_jgzz_attribute4;
1003 prof_rec.jgzz_attribute5 := p_jgzz_attribute5;
1004 prof_rec.jgzz_attribute6 := p_jgzz_attribute6;
1005 prof_rec.jgzz_attribute7 := p_jgzz_attribute7;
1006 prof_rec.jgzz_attribute8 := p_jgzz_attribute8;
1007 prof_rec.jgzz_attribute9 := p_jgzz_attribute9;
1008 prof_rec.jgzz_attribute10 := p_jgzz_attribute10;
1009 prof_rec.jgzz_attribute11 := p_jgzz_attribute11;
1010 prof_rec.jgzz_attribute12 := p_jgzz_attribute12;
1011 prof_rec.jgzz_attribute13 := p_jgzz_attribute13;
1012 prof_rec.jgzz_attribute14 := p_jgzz_attribute14;
1013 prof_rec.jgzz_attribute15 := p_jgzz_attribute15;
1014 prof_rec.global_attribute1 := p_global_attribute1;
1015 prof_rec.global_attribute2 := p_global_attribute2;
1016 prof_rec.global_attribute3 := p_global_attribute3;
1017 prof_rec.global_attribute4 := p_global_attribute4;
1018 prof_rec.global_attribute5 := p_global_attribute5;
1019 prof_rec.global_attribute6 := p_global_attribute6;
1020 prof_rec.global_attribute7 := p_global_attribute7;
1021 prof_rec.global_attribute8 := p_global_attribute8;
1022 prof_rec.global_attribute9 := p_global_attribute9;
1023 prof_rec.global_attribute10 := p_global_attribute10;
1024 prof_rec.global_attribute11 := p_global_attribute11;
1025 prof_rec.global_attribute12 := p_global_attribute12;
1026 prof_rec.global_attribute13 := p_global_attribute13;
1027 prof_rec.global_attribute14 := p_global_attribute14;
1028 prof_rec.global_attribute15 := p_global_attribute15;
1029 prof_rec.global_attribute16 := p_global_attribute16;
1030 prof_rec.global_attribute17 := p_global_attribute17;
1031 prof_rec.global_attribute18 := p_global_attribute18;
1032 prof_rec.global_attribute19 := p_global_attribute19;
1033 prof_rec.global_attribute20 := p_global_attribute20;
1034 prof_rec.global_attribute_category := p_global_attribute_category;
1035 prof_rec.cons_inv_flag := p_cons_inv_flag;
1036 prof_rec.cons_inv_type := p_cons_inv_type;
1037 prof_rec.autocash_hierarchy_id_for_adr := p_autocash_hier_id_for_adr;
1038 prof_rec.lockbox_matching_option := p_lockbox_matching_option ;
1039 prof_rec.created_by_module := 'TCA_FORM_WRAPPER';
1040 --{2310474
1041 prof_rec.party_id := p_party_id;
1042 prof_rec.review_cycle := p_review_cycle;
1043 prof_rec.credit_classification := p_credit_classification;
1044 prof_rec.last_credit_review_date := p_last_credit_review_date;
1045 --}
1046
1047 ---------------------------------------------
1048 -- Create Customer Account for Oragnization {
1049 ---------------------------------------------
1050 HZ_CUST_ACCOUNT_V2PUB.create_cust_account (
1051 p_cust_account_rec => acct_rec,
1052 p_organization_rec => org_rec,
1053 p_customer_profile_rec => prof_rec,
1054 p_create_profile_amt => FND_API.G_FALSE,
1055 x_cust_account_id => x_customer_id,
1056 x_account_number => x_cust_account_number,
1057 x_party_id => x_party_id,
1058 x_party_number => x_party_number,
1059 x_profile_id => o_organization_profile_id,
1060 x_return_status => x_return_status,
1061 x_msg_count => x_msg_count,
1062 x_msg_data => x_msg_data );
1063
1064
1065 IF x_msg_count > 1 THEN
1066 FOR i IN 1..x_msg_count LOOP
1067 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1068 tmp_var1 := tmp_var1 || ' '|| tmp_var;
1069 END LOOP;
1070 x_msg_data := tmp_var1;
1071 END IF;
1072
1073 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1074 return;
1075 END IF;
1076
1077 c_cust_account_id := x_customer_id;
1078 c_party_id := x_party_id;
1079 t_party_number := x_party_number;
1080 c_account_number := x_cust_account_number;
1081
1082
1083 /*Bug 3013045*/
1084
1085 IF l_flag
1086 THEN
1087 object_version_select (
1088 p_table_name => 'HZ_ORG_PERS',
1089 p_col_id => C_Party_Id,
1090 x_rowid => l_party_rowid,
1091 x_object_version_number => l_party_object_version,
1092 x_last_update_date => l_party_last_update_date,
1093 x_id_value => l_dummy_id,
1094 x_return_status => x_return_status,
1095 x_msg_count => x_msg_count,
1096 x_msg_data => x_msg_data
1097 );
1098 IF x_msg_count > 1 THEN
1099 FOR i IN 1..x_msg_count LOOP
1100 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1101 tmp_var1 := tmp_var1 || ' '|| tmp_var;
1102 END LOOP;
1103 x_msg_data := tmp_var1;
1104 END IF;
1105
1106 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1107 return;
1108 END IF;
1109
1110 org_rec_update.party_rec.category_code := INIT_SWITCH(C_Category_Code);
1111 org_rec_update.party_rec.party_id := INIT_SWITCH(C_Party_Id);
1112 org_rec_update.organization_name := INIT_SWITCH(o_party_name);
1113 org_rec_update.sic_code := INIT_SWITCH(o_sic_code);
1114 org_rec_update.sic_code_type := INIT_SWITCH(o_sic_code_type);
1115 org_rec_update.analysis_fy := INIT_SWITCH(o_analysis_fy);
1116 org_rec_update.fiscal_yearend_month := INIT_SWITCH(o_fiscal_yearend_month);
1117 org_rec_update.employees_total := INIT_SWITCH(o_num_of_employees);
1118 org_rec_update.curr_fy_potential_revenue := INIT_SWITCH(o_curr_fy_potential_revenue);
1119 org_rec_update.next_fy_potential_revenue := INIT_SWITCH(o_next_fy_potential_revenue);
1120 org_rec_update.year_established := INIT_SWITCH(o_year_established);
1121 org_rec_update.gsa_indicator_flag := INIT_SWITCH(o_gsa_indicator_flag);
1122 org_rec_update.jgzz_fiscal_code := INIT_SWITCH(o_taxpayer_id);
1123 org_rec_update.mission_statement := INIT_SWITCH(o_mission_statement);
1124 org_rec_update.organization_name_phonetic := INIT_SWITCH(o_party_name_phonetic);
1125 org_rec_update.duns_number_c := INIT_SWITCH(o_duns_number_c);
1126 org_rec_update.tax_reference := INIT_SWITCH(o_tax_reference);
1127 org_rec_update.content_source_type := NVL(org_rec_update.content_source_type,'USER_ENTERED');
1128
1129 HZ_PARTY_V2PUB.update_organization (
1130 p_organization_rec => org_rec_update,
1131 p_party_object_version_number => l_party_object_version,
1132 x_profile_id => o_organization_profile_id,
1133 x_return_status => x_return_status,
1134 x_msg_count => x_msg_count,
1135 x_msg_data => x_msg_data
1136 );
1137
1138 IF x_msg_count > 1 THEN
1139 FOR i IN 1..x_msg_count LOOP
1140 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1141 tmp_var1 := tmp_var1 || ' '|| tmp_var;
1142 END LOOP;
1143 x_msg_data := tmp_var1;
1144 END IF;
1145
1146 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1147 return;
1148 END IF;
1149
1150 END IF;
1151
1152 /*End bugfix 3013045*/
1153
1154
1155
1156
1157
1158
1159 -------------------
1160 -- Internal Party
1161 -------------------
1162 i_internal_party_id := fnd_profile.value('HZ_INTERNAL_PARTY');
1163
1164 IF i_internal_party_id IS NOT NULL THEN
1165 Ref_Part_Comp
1166 ( c_party_id => c_party_id,
1167 c_party_type => 'ORGANIZATION',
1168 i_internal_party_id => i_internal_party_id,
1169 C_Reference_Use_Flag => C_Reference_Use_Flag,
1170 C_Third_Party_Flag => C_Third_Party_Flag,
1171 C_competitor_flag => C_competitor_flag,
1172 x_return_status => x_return_status,
1173 x_msg_count => x_msg_count,
1174 x_msg_data => x_msg_data ,
1175 x_end_date => SYSDATE);
1176
1177
1178 IF x_msg_count > 1 THEN
1179 FOR i IN 1..x_msg_count LOOP
1180 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1181 tmp_var1 := tmp_var1 || ' '|| tmp_var;
1182 END LOOP;
1183 x_msg_data := tmp_var1;
1184 END IF;
1185
1186 END IF;
1187
1188 END insert_row;
1189
1190
1191 PROCEDURE insert_person_row(
1192 c_cust_account_id IN OUT NOCOPY NUMBER ,
1193 c_party_id IN OUT NOCOPY NUMBER,
1194 c_account_number IN OUT NOCOPY VARCHAR2,
1195 c_Attribute_Category IN VARCHAR2,
1196 c_Attribute1 IN VARCHAR2,
1197 c_Attribute2 IN VARCHAR2,
1198 c_Attribute3 IN VARCHAR2,
1199 c_Attribute4 IN VARCHAR2,
1200 c_Attribute5 IN VARCHAR2,
1201 c_Attribute6 IN VARCHAR2,
1202 c_Attribute7 IN VARCHAR2,
1203 c_Attribute8 IN VARCHAR2,
1204 c_Attribute9 IN VARCHAR2,
1205 c_Attribute10 IN VARCHAR2,
1206 c_Attribute11 IN VARCHAR2,
1207 c_Attribute12 IN VARCHAR2,
1208 c_Attribute13 IN VARCHAR2,
1209 c_Attribute14 IN VARCHAR2,
1210 c_Attribute15 IN VARCHAR2,
1211 c_Attribute16 IN VARCHAR2,
1212 c_Attribute17 IN VARCHAR2,
1213 c_Attribute18 IN VARCHAR2,
1214 c_Attribute19 IN VARCHAR2,
1215 c_Attribute20 IN VARCHAR2,
1216 c_global_attribute_category IN VARCHAR2,
1217 c_global_attribute1 IN VARCHAR2,
1218 c_global_attribute2 IN VARCHAR2,
1219 c_global_attribute3 IN VARCHAR2,
1220 c_global_attribute4 IN VARCHAR2,
1221 c_global_attribute5 IN VARCHAR2,
1222 c_global_attribute6 IN VARCHAR2,
1223 c_global_attribute7 IN VARCHAR2,
1224 c_global_attribute8 IN VARCHAR2,
1225 c_global_attribute9 IN VARCHAR2,
1226 c_global_attribute10 IN VARCHAR2,
1227 c_global_attribute11 IN VARCHAR2,
1228 c_global_attribute12 IN VARCHAR2,
1229 c_global_attribute13 IN VARCHAR2,
1230 c_global_attribute14 IN VARCHAR2,
1231 c_global_attribute15 IN VARCHAR2,
1232 c_global_attribute16 IN VARCHAR2,
1233 c_global_attribute17 IN VARCHAR2,
1234 c_global_attribute18 IN VARCHAR2,
1235 c_global_attribute19 IN VARCHAR2,
1236 c_global_attribute20 IN VARCHAR2,
1237 c_orig_system_reference IN VARCHAR2,
1238 c_status IN VARCHAR2,
1239 c_customer_type IN VARCHAR2,
1240 c_customer_class_code IN VARCHAR2,
1241 c_primary_salesrep_id IN NUMBER ,
1242 c_sales_channel_code IN VARCHAR2,
1243 c_order_type_id IN NUMBER,
1244 c_price_list_id IN NUMBER ,
1245 c_category_code IN VARCHAR2,
1246 c_reference_use_flag IN VARCHAR2,
1247 c_tax_code IN VARCHAR2,
1248 c_third_party_flag IN VARCHAR2,
1249 c_competitor_flag IN VARCHAR2,
1250 c_fob_point IN VARCHAR2,
1251 c_tax_header_level_flag IN VARCHAR2,
1252 c_tax_rounding_rule IN VARCHAR2,
1253 c_account_name IN VARCHAR2,
1254 c_freight_term IN VARCHAR2,
1255 c_ship_partial IN VARCHAR2,
1256 c_ship_via IN VARCHAR2,
1257 c_warehouse_id IN NUMBER,
1258 c_payment_term_id IN NUMBER ,
1259 c_DATES_NEGATIVE_TOLERANCE IN NUMBER,
1260 c_DATES_POSITIVE_TOLERANCE IN NUMBER,
1261 c_DATE_TYPE_PREFERENCE IN VARCHAR2,
1262 c_OVER_SHIPMENT_TOLERANCE IN NUMBER,
1263 c_UNDER_SHIPMENT_TOLERANCE IN NUMBER,
1264 c_ITEM_CROSS_REF_PREF IN VARCHAR2,
1265 c_OVER_RETURN_TOLERANCE IN NUMBER,
1266 c_UNDER_RETURN_TOLERANCE IN NUMBER,
1267 c_SHIP_SETS_INCLUDE_LINES_FLAG IN VARCHAR2,
1268 c_ARRIVALSETS_INCL_LINES_FLAG IN VARCHAR2,
1269 c_SCHED_DATE_PUSH_FLAG IN VARCHAR2,
1270 c_INVOICE_QUANTITY_RULE IN VARCHAR2,
1271 t_party_id IN NUMBER ,
1272 t_party_number IN OUT NOCOPY VARCHAR2,
1273 t_customer_key IN VARCHAR2,
1274 t_Attribute_Category IN VARCHAR2,
1275 t_Attribute1 IN VARCHAR2,
1276 t_Attribute2 IN VARCHAR2,
1277 t_Attribute3 IN VARCHAR2,
1278 t_Attribute4 IN VARCHAR2,
1279 t_Attribute5 IN VARCHAR2,
1280 t_Attribute6 IN VARCHAR2,
1281 t_Attribute7 IN VARCHAR2,
1282 t_Attribute8 IN VARCHAR2,
1283 t_Attribute9 IN VARCHAR2,
1284 t_Attribute10 IN VARCHAR2,
1285 t_Attribute11 IN VARCHAR2,
1286 t_Attribute12 IN VARCHAR2,
1287 t_Attribute13 IN VARCHAR2,
1288 t_Attribute14 IN VARCHAR2,
1289 t_Attribute15 IN VARCHAR2,
1290 t_Attribute16 IN VARCHAR2,
1291 t_Attribute17 IN VARCHAR2,
1292 t_Attribute18 IN VARCHAR2,
1293 t_Attribute19 IN VARCHAR2,
1294 t_Attribute20 IN VARCHAR2,
1295 t_global_attribute_category IN VARCHAR2,
1296 t_global_attribute1 IN VARCHAR2,
1297 t_global_attribute2 IN VARCHAR2,
1298 t_global_attribute3 IN VARCHAR2,
1299 t_global_attribute4 IN VARCHAR2,
1300 t_global_attribute5 IN VARCHAR2,
1301 t_global_attribute6 IN VARCHAR2,
1302 t_global_attribute7 IN VARCHAR2,
1303 t_global_attribute8 IN VARCHAR2,
1304 t_global_attribute9 IN VARCHAR2,
1305 t_global_attribute10 IN VARCHAR2,
1306 t_global_attribute11 IN VARCHAR2,
1307 t_global_attribute12 IN VARCHAR2,
1308 t_global_attribute13 IN VARCHAR2,
1309 t_global_attribute14 IN VARCHAR2,
1310 t_global_attribute15 IN VARCHAR2,
1311 t_global_attribute16 IN VARCHAR2,
1312 t_global_attribute17 IN VARCHAR2,
1313 t_global_attribute18 IN VARCHAR2,
1314 t_global_attribute19 IN VARCHAR2,
1315 t_global_attribute20 IN VARCHAR2,
1316 o_pre_name_adjunct IN VARCHAR2,
1317 o_first_name IN VARCHAR2,
1318 o_middle_name IN VARCHAR2,
1319 o_last_name IN VARCHAR2,
1320 o_name_suffix IN VARCHAR2,
1321 o_tax_reference IN VARCHAR2,
1322 o_taxpayer_id IN VARCHAR2,
1323 o_party_name_phonetic IN VARCHAR2,
1324 p_cust_account_profile_id IN NUMBER ,
1325 p_cust_account_id IN NUMBER ,
1326 p_status IN VARCHAR2,
1327 p_collector_id IN NUMBER ,
1328 p_credit_analyst_id IN NUMBER ,
1329 p_credit_checking IN VARCHAR2,
1330 p_next_credit_review_date DATE ,
1331 p_tolerance IN NUMBER,
1332 p_discount_terms IN VARCHAR2,
1333 p_dunning_letters IN VARCHAR2,
1334 p_interest_charges IN VARCHAR2,
1335 p_send_statements IN VARCHAR2,
1336 p_credit_balance_statements IN VARCHAR2,
1337 p_credit_hold IN VARCHAR2,
1338 p_profile_class_id IN NUMBER ,
1339 p_site_use_id IN NUMBER ,
1340 p_credit_rating IN VARCHAR2,
1341 p_risk_code IN VARCHAR2,
1342 p_standard_terms IN NUMBER ,
1343 p_override_terms IN VARCHAR2,
1344 p_dunning_letter_set_id IN NUMBER,
1345 p_interest_period_days IN NUMBER,
1346 p_payment_grace_days IN NUMBER,
1347 p_discount_grace_days IN NUMBER,
1348 p_statement_cycle_id IN NUMBER ,
1349 p_account_status IN VARCHAR2,
1350 p_percent_collectable IN NUMBER ,
1351 p_autocash_hierarchy_id IN NUMBER,
1352 p_Attribute_Category IN VARCHAR2,
1353 p_Attribute1 IN VARCHAR2,
1354 p_Attribute2 IN VARCHAR2,
1355 p_Attribute3 IN VARCHAR2,
1356 p_Attribute4 IN VARCHAR2,
1357 p_Attribute5 IN VARCHAR2,
1358 p_Attribute6 IN VARCHAR2,
1359 p_Attribute7 IN VARCHAR2,
1360 p_Attribute8 IN VARCHAR2,
1361 p_Attribute9 IN VARCHAR2,
1362 p_Attribute10 IN VARCHAR2,
1363 p_Attribute11 IN VARCHAR2,
1364 p_Attribute12 IN VARCHAR2,
1365 p_Attribute13 IN VARCHAR2,
1366 p_Attribute14 IN VARCHAR2,
1367 p_Attribute15 IN VARCHAR2,
1368 p_auto_rec_incl_disputed_flag IN VARCHAR2,
1369 p_tax_printing_option IN VARCHAR2,
1370 p_charge_on_fin_charge_flag IN VARCHAR2,
1371 p_grouping_rule_id IN NUMBER ,
1372 p_clearing_days IN NUMBER,
1373 p_jgzz_attribute_category IN VARCHAR2,
1374 p_jgzz_attribute1 IN VARCHAR2,
1375 p_jgzz_attribute2 IN VARCHAR2,
1376 p_jgzz_attribute3 IN VARCHAR2,
1377 p_jgzz_attribute4 IN VARCHAR2,
1378 p_jgzz_attribute5 IN VARCHAR2,
1379 p_jgzz_attribute6 IN VARCHAR2,
1380 p_jgzz_attribute7 IN VARCHAR2,
1381 p_jgzz_attribute8 IN VARCHAR2,
1382 p_jgzz_attribute9 IN VARCHAR2,
1383 p_jgzz_attribute10 IN VARCHAR2,
1384 p_jgzz_attribute11 IN VARCHAR2,
1385 p_jgzz_attribute12 IN VARCHAR2,
1386 p_jgzz_attribute13 IN VARCHAR2,
1387 p_jgzz_attribute14 IN VARCHAR2,
1388 p_jgzz_attribute15 IN VARCHAR2,
1389 p_global_attribute_category IN VARCHAR2,
1390 p_global_attribute1 IN VARCHAR2,
1391 p_global_attribute2 IN VARCHAR2,
1392 p_global_attribute3 IN VARCHAR2,
1393 p_global_attribute4 IN VARCHAR2,
1394 p_global_attribute5 IN VARCHAR2,
1395 p_global_attribute6 IN VARCHAR2,
1396 p_global_attribute7 IN VARCHAR2,
1397 p_global_attribute8 IN VARCHAR2,
1398 p_global_attribute9 IN VARCHAR2,
1399 p_global_attribute10 IN VARCHAR2,
1400 p_global_attribute11 IN VARCHAR2,
1401 p_global_attribute12 IN VARCHAR2,
1402 p_global_attribute13 IN VARCHAR2,
1403 p_global_attribute14 IN VARCHAR2,
1404 p_global_attribute15 IN VARCHAR2,
1405 p_global_attribute16 IN VARCHAR2,
1406 p_global_attribute17 IN VARCHAR2,
1407 p_global_attribute18 IN VARCHAR2,
1408 p_global_attribute19 IN VARCHAR2,
1409 p_global_attribute20 IN VARCHAR2,
1410 p_cons_inv_flag IN VARCHAR2,
1411 p_cons_inv_type IN VARCHAR2,
1412 p_autocash_hier_id_for_adr IN NUMBER ,
1413 p_lockbox_matching_option IN VARCHAR2,
1414 --{2310474
1415 p_party_id IN NUMBER DEFAULT NULL,
1416 p_review_cycle IN VARCHAR2 DEFAULT NULL,
1417 p_credit_classification IN VARCHAR2 DEFAULT NULL,
1418 p_last_credit_review_date IN DATE DEFAULT NULL,
1419 -- }
1420 o_person_profile_id IN OUT NOCOPY number,
1421 x_msg_count OUT NOCOPY NUMBER,
1422 x_msg_data OUT NOCOPY varchar2,
1423 x_return_status OUT NOCOPY VARCHAR2)
1424 IS
1425
1426 -- acct_rec hz_customer_accounts_pub.account_rec_type;
1427 -- party_rec hz_party_pub.party_rec_type;
1428 -- person_rec hz_party_pub.person_rec_type;
1429 -- prel_rec hz_party_pub.party_rel_rec_type;
1430 -- prof_rec hz_customer_accounts_pub.cust_profile_rec_type;
1431
1432
1433 acct_rec hz_cust_account_v2pub.cust_account_rec_type;
1434 party_rec hz_party_v2pub.party_rec_type;
1435 person_rec hz_party_v2pub.person_rec_type;
1436 prel_rec hz_relationship_v2pub.relationship_rec_type;
1437 prof_rec hz_customer_profile_v2pub.customer_profile_rec_type;
1438
1439 /*Bug 3013045 */
1440 person_rec_update hz_party_v2pub.person_rec_type;
1441
1442 tmp_var VARCHAR2(2000);
1443 i NUMBER;
1444 tmp_var1 VARCHAR2(2000);
1445 x_customer_id NUMBER;
1446 x_cust_account_number VARCHAR2(100);
1447 x_party_id NUMBER;
1448 x_party_number VARCHAR2(100);
1449 i_internal_party_id NUMBER;
1450 i_pr_party_relationship_id NUMBER;
1451 i_pr_party_id NUMBER;
1452 i_pr_party_number VARCHAR2(100);
1453 -- create_internal_party VARCHAR2(1) := 'Y';
1454 x_party_rel_id NUMBER;
1455 l_party_rel_object_version NUMBER;
1456 l_party_object_version NUMBER;
1457
1458 x_party_last_update_date date;
1459 X_PARTY_REL_LAST_UPDATE_DATE date;
1460
1461 /*Bug 3013045*/
1462 l_flag BOOLEAN;
1463 l_party_rowid ROWID;
1464 l_party_last_update_date DATE;
1465 l_dummy_id NUMBER;
1466
1467 BEGIN
1468
1469 x_return_status := FND_API.G_RET_STS_SUCCESS;
1470
1471 /*Bug 3013045*/
1472
1473 IF c_party_id is not null
1474 THEN
1475 l_flag := TRUE;
1476 END IF;
1477
1478 acct_rec.cust_account_id := C_Cust_account_Id;
1479 -- acct_rec.party_id := C_Party_Id;
1480 acct_rec.account_number := C_account_Number;
1481 acct_rec.attribute_category := C_Attribute_Category;
1482 acct_rec.attribute1 := C_Attribute1;
1483 acct_rec.attribute2 := C_Attribute2;
1484 acct_rec.attribute3 := C_Attribute3;
1485 acct_rec.attribute4 := C_Attribute4;
1486 acct_rec.attribute5 := C_Attribute5;
1487 acct_rec.attribute6 := C_Attribute6;
1488 acct_rec.attribute7 := C_Attribute7;
1489 acct_rec.attribute8 := C_Attribute8;
1490 acct_rec.attribute9 := C_Attribute9;
1491 acct_rec.attribute10 := C_Attribute10;
1492 acct_rec.attribute11 := C_Attribute11;
1493 acct_rec.attribute12 := C_Attribute12;
1494 acct_rec.attribute13 := C_Attribute13;
1495 acct_rec.attribute14 := C_Attribute14;
1496 acct_rec.attribute15 := C_Attribute15;
1497 acct_rec.attribute16 := C_Attribute16;
1498 acct_rec.attribute17 := C_Attribute17;
1499 acct_rec.attribute18 := C_Attribute18;
1500 acct_rec.attribute19 := C_Attribute19;
1501 acct_rec.attribute20 := C_Attribute20;
1502 acct_rec.global_attribute_category := C_Global_Attribute_Category;
1503 acct_rec.global_attribute1 := C_Global_Attribute1;
1504 acct_rec.global_attribute2 := C_Global_Attribute2;
1505 acct_rec.global_attribute3 := C_Global_Attribute3;
1506 acct_rec.global_attribute4 := C_Global_Attribute4;
1507 acct_rec.global_attribute5 := C_Global_Attribute5;
1508 acct_rec.global_attribute6 := C_Global_Attribute6;
1509 acct_rec.global_attribute7 := C_Global_Attribute7;
1510 acct_rec.global_attribute8 := C_Global_Attribute8;
1511 acct_rec.global_attribute9 := C_Global_Attribute9;
1512 acct_rec.global_attribute10 := C_Global_Attribute10;
1513 acct_rec.global_attribute11 := C_Global_Attribute11;
1514 acct_rec.global_attribute12 := C_Global_Attribute12;
1515 acct_rec.global_attribute13 := C_Global_Attribute13;
1516 acct_rec.global_attribute14 := C_Global_Attribute14;
1517 acct_rec.global_attribute15 := C_Global_Attribute15;
1518 acct_rec.global_attribute16 := C_Global_Attribute16;
1519 acct_rec.global_attribute17 := C_Global_Attribute17;
1520 acct_rec.global_attribute18 := C_Global_Attribute18;
1521 acct_rec.global_attribute19 := C_Global_Attribute19;
1522 acct_rec.global_attribute20 := C_Global_Attribute20;
1523 acct_rec.orig_system_reference := C_Orig_System_Reference;
1524 acct_rec.status := C_Status;
1525 acct_rec.customer_type := c_customer_type;
1526 acct_rec.customer_class_code := C_Customer_Class_Code;
1527 acct_rec.primary_salesrep_id := C_Primary_Salesrep_Id;
1528 acct_rec.sales_channel_code := C_Sales_Channel_Code;
1529 acct_rec.order_type_id := C_Order_Type_Id;
1530 acct_rec.price_list_id := C_Price_List_Id;
1531 -- acct_rec.category_code := C_Category_Code;
1532 -- acct_rec.reference_use_flag := C_Reference_Use_Flag;
1533 acct_rec.tax_code := C_Tax_Code;
1534 -- acct_rec.third_party_flag := C_Third_Party_Flag;
1535 -- acct_rec.competitor_flag := c_competitor_flag;
1536 acct_rec.fob_point := C_Fob_Point;
1537 acct_rec.tax_header_level_flag := C_Tax_Header_Level_Flag;
1538 acct_rec.tax_rounding_rule := C_Tax_Rounding_Rule;
1539 acct_rec.primary_specialist_id := NULL;
1540 acct_rec.secondary_specialist_id := NULL;
1541 -- acct_rec.geo_code := NULL;
1542 acct_rec.account_name := c_account_name;
1543 acct_rec.freight_term := C_Freight_Term;
1544 acct_rec.ship_partial := C_Ship_Partial;
1545 acct_rec.ship_via := C_Ship_Via;
1546 acct_rec.warehouse_id := C_Warehouse_Id;
1547 -- acct_rec.payment_term_id := NULL;
1548 acct_rec.account_liable_flag := null;
1549 acct_rec.DATES_NEGATIVE_TOLERANCE := c_DATES_NEGATIVE_TOLERANCE;
1550 acct_rec.DATES_POSITIVE_TOLERANCE := c_DATES_POSITIVE_TOLERANCE;
1551 acct_rec.DATE_TYPE_PREFERENCE := c_DATE_TYPE_PREFERENCE;
1552 acct_rec.OVER_SHIPMENT_TOLERANCE := c_OVER_SHIPMENT_TOLERANCE;
1553 acct_rec.UNDER_SHIPMENT_TOLERANCE := c_UNDER_SHIPMENT_TOLERANCE;
1554 acct_rec.ITEM_CROSS_REF_PREF := c_ITEM_CROSS_REF_PREF;
1555 acct_rec.SHIP_SETS_INCLUDE_LINES_FLAG := c_SHIP_SETS_INCLUDE_LINES_FLAG;
1556 acct_rec.ARRIVALSETS_INCLUDE_LINES_FLAG := c_ARRIVALSETS_INCL_LINES_FLAG;
1557 acct_rec.SCHED_DATE_PUSH_FLAG := c_SCHED_DATE_PUSH_FLAG;
1558 acct_rec.INVOICE_QUANTITY_RULE := c_INVOICE_QUANTITY_RULE;
1559 acct_rec.OVER_RETURN_TOLERANCE := c_OVER_RETURN_TOLERANCE;
1560 acct_rec.UNDER_RETURN_TOLERANCE := c_UNDER_RETURN_TOLERANCE;
1561 acct_rec.created_by_module := 'TCA_FORM_WRAPPER';
1562
1563 person_rec.party_rec.party_id := c_party_id;
1564 person_rec.person_pre_name_adjunct := o_pre_name_adjunct;
1565 person_rec.person_first_name := o_first_name;
1566 person_rec.person_middle_name := o_middle_name;
1567 person_rec.person_last_name := o_last_name;
1568 person_rec.person_name_suffix := o_name_suffix;
1569 person_rec.jgzz_fiscal_code := o_taxpayer_id;
1570 person_rec.person_name_phonetic := o_party_name_phonetic;
1571 person_rec.tax_reference := o_tax_reference;
1572 person_rec.party_rec.party_id := t_party_id;
1573 person_rec.party_rec.party_number := t_party_number;
1574 person_rec.party_rec.validated_flag := NULL;
1575 person_rec.party_rec.orig_system_reference := c_orig_system_reference;
1576 -- person_rec.party_rec.customer_key := t_customer_key;
1577 person_rec.party_rec.attribute_category := t_Attribute_Category;
1578 person_rec.party_rec.attribute1 := t_Attribute1;
1579 person_rec.party_rec.attribute2 := t_Attribute2;
1580 person_rec.party_rec.attribute3 := t_Attribute3;
1581 person_rec.party_rec.attribute4 := t_Attribute4;
1582 person_rec.party_rec.attribute5 := t_Attribute5;
1583 person_rec.party_rec.attribute6 := t_Attribute6;
1584 person_rec.party_rec.attribute7 := t_Attribute7;
1585 person_rec.party_rec.attribute8 := t_attribute8;
1586 person_rec.party_rec.attribute9 := t_Attribute9;
1587 person_rec.party_rec.attribute10 := t_Attribute10;
1588 person_rec.party_rec.attribute11 := t_Attribute11;
1589 person_rec.party_rec.attribute12 := t_Attribute12;
1590 person_rec.party_rec.attribute13 := t_Attribute13;
1591 person_rec.party_rec.attribute14 := t_Attribute14;
1592 person_rec.party_rec.attribute15 := t_Attribute15;
1593 person_rec.party_rec.attribute16 := t_Attribute16;
1594 person_rec.party_rec.attribute17 := t_Attribute17;
1595 person_rec.party_rec.attribute18 := t_Attribute18;
1596 person_rec.party_rec.attribute19 := t_Attribute19;
1597 person_rec.party_rec.attribute20 := t_Attribute20;
1598 person_rec.party_rec.status := null;
1599 person_rec.party_rec.category_code := C_Category_Code;
1600
1601 -- person_rec.party_rec.reference_use_flag := C_Reference_Use_Flag;
1602 -- person_rec.party_rec.third_party_flag := C_Third_Party_Flag;
1603 -- person_rec.party_rec.competitor_flag := c_competitor_flag;
1604 -- person_rec.party_rec.party_id := c_party_id;
1605 -- person_rec.pre_name_adjunct := o_pre_name_adjunct;
1606 -- person_rec.first_name := o_first_name;
1607 -- person_rec.middle_name := o_middle_name;
1608 -- person_rec.last_name := o_last_name;
1609 -- person_rec.name_suffix := o_name_suffix;
1610 -- person_rec.jgzz_fiscal_code := o_taxpayer_id;
1611 -- person_rec.person_name_phonetic := o_party_name_phonetic;
1612
1613 prof_rec.cust_account_profile_id := p_cust_account_profile_id;
1614 prof_rec.cust_account_id := p_cust_account_id;
1615 prof_rec.status := p_status;
1616 prof_rec.collector_id := p_collector_id;
1617 prof_rec.credit_analyst_id := p_credit_analyst_id;
1618 prof_rec.credit_checking := p_credit_checking;
1619 prof_rec.next_credit_review_date := p_next_credit_review_date;
1620 prof_rec.tolerance := p_tolerance;
1621 prof_rec.discount_terms := p_discount_terms;
1622 prof_rec.dunning_letters := p_dunning_letters;
1623 prof_rec.interest_charges := p_interest_charges;
1624 prof_rec.send_statements := p_send_statements;
1625 prof_rec.credit_balance_statements := p_credit_balance_statements;
1626 prof_rec.credit_hold := p_credit_hold;
1627 prof_rec.profile_class_id := p_profile_class_id;
1628 prof_rec.site_use_id := NULL;
1629 prof_rec.credit_rating := p_credit_rating;
1630 prof_rec.risk_code := p_risk_code;
1631 prof_rec.standard_terms := p_standard_terms;
1632 prof_rec.override_terms := p_override_terms;
1633 prof_rec.dunning_letter_set_id := p_dunning_letter_set_id;
1634 prof_rec.interest_period_days := p_interest_period_days;
1635 prof_rec.payment_grace_days := p_payment_grace_days;
1636 prof_rec.discount_grace_days := p_discount_grace_days;
1637 prof_rec.statement_cycle_id := p_statement_cycle_id;
1638 prof_rec.account_status := p_account_status;
1639 prof_rec.percent_collectable := p_percent_collectable;
1640 prof_rec.autocash_hierarchy_id := p_autocash_hierarchy_id;
1641 prof_rec.attribute_category := p_attribute_category;
1642 prof_rec.attribute1 := p_attribute1;
1643 prof_rec.attribute2 := p_attribute2;
1644 prof_rec.attribute3 := p_attribute3;
1645 prof_rec.attribute4 := p_attribute4;
1646 prof_rec.attribute5 := p_attribute5;
1647 prof_rec.attribute6 := p_attribute6;
1648 prof_rec.attribute7 := p_attribute7;
1649 prof_rec.attribute8 := p_attribute8;
1650 prof_rec.attribute9 := p_attribute9;
1651 prof_rec.attribute10 := p_attribute10;
1652 prof_rec.attribute11 := p_attribute11;
1653 prof_rec.attribute12 := p_attribute12;
1654 prof_rec.attribute13 := p_attribute13;
1655 prof_rec.attribute14 := p_attribute14;
1656 prof_rec.attribute15 := p_attribute15;
1657 prof_rec.auto_rec_incl_disputed_flag := p_auto_rec_incl_disputed_flag;
1658 prof_rec.tax_printing_option := p_tax_printing_option;
1659 prof_rec.charge_on_finance_charge_flag := p_charge_on_fin_charge_flag;
1660 prof_rec.grouping_rule_id := p_grouping_rule_id;
1661 prof_rec.clearing_days := p_clearing_days;
1662 prof_rec.jgzz_attribute_category := p_jgzz_attribute_category;
1663 prof_rec.jgzz_attribute1 := p_jgzz_attribute1;
1664 prof_rec.jgzz_attribute2 := p_jgzz_attribute2;
1665 prof_rec.jgzz_attribute3 := p_jgzz_attribute3;
1666 prof_rec.jgzz_attribute4 := p_jgzz_attribute4;
1667 prof_rec.jgzz_attribute5 := p_jgzz_attribute5;
1668 prof_rec.jgzz_attribute6 := p_jgzz_attribute6;
1669 prof_rec.jgzz_attribute7 := p_jgzz_attribute7;
1670 prof_rec.jgzz_attribute8 := p_jgzz_attribute8;
1671 prof_rec.jgzz_attribute9 := p_jgzz_attribute9;
1672 prof_rec.jgzz_attribute10 := p_jgzz_attribute10;
1673 prof_rec.jgzz_attribute11 := p_jgzz_attribute11;
1674 prof_rec.jgzz_attribute12 := p_jgzz_attribute12;
1675 prof_rec.jgzz_attribute13 := p_jgzz_attribute13;
1676 prof_rec.jgzz_attribute14 := p_jgzz_attribute14;
1677 prof_rec.jgzz_attribute15 := p_jgzz_attribute15;
1678 prof_rec.global_attribute1 := p_global_attribute1;
1679 prof_rec.global_attribute2 := p_global_attribute2;
1680 prof_rec.global_attribute3 := p_global_attribute3;
1681 prof_rec.global_attribute4 := p_global_attribute4;
1682 prof_rec.global_attribute5 := p_global_attribute5;
1683 prof_rec.global_attribute6 := p_global_attribute6;
1684 prof_rec.global_attribute7 := p_global_attribute7;
1685 prof_rec.global_attribute8 := p_global_attribute8;
1686 prof_rec.global_attribute9 := p_global_attribute9;
1687 prof_rec.global_attribute10 := p_global_attribute10;
1688 prof_rec.global_attribute11 := p_global_attribute11;
1689 prof_rec.global_attribute12 := p_global_attribute12;
1690 prof_rec.global_attribute13 := p_global_attribute13;
1691 prof_rec.global_attribute14 := p_global_attribute14;
1692 prof_rec.global_attribute15 := p_global_attribute15;
1693 prof_rec.global_attribute16 := p_global_attribute16;
1694 prof_rec.global_attribute17 := p_global_attribute17;
1695 prof_rec.global_attribute18 := p_global_attribute18;
1696 prof_rec.global_attribute19 := p_global_attribute19;
1697 prof_rec.global_attribute20 := p_global_attribute20;
1698 prof_rec.global_attribute_category := p_global_attribute_category;
1699 prof_rec.cons_inv_flag := p_cons_inv_flag;
1700 prof_rec.cons_inv_type := p_cons_inv_type;
1701 prof_rec.autocash_hierarchy_id_for_adr := p_autocash_hier_id_for_adr;
1702 prof_rec.lockbox_matching_option := p_lockbox_matching_option ;
1703 prof_rec.created_by_module := 'TCA_FORM_WRAPPER';
1704 --{2310474
1705 prof_rec.party_id := p_party_id;
1706 prof_rec.review_cycle := p_review_cycle;
1707 prof_rec.credit_classification := p_credit_classification;
1708 prof_rec.last_credit_review_date := p_last_credit_review_date;
1709 --}
1710
1711 ----------------------------------
1712 -- {Create Person Customer Account
1713 ----------------------------------
1714 HZ_CUST_ACCOUNT_V2PUB.create_cust_account (
1715 p_cust_account_rec => acct_rec,
1716 p_person_rec => person_rec,
1717 p_customer_profile_rec => prof_rec,
1718 p_create_profile_amt => FND_API.G_FALSE,
1719 x_cust_account_id => x_customer_id,
1720 x_account_number => x_cust_account_number,
1721 x_party_id => x_party_id,
1722 x_party_number => x_party_number,
1723 x_profile_id => o_person_profile_id,
1724 x_return_status => x_return_status,
1725 x_msg_count => x_msg_count,
1726 x_msg_data => x_msg_data );
1727
1728 IF x_msg_count > 1 THEN
1729 FOR i IN 1..x_msg_count LOOP
1730 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1731 tmp_var1 := tmp_var1 || ' '|| tmp_var;
1732 END LOOP;
1733 x_msg_data := tmp_var1;
1734 END IF;
1735
1736 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1737 return;
1738 END IF;
1739
1740 c_cust_account_id := x_customer_id;
1741 c_party_id := x_party_id;
1742 t_party_number := x_party_number;
1743 c_account_number := x_cust_account_number;
1744
1745
1746 /*Bug 3013045*/
1747 IF l_flag
1748 THEN
1749
1750 object_version_select (
1751 p_table_name => 'HZ_ORG_PERS',
1752 p_col_id => C_Party_Id,
1753 x_rowid => l_party_rowid,
1754 x_object_version_number => l_party_object_version,
1755 x_last_update_date => l_party_last_update_date,
1756 x_id_value => l_dummy_id,
1757 x_return_status => x_return_status,
1758 x_msg_count => x_msg_count,
1759 x_msg_data => x_msg_data
1760 );
1761 IF x_msg_count > 1 THEN
1762 FOR i IN 1..x_msg_count LOOP
1763 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1764 tmp_var1 := tmp_var1 || ' '|| tmp_var;
1765 END LOOP;
1766 x_msg_data := tmp_var1;
1767 END IF;
1768
1769 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1770 return;
1771 END IF;
1772 person_rec_update.party_rec.party_id := INIT_SWITCH(C_Party_Id);
1773 person_rec_update.party_rec.category_code := INIT_SWITCH(C_Category_Code);
1774 person_rec_update.person_name_phonetic := INIT_SWITCH(o_party_name_phonetic);
1775 person_rec_update.person_pre_name_adjunct := INIT_SWITCH(o_pre_name_adjunct);
1776 person_rec_update.person_first_name := INIT_SWITCH(o_first_name);
1777 person_rec_update.person_middle_name := INIT_SWITCH(o_middle_name);
1778 person_rec_update.person_last_name := INIT_SWITCH(o_last_name);
1779 person_rec_update.person_name_suffix := INIT_SWITCH(o_name_suffix);
1780 person_rec_update.tax_reference := INIT_SWITCH(o_tax_reference);
1781 person_rec_update.jgzz_fiscal_code := INIT_SWITCH(o_taxpayer_id);
1782 person_rec_update.content_source_type := NVL(person_rec_update.content_source_type,'USER_ENTERED');
1783
1784 HZ_PARTY_V2PUB.update_person (
1785 p_person_rec => person_rec_update,
1786 p_party_object_version_number => l_party_object_version,
1787 x_profile_id => o_person_profile_id,
1788 x_return_status => x_return_status,
1789 x_msg_count => x_msg_count,
1790 x_msg_data => x_msg_data
1791 );
1792 IF x_msg_count > 1 THEN
1793 FOR i IN 1..x_msg_count LOOP
1794 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1795 tmp_var1 := tmp_var1 || ' '|| tmp_var;
1796 END LOOP;
1797 x_msg_data := tmp_var1;
1798 END IF;
1799
1800 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1801 return;
1802 END IF;
1803 END IF;
1804
1805 /*End bug fix 3013045*/
1806
1807
1808 -------------------
1809 -- Internal Party
1810 -------------------
1811 i_internal_party_id := fnd_profile.value('HZ_INTERNAL_PARTY');
1812
1813 IF i_internal_party_id IS NOT NULL THEN
1814 Ref_Part_Comp
1815 ( c_party_id => c_party_id,
1816 c_party_type => 'PERSON',
1817 i_internal_party_id => i_internal_party_id,
1818 C_Reference_Use_Flag => C_Reference_Use_Flag,
1819 C_Third_Party_Flag => C_Third_Party_Flag,
1820 C_competitor_flag => C_competitor_flag,
1821 x_return_status => x_return_status,
1822 x_msg_count => x_msg_count,
1823 x_msg_data => x_msg_data ,
1824 x_end_date => SYSDATE);
1825
1826 IF x_msg_count > 1 THEN
1827 FOR i IN 1..x_msg_count LOOP
1828 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
1829 tmp_var1 := tmp_var1 || ' '|| tmp_var;
1830 END LOOP;
1831 x_msg_data := tmp_var1;
1832 END IF;
1833
1834 END IF;
1835
1836 END insert_person_row;
1837
1838
1839 PROCEDURE update_row(
1840 c_cust_account_id IN OUT NOCOPY NUMBER ,
1841 c_party_id IN NUMBER,
1842 c_account_number IN VARCHAR2,
1843 c_Attribute_Category IN VARCHAR2,
1844 c_Attribute1 IN VARCHAR2,
1845 c_Attribute2 IN VARCHAR2,
1846 c_Attribute3 IN VARCHAR2,
1847 c_Attribute4 IN VARCHAR2,
1848 c_Attribute5 IN VARCHAR2,
1849 c_Attribute6 IN VARCHAR2,
1850 c_Attribute7 IN VARCHAR2,
1851 c_Attribute8 IN VARCHAR2,
1852 c_Attribute9 IN VARCHAR2,
1853 c_Attribute10 IN VARCHAR2,
1854 c_Attribute11 IN VARCHAR2,
1855 c_Attribute12 IN VARCHAR2,
1856 c_Attribute13 IN VARCHAR2,
1857 c_Attribute14 IN VARCHAR2,
1858 c_Attribute15 IN VARCHAR2,
1859 c_Attribute16 IN VARCHAR2,
1860 c_Attribute17 IN VARCHAR2,
1861 c_Attribute18 IN VARCHAR2,
1862 c_Attribute19 IN VARCHAR2,
1863 c_Attribute20 IN VARCHAR2,
1864 c_global_attribute_category IN VARCHAR2,
1865 c_global_attribute1 IN VARCHAR2,
1866 c_global_attribute2 IN VARCHAR2,
1867 c_global_attribute3 IN VARCHAR2,
1868 c_global_attribute4 IN VARCHAR2,
1869 c_global_attribute5 IN VARCHAR2,
1870 c_global_attribute6 IN VARCHAR2,
1871 c_global_attribute7 IN VARCHAR2,
1872 c_global_attribute8 IN VARCHAR2,
1873 c_global_attribute9 IN VARCHAR2,
1874 c_global_attribute10 IN VARCHAR2,
1875 c_global_attribute11 IN VARCHAR2,
1876 c_global_attribute12 IN VARCHAR2,
1877 c_global_attribute13 IN VARCHAR2,
1878 c_global_attribute14 IN VARCHAR2,
1879 c_global_attribute15 IN VARCHAR2,
1880 c_global_attribute16 IN VARCHAR2,
1881 c_global_attribute17 IN VARCHAR2,
1882 c_global_attribute18 IN VARCHAR2,
1883 c_global_attribute19 IN VARCHAR2,
1884 c_global_attribute20 IN VARCHAR2,
1885 c_orig_system_reference IN VARCHAR2,
1886 c_status IN VARCHAR2,
1887 c_customer_type IN VARCHAR2,
1888 c_customer_class_code IN VARCHAR2,
1889 c_primary_salesrep_id IN NUMBER ,
1890 c_sales_channel_code IN VARCHAR2,
1891 c_order_type_id IN NUMBER,
1892 c_price_list_id IN NUMBER ,
1893 c_category_code IN VARCHAR2,
1894 c_reference_use_flag IN VARCHAR2,
1895 c_tax_code IN VARCHAR2,
1896 c_third_party_flag IN VARCHAR2,
1897 c_competitor_flag IN VARCHAR2,
1898 c_fob_point IN VARCHAR2,
1899 c_tax_header_level_flag IN VARCHAR2,
1900 c_tax_rounding_rule IN VARCHAR2,
1901 c_account_name IN VARCHAR2,
1902 c_freight_term IN VARCHAR2,
1903 c_ship_partial IN VARCHAR2,
1904 c_ship_via IN VARCHAR2,
1905 c_warehouse_id IN NUMBER,
1906 c_payment_term_id IN NUMBER ,
1907 c_analysis_fy IN VARCHAR2,
1908 c_fiscal_yearend_month IN VARCHAR2,
1909 c_employees_total IN NUMBER,
1910 c_cr_fy_potential_revenue IN NUMBER,
1911 c_next_fy_potential_revenue IN NUMBER,
1912 c_tax_reference IN VARCHAR2,
1913 c_year_established IN NUMBER,
1914 c_gsa_indicator_flag IN VARCHAR2,
1915 c_jgzz_fiscal_code IN VARCHAR2,
1916 c_do_not_mail_flag IN VARCHAR2,
1917 c_mission_statement IN VARCHAR2,
1918 c_org_name_phonetic IN VARCHAR2,
1919 c_url IN VARCHAR2,
1920 c_person_suffix IN VARCHAR2,
1921 c_first_name IN VARCHAR2,
1922 c_middle_name IN VARCHAR2,
1923 c_last_name IN VARCHAR2,
1924 c_person_prefix IN VARCHAR2,
1925 c_sic_code IN VARCHAR2,
1926 c_sic_code_type IN VARCHAR2,
1927 c_duns_number IN NUMBER,
1928 c_DATES_NEGATIVE_TOLERANCE IN NUMBER,
1929 c_DATES_POSITIVE_TOLERANCE IN NUMBER,
1930 c_DATE_TYPE_PREFERENCE IN VARCHAR2,
1931 c_OVER_SHIPMENT_TOLERANCE IN NUMBER,
1932 c_UNDER_SHIPMENT_TOLERANCE IN NUMBER,
1933 c_ITEM_CROSS_REF_PREF IN VARCHAR2,
1934 c_OVER_RETURN_TOLERANCE IN NUMBER,
1935 c_UNDER_RETURN_TOLERANCE IN NUMBER,
1936 c_SHIP_SETS_INCLUDE_LINES_FLAG IN VARCHAR2,
1937 c_ARRIVALSETS_INCL_LINES_FLAG IN VARCHAR2,
1938 c_SCHED_DATE_PUSH_FLAG IN VARCHAR2,
1939 c_INVOICE_QUANTITY_RULE IN VARCHAR2,
1940 c_account_alias IN VARCHAR2 DEFAULT NULL,
1941 p_cust_account_profile_id IN NUMBER ,
1942 p_cust_account_id IN NUMBER ,
1943 p_status IN VARCHAR2,
1944 p_collector_id IN NUMBER ,
1945 p_credit_analyst_id IN NUMBER ,
1946 p_credit_checking IN VARCHAR2,
1947 p_next_credit_review_date DATE ,
1948 p_tolerance IN NUMBER,
1949 p_discount_terms IN VARCHAR2,
1950 p_dunning_letters IN VARCHAR2,
1951 p_interest_charges IN VARCHAR2,
1952 p_send_statements IN VARCHAR2,
1953 p_credit_balance_statements IN VARCHAR2,
1954 p_credit_hold IN VARCHAR2,
1955 p_profile_class_id IN NUMBER ,
1956 p_site_use_id IN NUMBER ,
1957 p_credit_rating IN VARCHAR2,
1958 p_risk_code IN VARCHAR2,
1959 p_standard_terms IN NUMBER ,
1960 p_override_terms IN VARCHAR2,
1961 p_dunning_letter_set_id IN NUMBER,
1962 p_interest_period_days IN NUMBER,
1963 p_payment_grace_days IN NUMBER,
1964 p_discount_grace_days IN NUMBER,
1965 p_statement_cycle_id IN NUMBER ,
1966 p_account_status IN VARCHAR2,
1967 p_percent_collectable IN NUMBER ,
1968 p_autocash_hierarchy_id IN NUMBER,
1969 p_Attribute_Category IN VARCHAR2,
1970 p_Attribute1 IN VARCHAR2,
1971 p_Attribute2 IN VARCHAR2,
1972 p_Attribute3 IN VARCHAR2,
1973 p_Attribute4 IN VARCHAR2,
1974 p_Attribute5 IN VARCHAR2,
1975 p_Attribute6 IN VARCHAR2,
1976 p_Attribute7 IN VARCHAR2,
1977 p_Attribute8 IN VARCHAR2,
1978 p_Attribute9 IN VARCHAR2,
1979 p_Attribute10 IN VARCHAR2,
1980 p_Attribute11 IN VARCHAR2,
1981 p_Attribute12 IN VARCHAR2,
1982 p_Attribute13 IN VARCHAR2,
1983 p_Attribute14 IN VARCHAR2,
1984 p_Attribute15 IN VARCHAR2,
1985 p_auto_rec_incl_disputed_flag IN VARCHAR2,
1986 p_tax_printing_option IN VARCHAR2,
1987 p_charge_on_fin_charge_flag IN VARCHAR2,
1988 p_grouping_rule_id IN NUMBER ,
1989 p_clearing_days IN NUMBER,
1990 p_jgzz_attribute_category IN VARCHAR2,
1991 p_jgzz_attribute1 IN VARCHAR2,
1992 p_jgzz_attribute2 IN VARCHAR2,
1993 p_jgzz_attribute3 IN VARCHAR2,
1994 p_jgzz_attribute4 IN VARCHAR2,
1995 p_jgzz_attribute5 IN VARCHAR2,
1996 p_jgzz_attribute6 IN VARCHAR2,
1997 p_jgzz_attribute7 IN VARCHAR2,
1998 p_jgzz_attribute8 IN VARCHAR2,
1999 p_jgzz_attribute9 IN VARCHAR2,
2000 p_jgzz_attribute10 IN VARCHAR2,
2001 p_jgzz_attribute11 IN VARCHAR2,
2002 p_jgzz_attribute12 IN VARCHAR2,
2003 p_jgzz_attribute13 IN VARCHAR2,
2004 p_jgzz_attribute14 IN VARCHAR2,
2005 p_jgzz_attribute15 IN VARCHAR2,
2006 p_global_attribute_category IN VARCHAR2,
2007 p_global_attribute1 IN VARCHAR2,
2008 p_global_attribute2 IN VARCHAR2,
2009 p_global_attribute3 IN VARCHAR2,
2010 p_global_attribute4 IN VARCHAR2,
2011 p_global_attribute5 IN VARCHAR2,
2012 p_global_attribute6 IN VARCHAR2,
2013 p_global_attribute7 IN VARCHAR2,
2014 p_global_attribute8 IN VARCHAR2,
2015 p_global_attribute9 IN VARCHAR2,
2016 p_global_attribute10 IN VARCHAR2,
2017 p_global_attribute11 IN VARCHAR2,
2018 p_global_attribute12 IN VARCHAR2,
2019 p_global_attribute13 IN VARCHAR2,
2020 p_global_attribute14 IN VARCHAR2,
2021 p_global_attribute15 IN VARCHAR2,
2022 p_global_attribute16 IN VARCHAR2,
2023 p_global_attribute17 IN VARCHAR2,
2024 p_global_attribute18 IN VARCHAR2,
2025 p_global_attribute19 IN VARCHAR2,
2026 p_global_attribute20 IN VARCHAR2,
2027 p_cons_inv_flag IN VARCHAR2,
2028 p_cons_inv_type IN VARCHAR2,
2029 p_autocash_hier_id_for_adr IN NUMBER ,
2030 p_lockbox_matching_option IN VARCHAR2,
2031 --{2310474
2032 p_party_id IN NUMBER DEFAULT NULL,
2033 p_review_cycle IN VARCHAR2 DEFAULT NULL,
2034 p_credit_classification IN VARCHAR2 DEFAULT NULL,
2035 p_last_credit_review_date IN DATE DEFAULT NULL,
2036 --}
2037 a_last_update_date IN OUT NOCOPY DATE,
2038 a_object_version IN OUT NOCOPY NUMBER,
2039 p_last_update_date IN OUT NOCOPY DATE,
2040 x_cr_last_update_date IN OUT NOCOPY DATE,
2041 x_pt_last_update_date IN OUT NOCOPY DATE,
2042 x_cp_last_update_date IN OUT NOCOPY DATE,
2043 x_op_last_update_date IN OUT NOCOPY DATE,
2044 x_pp_last_update_date IN OUT NOCOPY DATE,
2045 x_account_type IN VARCHAR,
2046 o_organization_profile_id in out NOCOPY number,
2047 o_person_profile_id in out NOCOPY number,
2048 x_msg_count OUT NOCOPY NUMBER,
2049 x_msg_data OUT NOCOPY varchar2,
2050 x_return_status OUT NOCOPY VARCHAR2,
2051 c_duns_number_c IN VARCHAR2 DEFAULT FND_API.G_MISS_CHAR,
2052 x_cust_acct_object_version IN NUMBER DEFAULT -1,
2053 x_cust_prof_object_version IN NUMBER DEFAULT -1,
2054 x_party_object_version IN NUMBER DEFAULT -1)
2055 IS
2056
2057 -- acct_rec hz_customer_accounts_pub.account_rec_type;
2058 -- prof_rec hz_customer_accounts_pub.cust_profile_rec_type;
2059 -- party_rec hz_party_pub.party_rec_type;
2060 -- prel_rec hz_party_pub.party_rel_rec_type;
2061 -- person_rec hz_party_pub.person_rec_type;
2062 -- org_rec hz_party_pub.organization_rec_type;
2063
2064
2065 acct_rec hz_cust_account_v2pub.cust_account_rec_type;
2066 prof_rec hz_customer_profile_v2pub.customer_profile_rec_type;
2067 party_rec hz_party_v2pub.party_rec_type;
2068 prel_rec hz_relationship_v2pub.relationship_rec_type;
2069 person_rec hz_party_v2pub.person_rec_type;
2070 org_rec hz_party_v2pub.organization_rec_type;
2071
2072 tmp_var VARCHAR2(2000);
2073 i number;
2074 tmp_var1 VARCHAR2(2000);
2075 x_customer_id number;
2076 x_cust_account_number VARCHAR2(100);
2077 x_party_id number;
2078 x_party_number VARCHAR2(100);
2079 x_profile_id number;
2080 x_party_rel_id number;
2081 x_party_rel_last_update_date DATE;
2082 x_party_last_update_date DATE;
2083 x_end_date DATE;
2084 i_internal_party_id number;
2085
2086 cursor C_REFERENCE_FOR is
2087 select relationship_id
2088 from hz_relationships
2089 where subject_id = c_party_id
2090 and relationship_code = 'REFERENCE_FOR'
2091 and subject_table_name = 'HZ_PARTIES'
2092 and object_table_name = 'HZ_PARTIES'
2093 and directional_flag = 'F';
2094
2095 cursor C_PARTNER_OF is
2096 select relationship_id
2097 from hz_relationships
2098 where subject_id = c_party_id
2099 and relationship_code = 'PARTNER_OF'
2100 and subject_table_name = 'HZ_PARTIES'
2101 and object_table_name = 'HZ_PARTIES'
2102 and directional_flag = 'F';
2103
2104 cursor C_COMPETITOR_OF is
2105 select relationship_id
2106 from hz_relationships
2107 where subject_id = c_party_id
2108 and relationship_code = 'COMPETITOR_OF'
2109 and subject_table_name = 'HZ_PARTIES'
2110 and object_table_name = 'HZ_PARTIES'
2111 and directional_flag = 'F';
2112
2113 i_pr_party_relationship_id NUMBER;
2114 i_pr_party_id NUMBER;
2115 i_pr_party_number VARCHAR2(100);
2116
2117 CURSOR cu_cust_acct_version IS
2118 SELECT ROWID,
2119 OBJECT_VERSION_NUMBER,
2120 LAST_UPDATE_DATE
2121 FROM HZ_CUST_ACCOUNTS
2122 WHERE CUST_ACCOUNT_ID = c_cust_account_id;
2123
2124 CURSOR cu_cust_prof_version IS
2125 SELECT ROWID,
2126 OBJECT_VERSION_NUMBER,
2127 LAST_UPDATE_DATE,
2128 CUST_ACCOUNT_ID
2129 FROM HZ_CUSTOMER_PROFILES
2130 WHERE CUST_ACCOUNT_PROFILE_ID = p_cust_account_profile_id;
2131
2132
2133 l_cust_acct_rowid ROWID;
2134 l_cust_acct_object_version NUMBER;
2135 l_cust_acct_last_update_date DATE;
2136 l_dummy_id NUMBER;
2137
2138 l_cust_prof_rowid ROWID;
2139 l_cust_prof_object_version NUMBER;
2140 l_cust_prof_last_update_date DATE;
2141 l_cust_acct_id NUMBER;
2142
2143 l_party_rowid ROWID;
2144 l_party_object_version NUMBER;
2145 l_party_last_update_date DATE;
2146 l_party_id NUMBER;
2147
2148 BEGIN
2149
2150 x_return_status := FND_API.G_RET_STS_SUCCESS;
2151
2152 ---------------------------
2153 --{ Update Customer Account
2154 ---------------------------
2155
2156 IF (a_last_update_date IS NOT NULL ) THEN
2157 --
2158 l_cust_acct_object_version := x_cust_acct_object_version;
2159 IF l_cust_acct_object_version = -1 THEN
2160 object_version_select (
2161 p_table_name => 'HZ_CUST_ACCOUNTS',
2162 p_col_id => c_cust_account_id,
2163 x_rowid => l_cust_acct_rowid,
2164 x_object_version_number => l_cust_acct_object_version,
2165 x_last_update_date => l_cust_acct_last_update_date,
2166 x_id_value => l_dummy_id,
2167 x_return_status => x_return_status,
2168 x_msg_count => x_msg_count,
2169 x_msg_data => x_msg_data
2170 );
2171 IF x_msg_count > 1 THEN
2172 FOR i IN 1..x_msg_count LOOP
2173 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2174 tmp_var1 := tmp_var1 || ' '|| tmp_var;
2175 END LOOP;
2176 x_msg_data := tmp_var1;
2177 END IF;
2178
2179 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2180 return;
2181 END IF;
2182
2183 END IF;
2184 --
2185 acct_rec.cust_account_id := C_Cust_account_Id;
2186 -- acct_rec.party_id := INIT_SWITCH(C_Party_Id);
2187 acct_rec.account_number := INIT_SWITCH(C_account_Number);
2188 acct_rec.attribute_category := INIT_SWITCH(C_Attribute_Category);
2189 acct_rec.attribute1 := INIT_SWITCH(C_Attribute1);
2190 acct_rec.attribute2 := INIT_SWITCH(C_Attribute2);
2191 acct_rec.attribute3 := INIT_SWITCH(C_Attribute3);
2192 acct_rec.attribute4 := INIT_SWITCH(C_Attribute4);
2193 acct_rec.attribute5 := INIT_SWITCH(C_Attribute5);
2194 acct_rec.attribute6 := INIT_SWITCH(C_Attribute6);
2195 acct_rec.attribute7 := INIT_SWITCH(C_Attribute7);
2196 acct_rec.attribute8 := INIT_SWITCH(C_Attribute8);
2197 acct_rec.attribute9 := INIT_SWITCH(C_Attribute9);
2198 acct_rec.attribute10 := INIT_SWITCH(C_Attribute10);
2199 acct_rec.attribute11 := INIT_SWITCH(C_Attribute11);
2200 acct_rec.attribute12 := INIT_SWITCH(C_Attribute12);
2201 acct_rec.attribute13 := INIT_SWITCH(C_Attribute13);
2202 acct_rec.attribute14 := INIT_SWITCH(C_Attribute14);
2203 acct_rec.attribute15 := INIT_SWITCH(C_Attribute15);
2204 acct_rec.attribute16 := INIT_SWITCH(C_Attribute16);
2205 acct_rec.attribute17 := INIT_SWITCH(C_Attribute17);
2206 acct_rec.attribute18 := INIT_SWITCH(C_Attribute18);
2207 acct_rec.attribute19 := INIT_SWITCH(C_Attribute19);
2208 acct_rec.attribute20 := INIT_SWITCH(C_Attribute20);
2209 acct_rec.global_attribute_category := INIT_SWITCH(C_Global_Attribute_Category);
2210 acct_rec.global_attribute1 := INIT_SWITCH(C_Global_Attribute1);
2211 acct_rec.global_attribute2 := INIT_SWITCH(C_Global_Attribute2);
2212 acct_rec.global_attribute3 := INIT_SWITCH(C_Global_Attribute3);
2213 acct_rec.global_attribute4 := INIT_SWITCH(C_Global_Attribute4);
2214 acct_rec.global_attribute5 := INIT_SWITCH(C_Global_Attribute5);
2215 acct_rec.global_attribute6 := INIT_SWITCH(C_Global_Attribute6);
2216 acct_rec.global_attribute7 := INIT_SWITCH(C_Global_Attribute7);
2217 acct_rec.global_attribute8 := INIT_SWITCH(C_Global_Attribute8);
2218 acct_rec.global_attribute9 := INIT_SWITCH(C_Global_Attribute9);
2219 acct_rec.global_attribute10 := INIT_SWITCH(C_Global_Attribute10);
2220 acct_rec.global_attribute11 := INIT_SWITCH(C_Global_Attribute11);
2221 acct_rec.global_attribute12 := INIT_SWITCH(C_Global_Attribute12);
2222 acct_rec.global_attribute13 := INIT_SWITCH(C_Global_Attribute13);
2223 acct_rec.global_attribute14 := INIT_SWITCH(C_Global_Attribute14);
2224 acct_rec.global_attribute15 := INIT_SWITCH(C_Global_Attribute15);
2225 acct_rec.global_attribute16 := INIT_SWITCH(C_Global_Attribute16);
2226 acct_rec.global_attribute17 := INIT_SWITCH(C_Global_Attribute17);
2227 acct_rec.global_attribute18 := INIT_SWITCH(C_Global_Attribute18);
2228 acct_rec.global_attribute19 := INIT_SWITCH(C_Global_Attribute19);
2229 acct_rec.global_attribute20 := INIT_SWITCH(C_Global_Attribute20);
2230 -- acct_rec.orig_system_reference := INIT_SWITCH(C_Orig_System_Reference);
2231 acct_rec.status := INIT_SWITCH(C_Status);
2232 acct_rec.customer_type := INIT_SWITCH(c_customer_type);
2233 acct_rec.customer_class_code := INIT_SWITCH(C_Customer_Class_Code);
2234 acct_rec.primary_salesrep_id := INIT_SWITCH(C_Primary_Salesrep_Id);
2235 acct_rec.sales_channel_code := INIT_SWITCH(C_Sales_Channel_Code);
2236 acct_rec.order_type_id := INIT_SWITCH(C_Order_Type_Id);
2237 acct_rec.price_list_id := INIT_SWITCH(C_Price_List_Id);
2238 -- acct_rec.category_code := INIT_SWITCH(C_Category_Code);
2239 -- acct_rec.reference_use_flag := INIT_SWITCH(C_Reference_Use_Flag);
2240 acct_rec.tax_code := INIT_SWITCH(C_Tax_Code);
2241 -- acct_rec.third_party_flag := INIT_SWITCH(C_Third_Party_Flag);
2242 -- acct_rec.competitor_flag := INIT_SWITCH(c_competitor_flag);
2243 acct_rec.fob_point := INIT_SWITCH(C_Fob_Point);
2244 acct_rec.tax_header_level_flag := INIT_SWITCH(C_Tax_Header_Level_Flag);
2245 acct_rec.tax_rounding_rule := INIT_SWITCH(C_Tax_Rounding_Rule);
2246 acct_rec.primary_specialist_id := NULL;
2247 acct_rec.secondary_specialist_id := NULL;
2248 -- acct_rec.geo_code := NULL;
2249 acct_rec.account_name := INIT_SWITCH(c_account_alias); --c_account_name;
2250 acct_rec.freight_term := INIT_SWITCH(C_Freight_Term);
2251 acct_rec.ship_partial := INIT_SWITCH(C_Ship_Partial);
2252 acct_rec.ship_via := INIT_SWITCH(C_Ship_Via);
2253 acct_rec.warehouse_id := INIT_SWITCH(C_Warehouse_Id);
2254 -- acct_rec.payment_term_id := NULL;
2255 acct_rec.account_liable_flag := null;
2256 acct_rec.DATES_NEGATIVE_TOLERANCE := INIT_SWITCH(c_DATES_NEGATIVE_TOLERANCE);
2257 acct_rec.DATES_POSITIVE_TOLERANCE := INIT_SWITCH(c_DATES_POSITIVE_TOLERANCE);
2258 acct_rec.DATE_TYPE_PREFERENCE := INIT_SWITCH(c_DATE_TYPE_PREFERENCE);
2259 acct_rec.OVER_SHIPMENT_TOLERANCE := INIT_SWITCH(c_OVER_SHIPMENT_TOLERANCE);
2260 acct_rec.UNDER_SHIPMENT_TOLERANCE := INIT_SWITCH(c_UNDER_SHIPMENT_TOLERANCE);
2261 acct_rec.ITEM_CROSS_REF_PREF := INIT_SWITCH(c_ITEM_CROSS_REF_PREF);
2262 acct_rec.SHIP_SETS_INCLUDE_LINES_FLAG := INIT_SWITCH(c_SHIP_SETS_INCLUDE_LINES_FLAG);
2263 acct_rec.ARRIVALSETS_INCLUDE_LINES_FLAG := INIT_SWITCH(c_ARRIVALSETS_INCL_LINES_FLAG);
2264 acct_rec.SCHED_DATE_PUSH_FLAG := INIT_SWITCH(c_SCHED_DATE_PUSH_FLAG);
2265 acct_rec.INVOICE_QUANTITY_RULE := INIT_SWITCH(c_INVOICE_QUANTITY_RULE);
2266 acct_rec.OVER_RETURN_TOLERANCE := INIT_SWITCH(c_OVER_RETURN_TOLERANCE);
2267 acct_rec.UNDER_RETURN_TOLERANCE := INIT_SWITCH(c_UNDER_RETURN_TOLERANCE);
2268
2269 HZ_CUST_ACCOUNT_V2PUB.update_cust_account (
2270 p_cust_account_rec => acct_rec,
2271 p_object_version_number => l_cust_acct_object_version,
2272 x_return_status => x_return_status,
2273 x_msg_count => x_msg_count,
2274 x_msg_data => x_msg_data
2275 );
2276
2277 IF x_msg_count > 1 THEN
2278 FOR i IN 1..x_msg_count LOOP
2279 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2280 tmp_var1 := tmp_var1 || ' '|| tmp_var;
2281 END LOOP;
2282 x_msg_data := tmp_var1;
2283 END IF;
2284
2285 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2286 return;
2287 END IF;
2288
2289 SELECT last_update_date,
2290 object_version_number
2291 INTO a_last_update_date,
2292 a_object_version
2293 FROM hz_cust_accounts
2294 WHERE cust_account_id = c_cust_account_id;
2295 END IF;
2296
2297
2298 ---------------------------
2299 --{ Update Customer Profile
2300 ---------------------------
2301 IF (p_last_update_date is not null) THEN
2302
2303 l_cust_prof_object_version := x_cust_prof_object_version;
2304 IF l_cust_prof_object_version = -1 THEN
2305 object_version_select(
2306 p_table_name => 'HZ_CUSTOMER_PROFILES',
2307 p_col_id => p_cust_account_profile_id,
2308 x_rowid => l_cust_prof_rowid,
2309 x_object_version_number => l_cust_prof_object_version,
2310 x_last_update_date => l_cust_prof_last_update_date,
2311 x_id_value => l_cust_acct_id,
2312 x_return_status => x_return_status,
2313 x_msg_count => x_msg_count,
2314 x_msg_data => x_msg_data );
2315
2316 IF x_msg_count > 1 THEN
2317 FOR i IN 1..x_msg_count LOOP
2318 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2319 tmp_var1 := tmp_var1 || ' '|| tmp_var;
2320 END LOOP;
2321 x_msg_data := tmp_var1;
2322 END IF;
2323
2324 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2325 return;
2326 END IF;
2327
2328 END IF;
2329
2330 prof_rec.cust_account_profile_id := INIT_SWITCH(p_cust_account_profile_id);
2331 prof_rec.cust_account_id := INIT_SWITCH(p_cust_account_id);
2332 prof_rec.status := INIT_SWITCH(p_status);
2333 prof_rec.collector_id := INIT_SWITCH(p_collector_id);
2334 prof_rec.credit_analyst_id := INIT_SWITCH(p_credit_analyst_id);
2335 prof_rec.credit_checking := INIT_SWITCH(p_credit_checking);
2336 prof_rec.next_credit_review_date := INIT_SWITCH(p_next_credit_review_date);
2337 prof_rec.tolerance := INIT_SWITCH(p_tolerance);
2338 prof_rec.discount_terms := INIT_SWITCH(p_discount_terms);
2339 prof_rec.dunning_letters := INIT_SWITCH(p_dunning_letters);
2340 prof_rec.interest_charges := INIT_SWITCH(p_interest_charges);
2341 prof_rec.send_statements := INIT_SWITCH(p_send_statements);
2342 prof_rec.credit_balance_statements := INIT_SWITCH(p_credit_balance_statements);
2343 prof_rec.credit_hold := INIT_SWITCH(p_credit_hold);
2344 prof_rec.profile_class_id := INIT_SWITCH(p_profile_class_id);
2345 prof_rec.site_use_id := INIT_SWITCH(p_site_use_id);
2346 prof_rec.credit_rating := INIT_SWITCH(p_credit_rating);
2347 prof_rec.risk_code := INIT_SWITCH(p_risk_code);
2348 prof_rec.standard_terms := INIT_SWITCH(p_standard_terms);
2349 prof_rec.override_terms := INIT_SWITCH(p_override_terms);
2350 prof_rec.dunning_letter_set_id := INIT_SWITCH(p_dunning_letter_set_id);
2351 prof_rec.interest_period_days := INIT_SWITCH(p_interest_period_days);
2352 prof_rec.payment_grace_days := INIT_SWITCH(p_payment_grace_days);
2353 prof_rec.discount_grace_days := INIT_SWITCH(p_discount_grace_days);
2354 prof_rec.statement_cycle_id := INIT_SWITCH(p_statement_cycle_id);
2355 prof_rec.account_status := INIT_SWITCH(p_account_status);
2356 prof_rec.percent_collectable := INIT_SWITCH(p_percent_collectable);
2357 prof_rec.autocash_hierarchy_id := INIT_SWITCH(p_autocash_hierarchy_id);
2358 prof_rec.attribute_category := INIT_SWITCH(p_attribute_category);
2359 prof_rec.attribute1 := INIT_SWITCH(p_attribute1);
2360 prof_rec.attribute2 := INIT_SWITCH(p_attribute2);
2361 prof_rec.attribute3 := INIT_SWITCH(p_attribute3);
2362 prof_rec.attribute4 := INIT_SWITCH(p_attribute4);
2363 prof_rec.attribute5 := INIT_SWITCH(p_attribute5);
2364 prof_rec.attribute6 := INIT_SWITCH(p_attribute6);
2365 prof_rec.attribute7 := INIT_SWITCH(p_attribute7);
2366 prof_rec.attribute8 := INIT_SWITCH(p_attribute8);
2367 prof_rec.attribute9 := INIT_SWITCH(p_attribute9);
2368 prof_rec.attribute10 := INIT_SWITCH(p_attribute10);
2369 prof_rec.attribute11 := INIT_SWITCH(p_attribute11);
2370 prof_rec.attribute12 := INIT_SWITCH(p_attribute12);
2371 prof_rec.attribute13 := INIT_SWITCH(p_attribute13);
2372 prof_rec.attribute14 := INIT_SWITCH(p_attribute14);
2373 prof_rec.attribute15 := INIT_SWITCH(p_attribute15);
2374 prof_rec.auto_rec_incl_disputed_flag := INIT_SWITCH(p_auto_rec_incl_disputed_flag);
2375 prof_rec.tax_printing_option := INIT_SWITCH(p_tax_printing_option);
2376 prof_rec.charge_on_finance_charge_flag := INIT_SWITCH(p_charge_on_fin_charge_flag);
2377 prof_rec.grouping_rule_id := INIT_SWITCH(p_grouping_rule_id);
2378 prof_rec.clearing_days := INIT_SWITCH(p_clearing_days);
2379 prof_rec.jgzz_attribute_category := INIT_SWITCH(p_jgzz_attribute_category);
2380 prof_rec.jgzz_attribute1 := INIT_SWITCH(p_jgzz_attribute1);
2381 prof_rec.jgzz_attribute2 := INIT_SWITCH(p_jgzz_attribute2);
2382 prof_rec.jgzz_attribute3 := INIT_SWITCH(p_jgzz_attribute3);
2383 prof_rec.jgzz_attribute4 := INIT_SWITCH(p_jgzz_attribute4);
2384 prof_rec.jgzz_attribute5 := INIT_SWITCH(p_jgzz_attribute5);
2385 prof_rec.jgzz_attribute6 := INIT_SWITCH(p_jgzz_attribute6);
2386 prof_rec.jgzz_attribute7 := INIT_SWITCH(p_jgzz_attribute7);
2387 prof_rec.jgzz_attribute8 := INIT_SWITCH(p_jgzz_attribute8);
2388 prof_rec.jgzz_attribute9 := INIT_SWITCH(p_jgzz_attribute9);
2389 prof_rec.jgzz_attribute10 := INIT_SWITCH(p_jgzz_attribute10);
2390 prof_rec.jgzz_attribute11 := INIT_SWITCH(p_jgzz_attribute11);
2391 prof_rec.jgzz_attribute12 := INIT_SWITCH(p_jgzz_attribute12);
2392 prof_rec.jgzz_attribute13 := INIT_SWITCH(p_jgzz_attribute13);
2393 prof_rec.jgzz_attribute14 := INIT_SWITCH(p_jgzz_attribute14);
2394 prof_rec.jgzz_attribute15 := INIT_SWITCH(p_jgzz_attribute15);
2395 prof_rec.global_attribute1 := INIT_SWITCH(p_global_attribute1);
2396 prof_rec.global_attribute2 := INIT_SWITCH(p_global_attribute2);
2397 prof_rec.global_attribute3 := INIT_SWITCH(p_global_attribute3);
2398 prof_rec.global_attribute4 := INIT_SWITCH(p_global_attribute4);
2399 prof_rec.global_attribute5 := INIT_SWITCH(p_global_attribute5);
2400 prof_rec.global_attribute6 := INIT_SWITCH(p_global_attribute6);
2401 prof_rec.global_attribute7 := INIT_SWITCH(p_global_attribute7);
2402 prof_rec.global_attribute8 := INIT_SWITCH(p_global_attribute8);
2403 prof_rec.global_attribute9 := INIT_SWITCH(p_global_attribute9);
2404 prof_rec.global_attribute10 := INIT_SWITCH(p_global_attribute10);
2405 prof_rec.global_attribute11 := INIT_SWITCH(p_global_attribute11);
2406 prof_rec.global_attribute12 := INIT_SWITCH(p_global_attribute12);
2407 prof_rec.global_attribute13 := INIT_SWITCH(p_global_attribute13);
2408 prof_rec.global_attribute14 := INIT_SWITCH(p_global_attribute14);
2409 prof_rec.global_attribute15 := INIT_SWITCH(p_global_attribute15);
2410 prof_rec.global_attribute16 := INIT_SWITCH(p_global_attribute16);
2411 prof_rec.global_attribute17 := INIT_SWITCH(p_global_attribute17);
2412 prof_rec.global_attribute18 := INIT_SWITCH(p_global_attribute18);
2413 prof_rec.global_attribute19 := INIT_SWITCH(p_global_attribute19);
2414 prof_rec.global_attribute20 := INIT_SWITCH(p_global_attribute20);
2415 prof_rec.global_attribute_category := INIT_SWITCH(p_global_attribute_category);
2416 prof_rec.cons_inv_flag := INIT_SWITCH(p_cons_inv_flag);
2417 prof_rec.cons_inv_type := INIT_SWITCH(p_cons_inv_type);
2418 prof_rec.autocash_hierarchy_id_for_adr := INIT_SWITCH(p_autocash_hier_id_for_adr);
2419 prof_rec.lockbox_matching_option := INIT_SWITCH(p_lockbox_matching_option);
2420 --{2310474
2421 prof_rec.party_id := p_party_id;
2422 prof_rec.review_cycle := INIT_SWITCH(p_review_cycle);
2423 prof_rec.credit_classification := INIT_SWITCH(p_credit_classification);
2424 prof_rec.last_credit_review_date := INIT_SWITCH(p_last_credit_review_date);
2425 --}
2426
2427 -- call V2 API.
2428 HZ_CUSTOMER_PROFILE_V2PUB.update_customer_profile (
2429 p_customer_profile_rec => prof_rec,
2430 p_object_version_number => l_cust_prof_object_version,
2431 x_return_status => x_return_status,
2432 x_msg_count => x_msg_count,
2433 x_msg_data => x_msg_data
2434 );
2435
2436 IF x_msg_count > 1 THEN
2437 FOR i IN 1..x_msg_count LOOP
2438 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2439 tmp_var1 := tmp_var1 || ' '|| tmp_var;
2440 END LOOP;
2441 x_msg_data := tmp_var1;
2442 END IF;
2443
2444 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2445 return;
2446 END IF;
2447
2448 SELECT last_update_date INTO p_last_update_date
2449 FROM hz_customer_profiles
2450 WHERE cust_account_profile_id = p_cust_account_profile_id;
2451 END IF;
2452
2453 ----------------------------
2454 --{ Update Party ORG or PERS
2455 ----------------------------
2456 l_party_object_version := x_party_object_version;
2457 IF l_party_object_version = -1 THEN
2458
2459 object_version_select (
2460 p_table_name => 'HZ_ORG_PERS',
2461 p_col_id => C_Party_Id,
2462 x_rowid => l_party_rowid,
2463 x_object_version_number => l_party_object_version,
2464 x_last_update_date => l_party_last_update_date,
2465 x_id_value => l_dummy_id,
2466 x_return_status => x_return_status,
2467 x_msg_count => x_msg_count,
2468 x_msg_data => x_msg_data
2469 );
2470 IF x_msg_count > 1 THEN
2471 FOR i IN 1..x_msg_count LOOP
2472 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2473 tmp_var1 := tmp_var1 || ' '|| tmp_var;
2474 END LOOP;
2475 x_msg_data := tmp_var1;
2476 END IF;
2477
2478 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2479 return;
2480 END IF;
2481
2482 END IF;
2483
2484 IF (x_account_type = 'ORGANIZATION') THEN
2485
2486 org_rec.party_rec.category_code := INIT_SWITCH(C_Category_Code);
2487 -- org_rec.party_rec.reference_use_flag := INIT_SWITCH(C_Reference_Use_Flag);
2488 -- org_rec.party_rec.third_party_flag := INIT_SWITCH(C_Third_Party_Flag);
2489 -- org_rec.party_rec.competitor_flag := INIT_SWITCH(c_competitor_flag);
2490 org_rec.party_rec.party_id := INIT_SWITCH(C_Party_Id);
2491 org_rec.organization_name := INIT_SWITCH(c_account_name);
2492 org_rec.sic_code := INIT_SWITCH(c_sic_code);
2493 org_rec.sic_code_type := INIT_SWITCH(c_sic_code_type);
2494 org_rec.analysis_fy := INIT_SWITCH(c_analysis_fy);
2495 org_rec.fiscal_yearend_month := INIT_SWITCH(c_fiscal_yearend_month);
2496 org_rec.employees_total := INIT_SWITCH(c_employees_total);
2497 org_rec.curr_fy_potential_revenue := INIT_SWITCH(c_cr_fy_potential_revenue);
2498 org_rec.next_fy_potential_revenue := INIT_SWITCH(c_next_fy_potential_revenue);
2499 org_rec.year_established := INIT_SWITCH(c_year_established);
2500 org_rec.gsa_indicator_flag := INIT_SWITCH(c_gsa_indicator_flag);
2501 org_rec.jgzz_fiscal_code := INIT_SWITCH(c_jgzz_fiscal_code);
2502 org_rec.mission_statement := INIT_SWITCH(c_mission_statement);
2503 org_rec.organization_name_phonetic := INIT_SWITCH(c_org_name_phonetic);
2504 -- org_rec.duns_number := INIT_SWITCH(c_duns_number);
2505 org_rec.duns_number_c := INIT_SWITCH(c_duns_number_c);
2506 org_rec.tax_reference := INIT_SWITCH(c_tax_reference);
2507 org_rec.content_source_type := NVL(org_rec.content_source_type,'USER_ENTERED');
2508
2509 HZ_PARTY_V2PUB.update_organization (
2510 p_organization_rec => org_rec,
2511 p_party_object_version_number => l_party_object_version,
2512 x_profile_id => o_organization_profile_id,
2513 x_return_status => x_return_status,
2514 x_msg_count => x_msg_count,
2515 x_msg_data => x_msg_data
2516 );
2517
2518 IF x_msg_count > 1 THEN
2519 FOR i IN 1..x_msg_count LOOP
2520 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2521 tmp_var1 := tmp_var1 || ' '|| tmp_var;
2522 END LOOP;
2523 x_msg_data := tmp_var1;
2524 END IF;
2525
2526 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2527 return;
2528 END IF;
2529
2530
2531 SELECT last_update_date INTO x_op_last_update_date
2532 FROM hz_organization_profiles
2533 WHERE party_id = c_party_id
2534 AND content_source_type = 'USER_ENTERED'
2535 AND organization_profile_id = o_organization_profile_id;
2536
2537 SELECT last_update_date INTO x_pt_last_update_date
2538 FROM hz_parties
2539 WHERE party_id = c_party_id;
2540
2541 ELSIF (x_account_type = 'PERSON') THEN
2542
2543 person_rec.party_rec.party_id := INIT_SWITCH(C_Party_Id);
2544 person_rec.party_rec.category_code := INIT_SWITCH(C_Category_Code);
2545 --Bug Fix 1713617
2546 person_rec.person_name_phonetic := INIT_SWITCH(c_org_name_phonetic);
2547 -- person_rec.party_rec.reference_use_flag:= INIT_SWITCH(C_Reference_Use_Flag);
2548 -- person_rec.party_rec.third_party_flag := INIT_SWITCH(C_Third_Party_Flag);
2549 -- person_rec.party_rec.competitor_flag := INIT_SWITCH(c_competitor_flag);
2550 person_rec.person_pre_name_adjunct := INIT_SWITCH(c_person_prefix);
2551 person_rec.person_first_name := INIT_SWITCH(c_first_name);
2552 person_rec.person_middle_name := INIT_SWITCH(c_middle_name);
2553 person_rec.person_last_name := INIT_SWITCH(c_last_name);
2554 person_rec.person_name_suffix := INIT_SWITCH(c_person_suffix);
2555 person_rec.tax_reference := INIT_SWITCH(c_tax_reference);
2556 person_rec.jgzz_fiscal_code := INIT_SWITCH(c_jgzz_fiscal_code);
2557 person_rec.content_source_type := NVL(person_rec.content_source_type,'USER_ENTERED');
2558
2559 HZ_PARTY_V2PUB.update_person (
2560 p_person_rec => person_rec,
2561 p_party_object_version_number => l_party_object_version,
2562 x_profile_id => o_person_profile_id,
2563 x_return_status => x_return_status,
2564 x_msg_count => x_msg_count,
2565 x_msg_data => x_msg_data
2566 );
2567
2568 IF x_msg_count > 1 THEN
2569 FOR i IN 1..x_msg_count LOOP
2570 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2571 tmp_var1 := tmp_var1 || ' '|| tmp_var;
2572 END LOOP;
2573 x_msg_data := tmp_var1;
2574 END IF;
2575
2576 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2577 return;
2578 END IF;
2579
2580
2581 SELECT last_update_date
2582 INTO x_pp_last_update_date
2583 FROM hz_person_profiles
2584 WHERE party_id = c_party_id
2585 AND content_source_type = 'USER_ENTERED'
2586 AND person_profile_id = o_person_profile_id;
2587
2588 SELECT last_update_date
2589 INTO x_pt_last_update_date
2590 FROM hz_parties
2591 WHERE party_id = c_party_id;
2592
2593 END IF;
2594
2595 i_internal_party_id := fnd_profile.value('HZ_INTERNAL_PARTY');
2596 IF i_internal_party_id IS NOT NULL THEN
2597 x_party_last_update_date := x_pt_last_update_date;
2598 x_end_date := sysdate;
2599
2600 Ref_Part_Comp (
2601 c_party_id => c_party_id,
2602 c_party_type => x_account_type,
2603 i_internal_party_id => i_internal_party_id,
2604 C_Reference_Use_Flag => C_Reference_Use_Flag,
2605 C_Third_Party_Flag => C_Third_Party_Flag,
2606 C_competitor_flag => C_competitor_flag,
2607 x_return_status => x_return_status,
2608 x_msg_count => x_msg_count,
2609 x_msg_data => x_msg_data,
2610 x_end_date => x_end_date );
2611
2612 IF x_msg_count > 1 THEN
2613 FOR i IN 1..x_msg_count LOOP
2614 tmp_var := fnd_msg_pub.get(p_encoded => fnd_api.g_false);
2615 tmp_var1 := tmp_var1 || ' '|| tmp_var;
2616 END LOOP;
2617 x_msg_data := tmp_var1;
2618 END IF;
2619
2620 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2621 return;
2622 END IF;
2623
2624 END IF;
2625
2626 END update_row;
2627
2628 --
2629 -- Overload method for the usage of Object_version_number of V2 uptake project and the bug #1736839
2630 --
2631 PROCEDURE update_row(
2632 c_cust_account_id IN OUT NOCOPY NUMBER ,
2633 c_party_id IN NUMBER,
2634 c_account_number IN VARCHAR2,
2635 c_Attribute_Category IN VARCHAR2,
2636 c_Attribute1 IN VARCHAR2,
2637 c_Attribute2 IN VARCHAR2,
2638 c_Attribute3 IN VARCHAR2,
2639 c_Attribute4 IN VARCHAR2,
2640 c_Attribute5 IN VARCHAR2,
2641 c_Attribute6 IN VARCHAR2,
2642 c_Attribute7 IN VARCHAR2,
2643 c_Attribute8 IN VARCHAR2,
2644 c_Attribute9 IN VARCHAR2,
2645 c_Attribute10 IN VARCHAR2,
2646 c_Attribute11 IN VARCHAR2,
2647 c_Attribute12 IN VARCHAR2,
2648 c_Attribute13 IN VARCHAR2,
2649 c_Attribute14 IN VARCHAR2,
2650 c_Attribute15 IN VARCHAR2,
2651 c_Attribute16 IN VARCHAR2,
2652 c_Attribute17 IN VARCHAR2,
2653 c_Attribute18 IN VARCHAR2,
2654 c_Attribute19 IN VARCHAR2,
2655 c_Attribute20 IN VARCHAR2,
2656 c_global_attribute_category IN VARCHAR2,
2657 c_global_attribute1 IN VARCHAR2,
2658 c_global_attribute2 IN VARCHAR2,
2659 c_global_attribute3 IN VARCHAR2,
2660 c_global_attribute4 IN VARCHAR2,
2661 c_global_attribute5 IN VARCHAR2,
2662 c_global_attribute6 IN VARCHAR2,
2663 c_global_attribute7 IN VARCHAR2,
2664 c_global_attribute8 IN VARCHAR2,
2665 c_global_attribute9 IN VARCHAR2,
2666 c_global_attribute10 IN VARCHAR2,
2667 c_global_attribute11 IN VARCHAR2,
2668 c_global_attribute12 IN VARCHAR2,
2669 c_global_attribute13 IN VARCHAR2,
2670 c_global_attribute14 IN VARCHAR2,
2671 c_global_attribute15 IN VARCHAR2,
2672 c_global_attribute16 IN VARCHAR2,
2673 c_global_attribute17 IN VARCHAR2,
2674 c_global_attribute18 IN VARCHAR2,
2675 c_global_attribute19 IN VARCHAR2,
2676 c_global_attribute20 IN VARCHAR2,
2677 c_orig_system_reference IN VARCHAR2,
2678 c_status IN VARCHAR2,
2679 c_customer_type IN VARCHAR2,
2680 c_customer_class_code IN VARCHAR2,
2681 c_primary_salesrep_id IN NUMBER ,
2682 c_sales_channel_code IN VARCHAR2,
2683 c_order_type_id IN NUMBER,
2684 c_price_list_id IN NUMBER ,
2685 c_category_code IN VARCHAR2,
2686 c_reference_use_flag IN VARCHAR2,
2687 c_tax_code IN VARCHAR2,
2688 c_third_party_flag IN VARCHAR2,
2689 c_competitor_flag IN VARCHAR2,
2690 c_fob_point IN VARCHAR2,
2691 c_tax_header_level_flag IN VARCHAR2,
2692 c_tax_rounding_rule IN VARCHAR2,
2693 c_account_name IN VARCHAR2,
2694 c_freight_term IN VARCHAR2,
2695 c_ship_partial IN VARCHAR2,
2696 c_ship_via IN VARCHAR2,
2697 c_warehouse_id IN NUMBER,
2698 c_payment_term_id IN NUMBER ,
2699 c_analysis_fy IN VARCHAR2,
2700 c_fiscal_yearend_month IN VARCHAR2,
2701 c_employees_total IN NUMBER,
2702 c_cr_fy_potential_revenue IN NUMBER,
2703 c_next_fy_potential_revenue IN NUMBER,
2704 c_tax_reference IN VARCHAR2,
2705 c_year_established IN NUMBER,
2706 c_gsa_indicator_flag IN VARCHAR2,
2707 c_jgzz_fiscal_code IN VARCHAR2,
2708 c_do_not_mail_flag IN VARCHAR2,
2709 c_mission_statement IN VARCHAR2,
2710 c_org_name_phonetic IN VARCHAR2,
2711 c_url IN VARCHAR2,
2712 c_person_suffix IN VARCHAR2,
2713 c_first_name IN VARCHAR2,
2714 c_middle_name IN VARCHAR2,
2715 c_last_name IN VARCHAR2,
2716 c_person_prefix IN VARCHAR2,
2717 c_sic_code IN VARCHAR2,
2718 c_sic_code_type IN VARCHAR2,
2719 c_duns_number IN NUMBER,
2720 c_DATES_NEGATIVE_TOLERANCE IN NUMBER,
2721 c_DATES_POSITIVE_TOLERANCE IN NUMBER,
2722 c_DATE_TYPE_PREFERENCE IN VARCHAR2,
2723 c_OVER_SHIPMENT_TOLERANCE IN NUMBER,
2724 c_UNDER_SHIPMENT_TOLERANCE IN NUMBER,
2725 c_ITEM_CROSS_REF_PREF IN VARCHAR2,
2726 c_OVER_RETURN_TOLERANCE IN NUMBER,
2727 c_UNDER_RETURN_TOLERANCE IN NUMBER,
2728 c_SHIP_SETS_INCLUDE_LINES_FLAG IN VARCHAR2,
2729 c_ARRIVALSETS_INCL_LINES_FLAG IN VARCHAR2,
2730 c_SCHED_DATE_PUSH_FLAG IN VARCHAR2,
2731 c_INVOICE_QUANTITY_RULE IN VARCHAR2,
2732 c_account_alias IN VARCHAR2 DEFAULT NULL,
2733 p_cust_account_profile_id IN NUMBER ,
2734 p_cust_account_id IN NUMBER ,
2735 p_status IN VARCHAR2,
2736 p_collector_id IN NUMBER ,
2737 p_credit_analyst_id IN NUMBER ,
2738 p_credit_checking IN VARCHAR2,
2739 p_next_credit_review_date DATE ,
2740 p_tolerance IN NUMBER,
2741 p_discount_terms IN VARCHAR2,
2742 p_dunning_letters IN VARCHAR2,
2743 p_interest_charges IN VARCHAR2,
2744 p_send_statements IN VARCHAR2,
2745 p_credit_balance_statements IN VARCHAR2,
2746 p_credit_hold IN VARCHAR2,
2747 p_profile_class_id IN NUMBER ,
2748 p_site_use_id IN NUMBER ,
2749 p_credit_rating IN VARCHAR2,
2750 p_risk_code IN VARCHAR2,
2751 p_standard_terms IN NUMBER ,
2752 p_override_terms IN VARCHAR2,
2753 p_dunning_letter_set_id IN NUMBER,
2754 p_interest_period_days IN NUMBER,
2755 p_payment_grace_days IN NUMBER,
2756 p_discount_grace_days IN NUMBER,
2757 p_statement_cycle_id IN NUMBER ,
2758 p_account_status IN VARCHAR2,
2759 p_percent_collectable IN NUMBER ,
2760 p_autocash_hierarchy_id IN NUMBER,
2761 p_Attribute_Category IN VARCHAR2,
2762 p_Attribute1 IN VARCHAR2,
2763 p_Attribute2 IN VARCHAR2,
2764 p_Attribute3 IN VARCHAR2,
2765 p_Attribute4 IN VARCHAR2,
2766 p_Attribute5 IN VARCHAR2,
2767 p_Attribute6 IN VARCHAR2,
2768 p_Attribute7 IN VARCHAR2,
2769 p_Attribute8 IN VARCHAR2,
2770 p_Attribute9 IN VARCHAR2,
2771 p_Attribute10 IN VARCHAR2,
2772 p_Attribute11 IN VARCHAR2,
2773 p_Attribute12 IN VARCHAR2,
2774 p_Attribute13 IN VARCHAR2,
2775 p_Attribute14 IN VARCHAR2,
2776 p_Attribute15 IN VARCHAR2,
2777 p_auto_rec_incl_disputed_flag IN VARCHAR2,
2778 p_tax_printing_option IN VARCHAR2,
2779 p_charge_on_fin_charge_flag IN VARCHAR2,
2780 p_grouping_rule_id IN NUMBER ,
2781 p_clearing_days IN NUMBER,
2782 p_jgzz_attribute_category IN VARCHAR2,
2783 p_jgzz_attribute1 IN VARCHAR2,
2784 p_jgzz_attribute2 IN VARCHAR2,
2785 p_jgzz_attribute3 IN VARCHAR2,
2786 p_jgzz_attribute4 IN VARCHAR2,
2787 p_jgzz_attribute5 IN VARCHAR2,
2788 p_jgzz_attribute6 IN VARCHAR2,
2789 p_jgzz_attribute7 IN VARCHAR2,
2790 p_jgzz_attribute8 IN VARCHAR2,
2791 p_jgzz_attribute9 IN VARCHAR2,
2792 p_jgzz_attribute10 IN VARCHAR2,
2793 p_jgzz_attribute11 IN VARCHAR2,
2794 p_jgzz_attribute12 IN VARCHAR2,
2795 p_jgzz_attribute13 IN VARCHAR2,
2796 p_jgzz_attribute14 IN VARCHAR2,
2797 p_jgzz_attribute15 IN VARCHAR2,
2798 p_global_attribute_category IN VARCHAR2,
2799 p_global_attribute1 IN VARCHAR2,
2800 p_global_attribute2 IN VARCHAR2,
2801 p_global_attribute3 IN VARCHAR2,
2802 p_global_attribute4 IN VARCHAR2,
2803 p_global_attribute5 IN VARCHAR2,
2804 p_global_attribute6 IN VARCHAR2,
2805 p_global_attribute7 IN VARCHAR2,
2806 p_global_attribute8 IN VARCHAR2,
2807 p_global_attribute9 IN VARCHAR2,
2808 p_global_attribute10 IN VARCHAR2,
2809 p_global_attribute11 IN VARCHAR2,
2810 p_global_attribute12 IN VARCHAR2,
2811 p_global_attribute13 IN VARCHAR2,
2812 p_global_attribute14 IN VARCHAR2,
2813 p_global_attribute15 IN VARCHAR2,
2814 p_global_attribute16 IN VARCHAR2,
2815 p_global_attribute17 IN VARCHAR2,
2816 p_global_attribute18 IN VARCHAR2,
2817 p_global_attribute19 IN VARCHAR2,
2818 p_global_attribute20 IN VARCHAR2,
2819 p_cons_inv_flag IN VARCHAR2,
2820 p_cons_inv_type IN VARCHAR2,
2821 p_autocash_hier_id_for_adr IN NUMBER ,
2822 p_lockbox_matching_option IN VARCHAR2,
2823 --{2310474
2824 p_party_id IN NUMBER DEFAULT NULL,
2825 p_review_cycle IN VARCHAR2 DEFAULT NULL,
2826 p_credit_classification IN VARCHAR2 DEFAULT NULL,
2827 p_last_credit_review_date IN DATE DEFAULT NULL,
2828 --}
2829 a_last_update_date IN OUT NOCOPY DATE,
2830 p_last_update_date IN OUT NOCOPY DATE,
2831 x_cr_last_update_date IN OUT NOCOPY DATE,
2832 x_pt_last_update_date IN OUT NOCOPY DATE,
2833 x_cp_last_update_date IN OUT NOCOPY DATE,
2834 x_op_last_update_date IN OUT NOCOPY DATE,
2835 x_pp_last_update_date IN OUT NOCOPY DATE,
2836 x_account_type IN VARCHAR,
2837 o_organization_profile_id in out NOCOPY number,
2838 o_person_profile_id in out NOCOPY number,
2839 x_msg_count OUT NOCOPY NUMBER,
2840 x_msg_data OUT NOCOPY varchar2,
2841 x_return_status OUT NOCOPY VARCHAR2,
2842 c_duns_number_c IN VARCHAR2 DEFAULT FND_API.G_MISS_CHAR,
2843 x_cust_acct_object_version IN NUMBER DEFAULT -1,
2844 x_cust_prof_object_version IN NUMBER DEFAULT -1,
2845 x_party_object_version IN NUMBER DEFAULT -1)
2846 IS
2847 l_object_version number;
2848 begin
2849 update_row(
2850 c_cust_account_id ,
2851 c_party_id ,
2852 c_account_number ,
2853 c_Attribute_Category ,
2854 c_Attribute1 ,
2855 c_Attribute2 ,
2856 c_Attribute3 ,
2857 c_Attribute4 ,
2858 c_Attribute5 ,
2859 c_Attribute6 ,
2860 c_Attribute7 ,
2861 c_Attribute8 ,
2862 c_Attribute9 ,
2863 c_Attribute10 ,
2864 c_Attribute11 ,
2865 c_Attribute12 ,
2866 c_Attribute13 ,
2867 c_Attribute14 ,
2868 c_Attribute15 ,
2869 c_Attribute16 ,
2870 c_Attribute17 ,
2871 c_Attribute18 ,
2872 c_Attribute19 ,
2873 c_Attribute20 ,
2874 c_global_attribute_category,
2875 c_global_attribute1 ,
2876 c_global_attribute2 ,
2877 c_global_attribute3 ,
2878 c_global_attribute4 ,
2879 c_global_attribute5 ,
2880 c_global_attribute6 ,
2881 c_global_attribute7 ,
2882 c_global_attribute8 ,
2883 c_global_attribute9 ,
2884 c_global_attribute10 ,
2885 c_global_attribute11 ,
2886 c_global_attribute12 ,
2887 c_global_attribute13 ,
2888 c_global_attribute14 ,
2889 c_global_attribute15 ,
2890 c_global_attribute16 ,
2891 c_global_attribute17 ,
2892 c_global_attribute18 ,
2893 c_global_attribute19 ,
2894 c_global_attribute20 ,
2895 c_orig_system_reference ,
2896 c_status ,
2897 c_customer_type ,
2898 c_customer_class_code,
2899 c_primary_salesrep_id,
2900 c_sales_channel_code ,
2901 c_order_type_id ,
2902 c_price_list_id ,
2903 c_category_code ,
2904 c_reference_use_flag ,
2905 c_tax_code ,
2906 c_third_party_flag ,
2907 c_competitor_flag ,
2908 c_fob_point ,
2909 c_tax_header_level_flag,
2910 c_tax_rounding_rule ,
2911 c_account_name ,
2912 c_freight_term ,
2913 c_ship_partial ,
2914 c_ship_via ,
2915 c_warehouse_id ,
2916 c_payment_term_id ,
2917 c_analysis_fy ,
2918 c_fiscal_yearend_month,
2919 c_employees_total ,
2920 c_cr_fy_potential_revenue,
2921 c_next_fy_potential_revenue,
2922 c_tax_reference ,
2923 c_year_established ,
2924 c_gsa_indicator_flag ,
2925 c_jgzz_fiscal_code ,
2926 c_do_not_mail_flag ,
2927 c_mission_statement ,
2928 c_org_name_phonetic ,
2929 c_url ,
2930 c_person_suffix ,
2931 c_first_name ,
2932 c_middle_name ,
2933 c_last_name ,
2934 c_person_prefix ,
2935 c_sic_code ,
2936 c_sic_code_type ,
2937 c_duns_number ,
2938 c_DATES_NEGATIVE_TOLERANCE,
2939 c_DATES_POSITIVE_TOLERANCE,
2940 c_DATE_TYPE_PREFERENCE,
2941 c_OVER_SHIPMENT_TOLERANCE,
2942 c_UNDER_SHIPMENT_TOLERANCE,
2943 c_ITEM_CROSS_REF_PREF,
2944 c_OVER_RETURN_TOLERANCE,
2945 c_UNDER_RETURN_TOLERANCE,
2946 c_SHIP_SETS_INCLUDE_LINES_FLAG,
2947 c_ARRIVALSETS_INCL_LINES_FLAG,
2948 c_SCHED_DATE_PUSH_FLAG,
2949 c_INVOICE_QUANTITY_RULE,
2950 c_account_alias ,
2951 p_cust_account_profile_id,
2952 p_cust_account_id ,
2953 p_status ,
2954 p_collector_id ,
2955 p_credit_analyst_id ,
2956 p_credit_checking ,
2957 p_next_credit_review_date,
2958 p_tolerance ,
2959 p_discount_terms ,
2960 p_dunning_letters ,
2961 p_interest_charges ,
2962 p_send_statements ,
2963 p_credit_balance_statements,
2964 p_credit_hold ,
2965 p_profile_class_id ,
2966 p_site_use_id ,
2967 p_credit_rating ,
2968 p_risk_code ,
2969 p_standard_terms ,
2970 p_override_terms ,
2971 p_dunning_letter_set_id,
2972 p_interest_period_days,
2973 p_payment_grace_days ,
2974 p_discount_grace_days ,
2975 p_statement_cycle_id ,
2976 p_account_status ,
2977 p_percent_collectable ,
2978 p_autocash_hierarchy_id,
2979 p_Attribute_Category ,
2980 p_Attribute1 ,
2981 p_Attribute2 ,
2982 p_Attribute3 ,
2983 p_Attribute4 ,
2984 p_Attribute5 ,
2985 p_Attribute6 ,
2986 p_Attribute7 ,
2987 p_Attribute8 ,
2988 p_Attribute9 ,
2989 p_Attribute10 ,
2990 p_Attribute11 ,
2991 p_Attribute12 ,
2992 p_Attribute13 ,
2993 p_Attribute14 ,
2994 p_Attribute15 ,
2995 p_auto_rec_incl_disputed_flag,
2996 p_tax_printing_option ,
2997 p_charge_on_fin_charge_flag,
2998 p_grouping_rule_id ,
2999 p_clearing_days ,
3000 p_jgzz_attribute_category,
3001 p_jgzz_attribute1 ,
3002 p_jgzz_attribute2 ,
3003 p_jgzz_attribute3 ,
3004 p_jgzz_attribute4 ,
3005 p_jgzz_attribute5 ,
3006 p_jgzz_attribute6 ,
3007 p_jgzz_attribute7 ,
3008 p_jgzz_attribute8 ,
3009 p_jgzz_attribute9 ,
3010 p_jgzz_attribute10 ,
3011 p_jgzz_attribute11 ,
3012 p_jgzz_attribute12 ,
3013 p_jgzz_attribute13 ,
3014 p_jgzz_attribute14 ,
3015 p_jgzz_attribute15 ,
3016 p_global_attribute_category,
3017 p_global_attribute1 ,
3018 p_global_attribute2 ,
3019 p_global_attribute3 ,
3020 p_global_attribute4 ,
3021 p_global_attribute5 ,
3022 p_global_attribute6 ,
3023 p_global_attribute7 ,
3024 p_global_attribute8 ,
3025 p_global_attribute9 ,
3026 p_global_attribute10 ,
3027 p_global_attribute11 ,
3028 p_global_attribute12 ,
3029 p_global_attribute13 ,
3030 p_global_attribute14 ,
3031 p_global_attribute15 ,
3032 p_global_attribute16 ,
3033 p_global_attribute17 ,
3034 p_global_attribute18 ,
3035 p_global_attribute19 ,
3036 p_global_attribute20 ,
3037 p_cons_inv_flag ,
3038 p_cons_inv_type ,
3039 p_autocash_hier_id_for_adr,
3040 p_lockbox_matching_option ,
3041 --{2310474
3042 p_party_id,
3043 p_review_cycle,
3044 p_credit_classification,
3045 p_last_credit_review_date,
3046 --}
3047 a_last_update_date ,
3048 l_object_version ,
3049 p_last_update_date ,
3050 x_cr_last_update_date ,
3051 x_pt_last_update_date ,
3052 x_cp_last_update_date ,
3053 x_op_last_update_date ,
3054 x_pp_last_update_date ,
3055 x_account_type ,
3056 o_organization_profile_id,
3057 o_person_profile_id ,
3058 x_msg_count ,
3059 x_msg_data ,
3060 x_return_status ,
3061 c_duns_number_c ,
3062 x_cust_acct_object_version,
3063 x_cust_prof_object_version,
3064 x_party_object_version );
3065
3066 END;
3067
3068
3069 --
3070 -- PROCEDURE
3071 -- check_unique_party_number
3072 --
3073 -- DESCRIPTION
3074 -- RRaise error if party number is duplicate
3075 --
3076 -- SCOPE - PUBLIC
3077 --
3078 -- EXETERNAL PROCEDURES/FUNCTIONS ACCESSED
3079 --
3080 -- ARGUMENTS : IN:
3081 -- - p_rowid - rowid of row
3082 -- - p_party_number
3083 --
3084 -- OUT:
3085 --
3086 -- RETURNS null
3087 --
3088 -- NOTES
3089 --
3090 --
3091 procedure check_unique_party_number(p_rowid in varchar2,
3092 p_party_number in varchar2
3093 ) is
3094 dummy number;
3095 begin
3096
3097 select 1
3098 into dummy
3099 from dual
3100 where not exists ( select 1
3101 from hz_parties
3102 where party_number = p_party_number
3103 and ( ( p_rowid is null ) or (rowid <> p_rowid))
3104 );
3105
3106 exception
3107 when NO_DATA_FOUND then
3108 fnd_message.set_name ('AR','AR_PARTY_NUMBER_EXISTS');
3109 app_exception.raise_exception;
3110 end check_unique_party_number;
3111 --
3112 --
3113
3114
3115 END hz_acct_create_pkg;