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,
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;
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:
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:
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:
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
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 |
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: /*-----------------------------------------+
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 |
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:
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
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
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(+)');
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: /*-----------------------------------------------------------------------+
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 ,
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: );
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 ,
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: );
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: );
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:
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:
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:
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
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 |
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: /*-----------------------------------------+
536:
537: /*-----------------------------------------+
538: | Initialize return status to SUCCESS |
539: +-----------------------------------------*/
540: x_return_status := FND_API.G_RET_STS_SUCCESS;
541:
542: /*-----------------------------------------------------+
543: | Lock and fetch the header record for customer trx id |
544: +-----------------------------------------------------*/
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:
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
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
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
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(+)');
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: /*-----------------------------------------------------------------------+
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
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
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
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
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: );