[Home] [Help]
PACKAGE BODY: APPS.AR_TRANSACTION_GRP
Source
1 PACKAGE BODY AR_TRANSACTION_GRP AS
2 /* $Header: ARXGTRXB.pls 120.5.12020000.2 2012/11/29 19:16:53 ankuagar ship $ */
3
4 pg_debug CONSTANT VARCHAR2(1) := nvl(fnd_profile.value('AFLOG_ENABLED'),'N');
5 G_PKG_NAME CONSTANT VARCHAR2(30) := 'AR_TRANSACTION_GRP';
6 G_MODULE_NAME CONSTANT VARCHAR2(30) := 'AR.PLSQL.AR_TRANSACTION_GRP' ;
7
8 --Private procedures
9
10 /*===========================================================================+
11 | PROCEDURE |
12 | trx_debug |
13 | |
14 | DESCRIPTION |
15 | Wrapper procedure so that it becomes easy to convert to logging |
16 | infrastructure later if needed |
17 | |
18 | SCOPE - PRIVATE |
19 | |
20 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED |
21 | None |
22 | |
23 | ARGUMENTS : |
24 | IN: |
25 | p_message_name |
29 | None |
26 | OUT: |
27 | None |
28 | IN/ OUT: |
30 | |
31 | RETURNS : NONE |
32 | |
33 | NOTES |
34 | |
35 | MODIFICATION HISTORY |
36 | |
37 +===========================================================================*/
38 PROCEDURE trx_debug( p_message_name IN VARCHAR2) IS
39
40 BEGIN
41 arp_util.debug(p_message_name);
42 END trx_debug;
43
44 /*===========================================================================+
45 | PROCEDURE |
46 | fetch_trx_type |
47 | |
48 | DESCRIPTION |
49 | Fetches a record from ra_cust_trx_type for a customer_trx_id |
50 | |
51 | SCOPE - PRIVATE |
52 | |
53 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED |
54 | None |
55 | |
56 | ARGUMENTS : |
57 | IN: |
58 | p_customer_trx_id |
59 | OUT: |
60 | p_trx_type_rec |
61 | IN/ OUT: |
62 | None
63 | |
64 | RETURNS : NONE |
65 | |
66 | NOTES |
67 | |
68 | MODIFICATION HISTORY |
69 | |
70 +===========================================================================*/
71
72 PROCEDURE fetch_trx_type( p_trx_type_rec OUT NOCOPY ra_cust_trx_types%rowtype,
73 p_customer_trx_id IN ra_customer_trx.customer_trx_id%type,
74 x_return_status OUT NOCOPY VARCHAR2
75 )
76 IS
77 BEGIN
78 x_return_status := FND_API.G_RET_STS_SUCCESS;
79 SELECT trxtype.type,
80 trxtype.name,
81 trxtype.allow_overapplication_flag ,
82 trxtype.natural_application_only_flag,
83 trxtype.creation_sign
84 INTO p_trx_type_rec.type,
85 p_trx_type_rec.name,
86 p_trx_type_rec.allow_overapplication_flag,
87 p_trx_type_rec.natural_application_only_flag,
88 p_trx_type_rec.creation_sign
89 FROM ra_cust_trx_types trxtype, ra_customer_trx header
90 WHERE header.customer_trx_id = p_customer_trx_id
91 AND trxtype.cust_trx_type_id = header.cust_trx_type_id;
92
93 EXCEPTION
94 WHEN OTHERS THEN
95 x_return_status := FND_API.G_RET_STS_ERROR ;
96 IF pg_debug = 'Y' THEN
97 trx_debug ('Exception: ar_transaction_grp.fetch_trx_type' ||sqlerrm);
98 END IF;
99 END fetch_trx_type;
100
101
102 --Public procedures
103 /*===========================================================================+
104 | PROCEDURE |
105 | Complete_Transaction |
106 | |
107 | DESCRIPTION |
108 | Completes the transaction after the following checks |
109 | 1. Validate Tax enforcement |
110 | 2. Validate if transaction can be completed |
111 | 3. Perform document sequence number handling |
112 | 4. If all fine then update ra_customer_trx with complete_flag =Y|
113 | and call to maintain the payment schedules |
114 | |
115 | SCOPE - PUBLIC |
116 | |
117 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED |
118 | arp_ct_pkg.lock_fetch_p |
119 | arp_trx_complete_chk.do_completion_checking |
120 | FND_SEQNUM.GET_SEQ_VAL |
121 | arp_ct_pkg.update_p |
122 | ARP_PROCESS_HEADER_POST_COMMIT.post_commit |
123 | |
124 | ARGUMENTS : |
125 | IN: |
126 | p_api_version |
127 | p_init_msg_list |
128 | p_commit |
129 | p_validation_level |
130 | p_customer_trx_id |
131 | OUT: |
132 | x_return_status |
133 | x_msg_count |
134 | x_mssg_data |
135 | IN/ OUT: |
136 | None
137 | |
138 | RETURNS : NONE |
139 | |
140 | NOTES |
141 | |
142 | MODIFICATION HISTORY |
143 | |
144 +===========================================================================*/
145
146 PROCEDURE COMPLETE_TRANSACTION(
147 p_api_version IN NUMBER,
148 p_init_msg_list IN VARCHAR2 := NULL,
149 p_commit IN VARCHAR2 := NULL,
150 p_validation_level IN NUMBER := NULL,
151 p_customer_trx_id IN ra_customer_trx.customer_trx_id%type,
152 x_return_status OUT NOCOPY VARCHAR2,
153 x_msg_count OUT NOCOPY NUMBER,
154 x_msg_data OUT NOCOPY VARCHAR2) IS
155
156 l_api_name CONSTANT VARCHAR2(30) := 'COMPLETE_TRANSACTION';
157 l_api_version CONSTANT NUMBER := 1.0;
158
159 l_trx_rec ra_customer_trx%rowtype;
160 l_trx_type_rec ra_cust_trx_types%rowtype;
161 l_doc_sequence_id ra_customer_trx.doc_sequence_id%TYPE;
162 l_doc_sequence_value ra_customer_trx.doc_sequence_value%TYPE;
163 l_line_number NUMBER;
164 l_gl_tax_code VARCHAR2(50);
165 l_validation_status BOOLEAN;
166 l_error_count NUMBER;
167 l_status NUMBER;
168 l_copy_doc_num_flag VARCHAR2(1);
169 l_unique_seq_number VARCHAR2(255);
170 l_so_source_code VARCHAR2(255);
171 l_init_msg_list VARCHAR2(1);
172 l_commit VARCHAR2(1);
173 l_validation_level NUMBER;
174
175 BEGIN
176
177 /*-------------------------------------------+
178 | Initialize local variables |
179 +-------------------------------------------*/
180 IF p_commit = NULL THEN
181 l_commit := FND_API.G_FALSE;
182 ELSE
183 l_commit := p_commit;
184 END IF;
185
186 IF p_init_msg_list = NULL THEN
187 l_init_msg_list := FND_API.G_FALSE;
188 ELSE
189 l_init_msg_list := p_init_msg_list;
190 END IF;
191
192 IF p_validation_level = NULL THEN
193 l_validation_level := FND_API.G_VALID_LEVEL_FULL;
194 ELSE
195 l_validation_level := p_validation_level;
196 END IF;
197
198 l_unique_seq_number := fnd_profile.value('UNIQUE:SEQ_NUMBERS');
199 l_so_source_code := oe_profile.value('SO_SOURCE_CODE');
200
201 --------------------------------------------------------------
202 IF pg_debug = 'Y' THEN
203 trx_debug ('AR_TRANSACTION_GRP.COMPLETE_TRANSACTION(+)');
204 END IF;
205
206 SAVEPOINT Complete_Transaction;
207 /*--------------------------------------------------+
208 | Standard call to check for call compatibility |
209 +--------------------------------------------------*/
210
211 IF NOT FND_API.Compatible_API_Call(
212 l_api_version,
213 p_api_version,
214 l_api_name,
215 G_PKG_NAME) THEN
216 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
217 END IF;
218
219 /*--------------------------------------------------------------+
220 | Initialize message list if l_init_msg_list is set to TRUE |
221 +--------------------------------------------------------------*/
222
223 IF FND_API.to_Boolean( l_init_msg_list ) THEN
224 FND_MSG_PUB.initialize;
225 END IF;
226
227 /*-----------------------------------------+
228 | Initialize return status to SUCCESS |
229 +-----------------------------------------*/
230 x_return_status := FND_API.G_RET_STS_SUCCESS;
231
232
233 /*-----------------------------------------------------+
234 | Lock and fetch the header record for customer trx id |
235 +-----------------------------------------------------*/
236 IF pg_debug = 'Y' THEN
237 trx_debug ('Calling ar_ct_pkg.lock_fetch_p(+) ');
238 END IF;
239
240 arp_ct_pkg.lock_fetch_p (l_trx_rec,
241 p_customer_trx_id);
242
243 IF pg_debug = 'Y' THEN
244 trx_debug ('ar_ct_pkg.lock_fetch_p(-) ');
245 END IF;
246
247 /*----------------------------------------------+
248 | Get the transaction type for trx type id |
249 +----------------------------------------------*/
250 fetch_trx_type ( l_trx_type_rec,
251 p_customer_trx_id,
252 x_return_status
253 );
254 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
255 ROLLBACK to Complete_Transaction;
256 return;
257 END IF;
258
259 /*------------------------------+
260 | Tax Handling |
261 +-------------------------------*/
262
263 /* Enforce natural account feature is obsolete for R12
264 and the logic behind it is now supported internally
265 within the etax product. The local code for it here
266 has been removed */
267
268 /*-----------------------------------------+
269 |Validate if transaction can be completed |
270 +------------------------------------------*/
271 IF pg_debug = 'Y' THEN
272 trx_debug ('Calling arp_trx_complete_chk.do_completion_checking(+) ');
273 END IF;
274 arp_trx_complete_chk.do_completion_checking(p_customer_trx_id,
275 l_so_source_code,
276 arp_global.sysparam.ta_installed_flag,
277 l_error_count);
278
279 IF ( l_error_count > 0 ) THEN
280 ROLLBACK to Complete_Transaction;
281 x_return_status := FND_API.G_RET_STS_ERROR ;
282 FND_MESSAGE.Set_Name('AR', 'AR_TW_CANT_COMPLETE');
283 FND_MSG_PUB.Add;
284 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count ,
285 p_data => x_msg_data
286 );
287 return;
288 END IF;
289
290 IF pg_debug = 'Y' THEN
291 trx_debug ('arp_trx_complete_chk.do_completion_checking(-) ');
292 trx_debug ('Calling fnd_seqnum.get_seq_val(+) ');
293 END IF;
294 /*-----------------------------------------------------------------------------+
295 | Document sequencing changes: assign document number here only if Document |
296 | Number Generation Level profile is set to 'When the Transaction is completed'|
297 +-------------------------------------------------------------------------------*/
298 IF (l_unique_seq_number IN ('A','P') AND l_trx_rec.doc_sequence_value IS NULL) THEN
299 BEGIN
300 l_status := FND_SEQNUM.GET_SEQ_VAL(222,
301 l_trx_type_rec.name,
302 arp_global.sysparam.set_of_books_id,
303 'M',
304 l_trx_rec.trx_date,
305 l_doc_sequence_value,
306 l_doc_sequence_id);
307 EXCEPTION
308 WHEN OTHERS THEN
309 l_doc_sequence_id := NULL;
310 l_doc_sequence_value := NULL;
311 END;
312 IF l_doc_sequence_value IS NOT NULL THEN
313 l_trx_rec.doc_sequence_id := l_doc_sequence_id;
314 l_trx_rec.doc_sequence_value := l_doc_sequence_value;
315 ELSIF l_unique_seq_number = 'A' THEN
316 ROLLBACK to Complete_Transaction;
317 x_return_status := FND_API.G_RET_STS_ERROR ;
318 FND_MESSAGE.Set_Name('FND', 'UNIQUE-ALWAYS USED');
319 FND_MSG_PUB.Add;
320 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
321 p_data => x_msg_data
322 );
323 return;
324 END IF;
325 END IF;
326 IF pg_debug = 'Y' THEN
327 trx_debug ('fnd_seqnum.get_seq_val(-) ');
328 END IF;
329
330 /*-----------------------------------------------------------------------------------+
331 | Copy document number to transaction number if "copy document to transaction number"|
332 | flag is checked in batch source |
333 +------------------------------------------------------------------------------------*/
334
335 SELECT copy_doc_number_flag
336 INTO l_copy_doc_num_flag
337 FROM RA_BATCH_SOURCES batch, RA_CUSTOMER_TRX header
338 WHERE batch.batch_source_id = header.batch_source_id
339 AND header.customer_trx_id = p_customer_trx_id;
340
341 IF NVL (l_copy_doc_num_flag, 'N') = 'Y'
342 AND l_trx_rec.doc_sequence_value is not null
343 AND l_trx_rec.old_trx_number is null THEN
344 l_trx_rec.old_trx_number := l_trx_rec.trx_number;
345 l_trx_rec.trx_number := l_doc_sequence_value;
346 END IF;
347
348 IF (x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
349 l_trx_rec.complete_flag := 'Y';
350 arp_ct_pkg.update_p(l_trx_rec,p_customer_trx_id);
351 IF pg_debug = 'Y' THEN
352 trx_debug ('Calling ARP_PROCESS_HEADER_POST_COMMIT.post_commit(+)');
353 END IF;
354 ARP_PROCESS_HEADER_POST_COMMIT.post_commit (
355 p_form_name => 'AR_TRANSACTION_GRP',
356 p_form_version => 1,
357 p_customer_trx_id => p_customer_trx_id,
358 p_previous_customer_trx_id => l_trx_rec.previous_customer_trx_id,
359 p_complete_flag => 'Y',
360 p_trx_open_receivables_flag => l_trx_type_rec.accounting_affect_flag,
361 p_prev_open_receivables_flag => null,
362 p_creation_sign => l_trx_type_rec.creation_sign,
363 p_allow_overapplication_flag => l_trx_type_rec.allow_overapplication_flag,
364 p_natural_application_flag => l_trx_type_rec.natural_application_only_flag,
365 p_cash_receipt_id => null,
366 p_error_mode => null
367 );
368 IF pg_debug = 'Y' THEN
369 trx_debug ('ARP_PROCESS_HEADER_POST_COMMIT.post_commit(-)');
370 END IF;
371 END IF;
372
373 /*-----------------------------------+
374 | Standard check of l_commit. |
375 +------------------------------------*/
376 IF FND_API.To_Boolean( l_commit ) THEN
377 COMMIT;
378 END IF;
379
380 /*-----------------------------------------------------------------------+
381 | Standard call to get message count and if count is 1, get message info |
382 +------------------------------------------------------------------------*/
383 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count ,
384 p_data => x_msg_data
385 );
386
387
388 IF pg_debug = 'Y' THEN
389 trx_debug ('AR_TRANSACTION_GRP.COMPLETE_TRANSACTION(-)');
390 END IF;
391
392 EXCEPTION
393 WHEN FND_API.G_EXC_ERROR THEN
394 ROLLBACK TO Complete_Transaction;
395 x_return_status := FND_API.G_RET_STS_ERROR ;
396 FND_MSG_PUB.Count_And_Get (
397 p_count => x_msg_count ,
398 p_data => x_msg_data
399 );
400 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
401 ROLLBACK TO Complete_Transaction;
402 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
403 FND_MSG_PUB.Count_And_Get (
404 p_count => x_msg_count ,
405 p_data => x_msg_data
406 );
407 WHEN OTHERS THEN
408 ROLLBACK TO Complete_Transaction;
409 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
410 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
411 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME ,
412 l_api_name
413 );
414 END IF;
415
416 FND_MSG_PUB.Count_And_Get (
417 p_count => x_msg_count,
418 p_data => x_msg_data
419 );
420
421 END COMPLETE_TRANSACTION;
422
423 /*===========================================================================+
424 | PROCEDURE |
425 | Incomplete_Transaction |
426 | |
427 | DESCRIPTION |
428 | Incompletes the transaction after the following checks |
429 | 1. It should not have been posted to GL |
430 | 2. There should not exist any activity against it |
431 | 3. There should not be a chargeback for the transaction |
432 | 4. There should not be debit memo reversal on the transaction |
433 | 4. If none of above then update ra_customer_trx with |
434 | complete_flag =N and call to maintain the payment schedules |
435 | |
436 | SCOPE - PUBLIC |
437 | |
438 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED |
439 | arp_ct_pkg.lock_fetch_p |
440 | arpt_sql_func_util.get_posted_flag |
441 | arpt_sql_func_util.get_activity_flag
442 | arp_ct_pkg.update_p |
443 | ARP_PROCESS_HEADER_POST_COMMIT.post_commit |
444 | |
445 | ARGUMENTS : |
446 | IN: |
447 | p_api_version |
448 | p_init_msg_list |
449 | p_commit |
450 | p_validation_level |
451 | p_customer_trx_id |
452 | OUT: |
453 | x_return_status |
454 | x_msg_count |
455 | x_mssg_data |
456 | IN/ OUT: |
457 | None
458 | |
459 | RETURNS : NONE |
460 | |
461 | NOTES |
462 | |
463 | MODIFICATION HISTORY |
464 | |
465 +===========================================================================*/
466
467 PROCEDURE INCOMPLETE_TRANSACTION(
468 p_api_version IN NUMBER,
469 p_init_msg_list IN VARCHAR2 := NULL,
470 p_commit IN VARCHAR2 := NULL,
471 p_validation_level IN NUMBER := NULL,
472 p_customer_trx_id IN ra_customer_trx.customer_trx_id%type,
473 x_return_status OUT NOCOPY VARCHAR2,
474 x_msg_count OUT NOCOPY NUMBER,
475 x_msg_data OUT NOCOPY VARCHAR2) IS
476
477 l_api_name CONSTANT VARCHAR2(30) := 'INCOMPLETE_TRANSACTION';
478 l_api_version CONSTANT NUMBER := 1.0;
479
480 l_trx_rec ra_customer_trx%rowtype;
481 l_trx_type_rec ra_cust_trx_types%rowtype;
482 l_posted_flag VARCHAR2(1);
483 l_activity_flag VARCHAR2(1);
484
485 l_init_msg_list VARCHAR2(1);
486 l_commit VARCHAR2(1);
487 l_validation_level NUMBER;
488
489 BEGIN
490
491 /*-------------------------------------------+
492 | Initialize local variables |
493 +-------------------------------------------*/
494 IF p_commit = NULL THEN
495 l_commit := FND_API.G_FALSE;
496 ELSE
497 l_commit := p_commit;
498 END IF;
499
500 IF p_init_msg_list = NULL THEN
501 l_init_msg_list := FND_API.G_FALSE;
502 ELSE
503 l_init_msg_list := p_init_msg_list;
504 END IF;
505
506 IF p_validation_level = NULL THEN
507 l_validation_level := FND_API.G_VALID_LEVEL_FULL;
508 ELSE
509 l_validation_level := p_validation_level;
510 END IF;
511
512 IF pg_debug = 'Y' THEN
513 trx_debug ('AR_TRANSACTION_GRP.INCOMPLETE_TRANSACTION(+)' );
514 END IF;
515
516 SAVEPOINT Incomplete_Transaction;
517 /*--------------------------------------------------+
518 | Standard call to check for call compatibility |
519 +--------------------------------------------------*/
520
521 IF NOT FND_API.Compatible_API_Call(
522 l_api_version,
523 p_api_version,
524 l_api_name,
525 G_PKG_NAME) THEN
526 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
527 END IF;
528
529 /*--------------------------------------------------------------+
530 | Initialize message list if l_init_msg_list is set to TRUE |
531 +--------------------------------------------------------------*/
532
533 IF FND_API.to_Boolean( l_init_msg_list ) THEN
534 FND_MSG_PUB.initialize;
535 END IF;
536
537 /*-----------------------------------------+
538 | Initialize return status to SUCCESS |
539 +-----------------------------------------*/
540 x_return_status := FND_API.G_RET_STS_SUCCESS;
541
542 /*-----------------------------------------------------+
546 trx_debug ('Calling arp_ct_pkg.lock_fetch_p(+) ');
543 | Lock and fetch the header record for customer trx id |
544 +-----------------------------------------------------*/
545 IF pg_debug = 'Y' THEN
547 END IF;
548
549 arp_ct_pkg.lock_fetch_p (l_trx_rec,
550 p_customer_trx_id);
551
552 IF pg_debug = 'Y' THEN
553 trx_debug ('arp_ct_pkg.lock_fetch_p(-) ');
554 END IF;
555
556 /*----------------------------------------------+
557 | Get the transaction type for trx type id |
558 +----------------------------------------------*/
559 fetch_trx_type ( l_trx_type_rec,
560 p_customer_trx_id,
561 x_return_status
562 );
563
564 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
565 ROLLBACK to Incomplete_Transaction;
566 return;
567 END IF;
568
569 /*--------------------------------------------------------------+
570 | Check for activities, etc on invoice before incompleting |
571 +--------------------------------------------------------------*/
572 IF l_trx_rec.complete_flag ='Y' THEN
573 IF pg_debug = 'Y' THEN
574 trx_debug ('Calling arpt_sql_funct_util.get_posted_flag(+)');
575 END IF;
576
577 l_posted_flag := arpt_sql_func_util.get_posted_flag(
578 p_customer_trx_id,
579 l_trx_type_rec.post_to_gl,
580 l_trx_rec.complete_flag );
581 IF (l_posted_flag = 'Y') THEN
582 ROLLBACK to Incomplete_Transaction;
583 x_return_status := FND_API.G_RET_STS_ERROR ;
584 FND_MESSAGE.Set_Name('AR', 'AR_TAPI_CANT_UPDATE_POSTED');
585 FND_MSG_PUB.Add;
586 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
587 p_data => x_msg_data
588 );
589 return;
590 END IF;
591 IF pg_debug = 'Y' THEN
592 trx_debug ('arpt_sql_funct_util.get_posted_flag(-)');
593 trx_debug ('Calling arpt_sql_funct_util.get_activity_flag(+)');
594 END IF;
595
596 l_activity_flag := arpt_sql_func_util.get_activity_flag(
597 p_customer_trx_id,
598 l_trx_type_rec.accounting_affect_flag,
599 l_trx_rec.complete_flag,
600 l_trx_type_rec.type,
601 l_trx_rec.initial_customer_trx_id,
602 l_trx_rec.previous_customer_trx_id
603 );
604 IF (l_activity_flag = 'Y') THEN
605 ROLLBACK to Incomplete_Transaction;
606 x_return_status := FND_API.G_RET_STS_ERROR ;
607 FND_MESSAGE.Set_Name('AR', 'AR_TW_NO_RECREATE_PS');
608 FND_MSG_PUB.Add;
609 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
610 p_data => x_msg_data
611 );
612 return;
613 ELSIF (l_activity_flag = 'G') THEN
614 ROLLBACK to Incomplete_Transaction;
615 x_return_status := FND_API.G_RET_STS_ERROR ;
616 FND_MESSAGE.Set_Name('AR', 'AR_TAPI_CANT_UPDATE_POSTED');
617 FND_MSG_PUB.Add;
618 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
619 p_data => x_msg_data
620 );
621 return;
622 END IF;
623 IF pg_debug = 'Y' THEN
624 trx_debug ('arpt_sql_funct_util.get_activity_flag(-)');
625 END IF;
626
627 IF ( l_trx_rec.created_from IN ('ARXREV', 'REL9_ARXREV') ) THEN
628 ROLLBACK to Incomplete_Transaction;
629 x_return_status := FND_API.G_RET_STS_ERROR ;
630 FND_MESSAGE.Set_Name('AR', 'AR_TAPI_CANT_UPDATE_DM_REV');
631 FND_MSG_PUB.Add;
632 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
633 p_data => x_msg_data
634 );
635 return;
636 END IF;
637
638 IF ( l_trx_type_rec.type = 'CB' ) THEN
639 ROLLBACK to Incomplete_Transaction;
640 x_return_status := FND_API.G_RET_STS_ERROR ;
641 FND_MESSAGE.Set_Name('AR', 'AR_TAPI_CANT_UPDATE_CB');
642 FND_MSG_PUB.Add;
643 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
644 p_data => x_msg_data
645 );
646 return;
647 END IF;
648
649 IF (x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
650 l_trx_rec.complete_flag := 'N';
651 arp_ct_pkg.update_p(l_trx_rec,p_customer_trx_id);
652 IF pg_debug = 'Y' THEN
653 trx_debug ('Calling ARP_PROCESS_HEADER_POST_COMMIT.post_commit(+)');
654 END IF;
655 ARP_PROCESS_HEADER_POST_COMMIT.post_commit (
656 p_form_name => 'AR_TRANSACTION_GRP',
657 p_form_version => 1,
658 p_customer_trx_id => p_customer_trx_id,
659 p_previous_customer_trx_id => l_trx_rec.previous_customer_trx_id,
660 p_complete_flag => 'N',
661 p_trx_open_receivables_flag => l_trx_type_rec.accounting_affect_flag,
662 p_prev_open_receivables_flag => null,
663 p_creation_sign => l_trx_type_rec.creation_sign,
664 p_allow_overapplication_flag => l_trx_type_rec.allow_overapplication_flag,
665 p_natural_application_flag => l_trx_type_rec.natural_application_only_flag,
666 p_cash_receipt_id => null,
667 p_error_mode => null
668 );
669 IF pg_debug = 'Y' THEN
670 trx_debug ('ARP_PROCESS_HEADER_POST_COMMIT.post_commit(-)' );
671 END IF;
672 END IF;
673 END IF; --complete_flag ='Y'
674
675 /*-----------------------------------+
676 | Standard check of l_commit. |
677 +------------------------------------*/
678 IF FND_API.To_Boolean( l_commit ) THEN
679 COMMIT;
680 END IF;
681
682 /*-----------------------------------------------------------------------+
683 | Standard call to get message count and if count is 1, get message info |
684 +------------------------------------------------------------------------*/
685 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
686 p_data => x_msg_data
687 );
688
689
690 IF pg_debug = 'Y' THEN
691 trx_debug ('AR_TRANSACTION_GRP.INCOMPLETE_TRANSACTION(-)');
692 END IF;
693
694 EXCEPTION
695 WHEN FND_API.G_EXC_ERROR THEN
696 ROLLBACK TO Incomplete_Transaction;
697 x_return_status := FND_API.G_RET_STS_ERROR ;
698 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
699 p_data => x_msg_data
700 );
701 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
702 ROLLBACK TO Incomplete_Transaction;
703 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
704 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
705 p_data => x_msg_data
706 );
707 WHEN OTHERS THEN
708 ROLLBACK TO Incomplete_Transaction;
709 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
710 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
711 FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME ,
712 l_api_name
713 );
714 END IF;
715
716 FND_MSG_PUB.Count_And_Get (p_count => x_msg_count,
717 p_data => x_msg_data
718 );
719
720 END INCOMPLETE_TRANSACTION;
721
722 END AR_TRANSACTION_GRP;