[Home] [Help]
PACKAGE BODY: APPS.PSA_MULTIFUND_DISTRIBUTION_EXT
Source
1 PACKAGE BODY PSA_MULTIFUND_DISTRIBUTION_EXT AS
2 /* $Header: PSAMFEXB.pls 120.2 2006/09/13 12:38:57 agovil noship $ */
3
4 -- Parameters:
5
6 -- p_init_msg_list (Optional) (Default FALSE) :
7 -- Allows API callers to request the initialization of the message list.
8
9 -- x_return_status :
10 -- Reports the API overall return status defined as follows :
11 -- G_RET_STS_SUCCESS CONSTANT VARCHAR2(1):='S'; -- execution success
12 -- G_RET_STS_UNEXP_ERROR CONSTANT VARCHAR2(1):='U'; -- execution error
13
14 -- x_msg_count : Holds the number of messages in the API message list.
15
16 -- x_msg_data : The actual message in an encoded format.
17
18 -- p_sob_id : Set of Books ID
19
20 -- p_doc_id : Document ID (customer_trx_id) for which multi-fund distributions are to be created.
21
22
23 FUNCTION CREATE_DISTRIBUTIONS_PUB
24 (p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
25 x_return_status OUT NOCOPY VARCHAR2,
26 x_msg_count OUT NOCOPY NUMBER,
27 x_msg_data OUT NOCOPY VARCHAR2,
28 p_sob_id IN NUMBER,
29 p_doc_id IN NUMBER,
30 p_report_only IN VARCHAR2 DEFAULT 'N') RETURN BOOLEAN
31 IS
32 -- Bug 3837120 .. Commented the pragma
33 -- PRAGMA AUTONOMOUS_TRANSACTION;
34
35 l_errbuf VARCHAR2(3000);
36 l_retcode VARCHAR2(3000);
37 l_run_num NUMBER;
38 l_error_mesg VARCHAR2(3000);
39
40 BEGIN
41
42
43 -- Initialize message list if p_init_msg_list is set to TRUE.
44 IF FND_API.to_Boolean( p_init_msg_list ) THEN
45 FND_MSG_PUB.initialize;
46 END IF;
47
48 -- Initialize API return status to success
49 x_return_status := FND_API.G_RET_STS_SUCCESS;
50
51 /*
52 If Activity is (T)ransaction, Multifund Transaction, Cash Receipts and Adjustments will be processed
53 If Activity is (M)iscellanous Receipt, Misc. receipts will be processed
54 If Activity is (A)ll, all the Multifund distributions will be processed.
55 */
56
57 -- Bug 3837120 .. Added new parameter p_report_only
58 IF NOT PSA_MF_CREATE_DISTRIBUTIONS.create_distributions
59 (
60 errbuf => l_errbuf,
61 retcode => l_retcode,
62 p_mode => 'A',
63 p_document_id => p_doc_id,
64 p_set_of_books_id => p_sob_id,
65 run_num => l_run_num,
66 p_error_message => l_error_mesg,
67 p_report_only => p_report_only
68 ) THEN
69 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
70 END IF;
71
72 -- Standard call to get message count and if count is 1, get message info.
73 FND_MSG_PUB.Count_And_Get
74 (p_count => x_msg_count,
75 p_data => x_msg_data);
76 x_msg_data := x_msg_data||l_error_mesg;
77
78 -- Need to commit before exiting autonomous transaction
79
80 -- Bug 3837120 .. Commented out COMMIT
81 -- COMMIT;
82
83 EXCEPTION
84 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
85 ROLLBACK;
86 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
87 FND_MSG_PUB.Count_And_Get
88 (p_count => x_msg_count ,
89 p_data => x_msg_data );
90 x_msg_data := x_msg_data||l_error_mesg;
91
92 WHEN OTHERS THEN
93 ROLLBACK;
94 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
95 FND_MSG_PUB.Count_And_Get
96 (p_count => x_msg_count ,
97 p_data => x_msg_data );
98 x_msg_data := x_msg_data||l_error_mesg;
99
100 END CREATE_DISTRIBUTIONS_PUB;
101
102 END PSA_MULTIFUND_DISTRIBUTION_EXT;