DBA Data[Home] [Help]

PACKAGE BODY: APPS.IEC_RLCTRL_PUB

Source


1 PACKAGE BODY IEC_RLCTRL_PUB AS
2 /* $Header: IECRCPBB.pls 115.9 2003/08/22 20:42:16 hhuang noship $ */
3 
4 G_PKG_NAME CONSTANT VARCHAR2(30) := 'IEC_RLCTRL_PUB';
5 
6 
7 PROCEDURE MakeListEntriesAvailable
8 (
9 	p_api_version		IN		NUMBER,
10 	p_init_msg_list		IN		VARCHAR2,
11 	p_commit		IN		VARCHAR2,
12 	p_resp_appl_id		IN		NUMBER,
13 	p_resp_id		IN		NUMBER,
14 	p_user_id		IN		NUMBER,
15 	p_login_id		IN		NUMBER,
16 	x_return_status		IN OUT NOCOPY	VARCHAR2,
17 	x_msg_count		IN OUT NOCOPY	NUMBER,
18 	x_msg_data		IN OUT NOCOPY	VARCHAR2,
19 	p_list_header_id	IN		NUMBER,
20 	p_dnu_reason_code	IN		NUMBER
21 ) AS
22         l_api_name              CONSTANT VARCHAR2(30) := 'MakeListEntriesAvailable';
23         l_api_version           CONSTANT NUMBER       := 1.0;
24         l_api_name_full         CONSTANT VARCHAR2(61) := g_pkg_name||'.'||l_api_name;
25         l_return_status         VARCHAR2(1);
26         l_return_code           VARCHAR2(1);
27         l_data                  VARCHAR2(100);
28         l_count                 NUMBER;
29         l_list_header_id        NUMBER(15);
30         l_dnu_reason_code       NUMBER(15);
31 
32 BEGIN
33 
34    SAVEPOINT make_entries_avail_pub;
35 
36    -- Preprocessing Call
37    l_list_header_id := p_list_header_id;
38    l_dnu_reason_code := p_dnu_reason_code;
39 
40    IEC_RLCTRL_PUB_VUHK.MakeListEntriesAvailable_pre( p_list_header_id => l_list_header_id
41                                                    , p_dnu_reason_code => l_dnu_reason_code
42                                                    , x_data => l_data
43                                                    , x_count => l_count
44                                                    , x_return_code => l_return_code);
45 
46    IF (l_return_code = FND_API.G_RET_STS_ERROR) THEN
47       RAISE FND_API.G_EXC_ERROR;
48    ELSIF (l_return_code = FND_API.G_RET_STS_UNEXP_ERROR) THEN
49       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
50    END IF;
51 
52    -- Standard call to check for call compatibility
53    IF NOT fnd_api.compatible_api_call( l_api_version
54                                      , p_api_version
55                                      , l_api_name
56                                      , g_pkg_name) THEN
57       RAISE fnd_api.g_exc_unexpected_error;
58    END IF;
59 
60    -- Initialize message list if p_init_msg_list is set to TRUE
61    IF fnd_api.to_boolean(p_init_msg_list) THEN
62       fnd_msg_pub.initialize;
63    END IF;
64 
65    -- Initialize API return status to success
66    x_return_status := fnd_api.g_ret_sts_success;
67 
68    --
69    -- Validate user and login session IDs
70    --
71    IF (p_user_id IS NULL) THEN
72       iec_rlctrl_util_pvt.add_null_parameter_msg(l_api_name_full, 'p_user_id');
73       RAISE fnd_api.g_exc_error;
74    ELSE
75       iec_rlctrl_util_pvt.validate_who_info ( p_api_name           => l_api_name_full
76                                             , p_parameter_name_usr => 'p_user_id'
77                                             , p_parameter_name_log => 'p_login_id'
78                                             , p_user_id            => p_user_id
79                                             , p_login_id           => p_login_id
80                                             , x_return_status      => l_return_status);
81       IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
82          RAISE fnd_api.g_exc_error;
83       END IF;
84    END IF;
85 
86 ---------------------------------------------------------------------
87 
88    -- DO ACTUAL WORK HERE BY CALLING PRIVATE METHOD
89 
90    IEC_RECORD_FILTER_PVT.Make_ListEntriesAvailable( p_list_header_id => l_list_header_id
91                                                   , p_dnu_reason_code => l_dnu_reason_code
92                                                   , p_commit => FALSE
93                                                   , x_return_status => l_return_code);
94 
95    IF (l_return_code = FND_API.G_RET_STS_ERROR) THEN
96       RAISE FND_API.G_EXC_ERROR;
97    ELSIF (l_return_code = FND_API.G_RET_STS_UNEXP_ERROR) THEN
98       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
99    END IF;
100 
101 ---------------------------------------------------------------------
102 
103    -- Post processing Call
104 
105    IEC_RLCTRL_PUB_VUHK.MakeListEntriesAvailable_post( p_list_header_id => l_list_header_id
106                                                     , p_dnu_reason_code => l_dnu_reason_code
107                                                     , x_data => l_data
108                                                     , x_count => l_count
109                                                     , x_return_code => l_return_code);
110 
111    IF (l_return_code = FND_API.G_RET_STS_ERROR) THEN
112       RAISE FND_API.G_EXC_ERROR;
113    ELSIF (l_return_code = FND_API.G_RET_STS_UNEXP_ERROR) THEN
114       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
115    END IF;
116 
117    IF fnd_api.to_boolean(p_commit) THEN
118       COMMIT WORK;
119    END IF;
120 
121    -- Standard call to get message count and if count is 1, get message info
122    fnd_msg_pub.count_and_get( p_count  => x_msg_count
123                             , p_data   => x_msg_data );
124 
125 EXCEPTION
126    WHEN fnd_api.g_exc_error THEN
127       ROLLBACK TO make_entries_avail_pub;
128       x_return_status := fnd_api.g_ret_sts_error;
129       fnd_msg_pub.count_and_get( p_count => x_msg_count
130                                , p_data  => x_msg_data );
131    WHEN fnd_api.g_exc_unexpected_error THEN
132       ROLLBACK TO make_entries_avail_pub;
133       x_return_status := fnd_api.g_ret_sts_unexp_error;
134       fnd_msg_pub.count_and_get( p_count => x_msg_count
135                                , p_data  => x_msg_data );
136    WHEN OTHERS THEN
137       ROLLBACK TO make_entries_avail_pub;
138       x_return_status := fnd_api.g_ret_sts_unexp_error;
139       IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
140          fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
141       END IF;
142       fnd_msg_pub.count_and_get( p_count => x_msg_count
143                                , p_data  => x_msg_data );
144 
145 END MakeListEntriesAvailable;
146 
147 
148 PROCEDURE MakeListEntriesAvailable
149 (
150 	p_api_version		IN		NUMBER,
151 	p_init_msg_list		IN		VARCHAR2,
152 	p_commit		IN		VARCHAR2,
153 	p_resp_appl_id		IN		NUMBER,
154 	p_resp_id		IN		NUMBER,
155 	p_user_id		IN		NUMBER,
156 	p_login_id		IN		NUMBER,
157 	x_return_status		IN OUT NOCOPY	VARCHAR2,
158 	x_msg_count		IN OUT NOCOPY	NUMBER,
159 	x_msg_data		IN OUT NOCOPY	VARCHAR2,
160 	p_list_header_id	IN		NUMBER
161 ) AS
162         l_api_name              CONSTANT VARCHAR2(30) := 'MakeListEntriesAvailable';
163         l_api_version           CONSTANT NUMBER       := 1.0;
164         l_api_name_full         CONSTANT VARCHAR2(61) := g_pkg_name||'.'||l_api_name;
165         l_return_status         VARCHAR2(1);
166         l_return_code           VARCHAR2(1);
167         l_data                  VARCHAR2(100);
168         l_count                 NUMBER;
169         l_list_header_id        NUMBER(15);
170 
171 BEGIN
172 
173    SAVEPOINT make_entries_avail_pub;
174 
175    -- Preprocessing Call
176    l_list_header_id := p_list_header_id;
177 
178    IEC_RLCTRL_PUB_VUHK.MakeListEntriesAvailable_pre( p_list_header_id => l_list_header_id
179                                                    , x_data => l_data
180                                                    , x_count => l_count
181                                                    , x_return_code => l_return_code);
182 
183    IF (l_return_code = FND_API.G_RET_STS_ERROR) THEN
184       RAISE FND_API.G_EXC_ERROR;
185    ELSIF (l_return_code = FND_API.G_RET_STS_UNEXP_ERROR) THEN
186       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
187    END IF;
188 
189 
190    -- Standard call to check for call compatibility
191    IF NOT fnd_api.compatible_api_call( l_api_version
192                                      , p_api_version
193                                      , l_api_name
194                                      , g_pkg_name) THEN
195       RAISE fnd_api.g_exc_unexpected_error;
196    END IF;
197 
198    -- Initialize message list if p_init_msg_list is set to TRUE
199    IF fnd_api.to_boolean(p_init_msg_list) THEN
200       fnd_msg_pub.initialize;
201    END IF;
202 
203    -- Initialize API return status to success
204    x_return_status := fnd_api.g_ret_sts_success;
205 
206    --
207    -- Validate user and login session IDs
208    --
209    IF (p_user_id IS NULL) THEN
210       iec_rlctrl_util_pvt.add_null_parameter_msg(l_api_name_full, 'p_user_id');
211       RAISE fnd_api.g_exc_error;
212    ELSE
213       iec_rlctrl_util_pvt.validate_who_info ( p_api_name           => l_api_name_full
214                                             , p_parameter_name_usr => 'p_user_id'
215                                             , p_parameter_name_log => 'p_login_id'
216                                             , p_user_id            => p_user_id
217                                             , p_login_id           => p_login_id
218                                             , x_return_status      => l_return_status);
219       IF (l_return_status <> fnd_api.g_ret_sts_success) THEN
220          RAISE fnd_api.g_exc_error;
221       END IF;
222    END IF;
223 
224 ---------------------------------------------------------------------
225 
226    -- DO ACTUAL WORK HERE BY CALLING PRIVATE METHOD
227 
228    IEC_RECORD_FILTER_PVT.Make_ListEntriesAvailable( p_list_header_id => l_list_header_id
229                                                   , p_dnu_reason_code => NULL
230                                                   , p_commit => FALSE
231                                                   , x_return_status => l_return_code);
232 
233      -- NULL is passed in for dnu_reason_code parameter to indicate that all list entries
234      -- should be made available irrespective of DO_NOT_USE_REASON in AMS_LIST_ENTRIES
235 
236    IF (l_return_code = FND_API.G_RET_STS_ERROR) THEN
237       RAISE FND_API.G_EXC_ERROR;
238    ELSIF (l_return_code = FND_API.G_RET_STS_UNEXP_ERROR) THEN
239       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
240    END IF;
241 
242 ---------------------------------------------------------------------
243 
244    -- Post processing Call
245 
246    IEC_RLCTRL_PUB_VUHK.MakeListEntriesAvailable_post( p_list_header_id => l_list_header_id
247                                                     , x_data => l_data
248                                                     , x_count => l_count
249                                                     , x_return_code => l_return_code);
250 
251    IF (l_return_code = FND_API.G_RET_STS_ERROR) THEN
252       RAISE FND_API.G_EXC_ERROR;
253    ELSIF (l_return_code = FND_API.G_RET_STS_UNEXP_ERROR) THEN
254       RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
255    END IF;
256 
257    IF fnd_api.to_boolean(p_commit) THEN
258       COMMIT WORK;
259    END IF;
260 
261    -- Standard call to get message count and if count is 1, get message info
262    fnd_msg_pub.count_and_get( p_count  => x_msg_count
263                             , p_data   => x_msg_data );
264 
265 EXCEPTION
266    WHEN fnd_api.g_exc_error THEN
267       ROLLBACK TO make_entries_avail_pub;
268       x_return_status := fnd_api.g_ret_sts_error;
269       fnd_msg_pub.count_and_get( p_count => x_msg_count
270                                , p_data  => x_msg_data );
271    WHEN fnd_api.g_exc_unexpected_error THEN
272       ROLLBACK TO make_entries_avail_pub;
273       x_return_status := fnd_api.g_ret_sts_unexp_error;
274       fnd_msg_pub.count_and_get( p_count => x_msg_count
275                                , p_data  => x_msg_data );
276    WHEN OTHERS THEN
277       ROLLBACK TO make_entries_avail_pub;
278       x_return_status := fnd_api.g_ret_sts_unexp_error;
279       IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
280          fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
281       END IF;
282       fnd_msg_pub.count_and_get( p_count => x_msg_count
283                                , p_data  => x_msg_data );
284 
285 END MakeListEntriesAvailable;
286 
287 
288 END IEC_RLCTRL_PUB;