DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_ACCOUNT_BALANCES_PVT

Source


1 PACKAGE BODY OKL_ACCOUNT_BALANCES_PVT AS
2 /* $Header: OKLRACBB.pls 120.11 2007/02/08 11:38:16 dpsingh noship $ */
3 
4 l_error_msg_rec     Error_message_Type;
5 
6 PROCEDURE Get_Account_Balances(p_errbuf OUT NOCOPY VARCHAR2,
7                                                          p_retcode OUT NOCOPY NUMBER,
8                                                          p_contract_number IN VARCHAR2,
9                                                          p_account_from IN VARCHAR2,
10                                                          p_account_to IN VARCHAR2,
11                                                          p_period_from IN VARCHAR2,
12                                                          p_period_to IN VARCHAR2,
13                                                          p_format IN VARCHAR2 )
14 IS
15 
16 BEGIN
17 --Stubbed out this procedure for Bug 5707866 (SLA Uptake of Account Balances Report ,replaced by the Trial Balance View feature).
18 
19 FND_MESSAGE.SET_NAME( application =>g_app_name ,
20                                               NAME =>  'OKL_OBS_ACCT_BAL_REP_PRG' );
21 FND_FILE.PUT_LINE(FND_FILE.LOG,FND_MESSAGE.GET);
22 
23 END Get_Account_Balances;
24 
25 
26 FUNCTION Submit_Account_Balances(
27                                                           p_api_version       IN NUMBER,
28                                                           p_init_msg_list     IN VARCHAR2,
29                                                           x_return_status    OUT NOCOPY VARCHAR2,
30                                                           x_msg_count       OUT NOCOPY NUMBER,
31                                                           x_msg_data         OUT NOCOPY VARCHAR2,
32                                                           p_contract_number IN VARCHAR2,
33                                                           p_account_from IN VARCHAR2,
34                                                           p_account_to IN VARCHAR2,
35                                                           p_period_from IN VARCHAR2,
36                                                           p_period_to IN VARCHAR2,
37                                                           p_format IN VARCHAR2 )
38 RETURN NUMBER IS
39     l_api_version          CONSTANT NUMBER := 1;
40     l_api_name             CONSTANT VARCHAR2(30) := 'SUBMIT_ACCT_BAL';
41     l_return_status        VARCHAR2(1) := Okl_Api.G_RET_STS_SUCCESS;
42     l_init_msg_list        VARCHAR2(20) DEFAULT Okl_Api.G_FALSE;
43     l_msg_count            NUMBER;
44     l_msg_data             VARCHAR2(2000);
45     x_request_id           NUMBER;
46 BEGIN
47     x_return_status := OKL_API.G_RET_STS_SUCCESS;
48     l_return_status := OKL_API.START_ACTIVITY(l_api_name
49                                                ,G_PKG_NAME
50                                                ,p_init_msg_list
51                                                ,l_api_version
52                                                ,p_api_version
53                                                ,'_PVT'
54                                                ,l_return_status);
55     IF (l_return_status = okl_api.g_ret_sts_unexp_error) THEN
56       RAISE okl_api.g_exception_unexpected_error;
57     ELSIF (l_return_Status = okl_api.g_ret_sts_error) THEN
58       RAISE okl_api.g_exception_error;
59     END IF;
60     -- check for p_contract_number before submitting the request.
61     IF (p_contract_number IS NULL) OR (p_contract_number = Okl_Api.G_MISS_CHAR) THEN
62        Okc_Api.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'Contract Number');
63        RAISE Okl_Api.G_EXCEPTION_ERROR;
64     END IF;
65 
66     -- check for p_account_from before submitting the request.
67     IF (p_account_from IS NULL) OR (p_account_from = Okl_Api.G_MISS_CHAR) THEN
68        Okc_Api.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'Account From');
69        RAISE Okl_Api.G_EXCEPTION_ERROR;
70     END IF;
71 
72     -- check for p_account_to before submitting the request.
73     IF (p_account_to IS NULL) OR (p_account_to = Okl_Api.G_MISS_CHAR) THEN
74        Okc_Api.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'Account To');
75        RAISE Okl_Api.G_EXCEPTION_ERROR;
76     END IF;
77 
78 
79    -- Submit Concurrent Program Request for interest calculation
80    FND_REQUEST.set_org_id(mo_global.get_current_org_id); --MOAC- Concurrent request
81     x_request_id := FND_REQUEST.SUBMIT_REQUEST(
82                                                                                    application => 'OKL',
83                                                                                    program 	=> 'OKLACCTBAL',
84                                                                                    description => 'Account Balances Report',
85                                                                                    argument1 => p_contract_number,
86                                                                                    argument2 => p_account_from,
87                                                                                    argument3 => p_account_to,
88                                                                                    argument4 => p_period_from,
89                                                                                    argument5 => p_period_to,
90                                                                                    argument6 => p_format);
91 
92    IF x_request_id = 0 THEN
93     -- Raise Error if the request has not been submitted successfully.
94 
95        Okc_Api.set_message(p_app_name => 'OKL',
96                            p_msg_name => 'OKL_CONC_REQ_ERROR',
97                            p_token1   => 'PROG_NAME',
98                            p_token1_value => 'Account Balances Report',
99                            p_token2   => 'REQUEST_ID',
100                            p_token2_value => x_request_id);
101       RAISE okl_api.g_exception_error;
102     ELSE
103   -- Return the request Id if has been submitted successfully.
104       x_return_status := l_return_status;
105       okl_api.end_activity(x_msg_count, x_msg_data);
106     END IF;
107     RETURN x_request_id;
108 
109   EXCEPTION
110 
111     WHEN okl_api.g_exception_error THEN
112       x_return_status := Okl_Api.handle_exceptions(l_api_name
113                                  ,g_pkg_name
114                                  ,'OKL_API.G_RET_STS_ERROR'
115                                  ,x_msg_count
116                                  ,x_msg_data
117                                  ,'_PVT');
118     RETURN x_request_id;
119     WHEN okl_api.g_exception_unexpected_error THEN
120       x_return_status := OKL_API.HANDLE_EXCEPTIONS(l_api_name
121                                                                                     ,g_pkg_name
122                                                                                     ,'OKL_API.G_RET_STS_UNEXP_ERROR'
123                                                                                     ,x_msg_count
124                                                                                     ,x_msg_data
125                                                                                      ,'_PVT');
126     RETURN x_request_id;
127     WHEN OTHERS THEN
128       x_return_status :=Okl_Api.HANDLE_EXCEPTIONS
129                                (l_api_name,
130                                 G_PKG_NAME,
131                                 'OTHERS',
132                                 x_msg_count,
133                                 x_msg_data,
134                                 '_PVT');
135     RETURN x_request_id;
136   END Submit_Account_Balances;
137 
138 END OKL_ACCOUNT_BALANCES_PVT;