[Home] [Help]
PACKAGE BODY: APPS.CSI_COUNTER_TEMPLATE_PUB
Source
1 PACKAGE BODY CSI_COUNTER_TEMPLATE_PUB AS
2 /* $Header: csipcttb.pls 120.16.12010000.2 2008/10/31 21:18:34 rsinn ship $ */
3 /*#
4 * This is a public API for managing Counter Grouping and
5 * Counter Template.
6 * It contains routines to Create and Update Counter Grouping,
7 * Counter Template, Item Associations, Derived Filters,
8 * Counter Relationships
9 * @rep:scope public
10 * @rep:product CSI
11 * @rep:displayname Manage Counter Template
12 * @rep:lifecycle active
13 * @rep:compatibility S
14 * @rep:category BUSINESS_ENTITY CSI_COUNTER
15 */
16 -- --------------------------------------------------------
17 -- Define global variables
18 -- --------------------------------------------------------
19
20 -- G_PKG_NAME CONSTANT VARCHAR2(30):= 'CSI_COUNTER_TEMPLATE_PUB';
21 G_FILE_NAME CONSTANT VARCHAR2(12) := 'csipcttb.pls';
22
23 --|---------------------------------------------------
24 --| procedure name: create_counter_group
25 --| description : procedure used to
26 --| create counter group
27 --|---------------------------------------------------
28 /*#
29 * This procedure is used to create counter group
30 * In this process, it also creates counter item associations
31 * @param p_api_version Current API version
32 * @param p_commit API commits if set to fnd_api.g_true
33 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
34 * @param p_validation_level API validation level
35 * @param p_counter_groups_rec Counter Group Record structure
36 * @param p_ctr_item_associations_tbl Counter Item Associations Table structure
37 * @param x_return_status API Return Status
38 * @param x_msg_count Message count
39 * @param x_msg_data Message Data
40 * @rep:scope public
41 * @rep:lifecycle active
42 * @rep:displayname Create Counter Group
43 */
44
45 PROCEDURE create_counter_group
46 (p_api_version IN NUMBER
47 ,p_commit IN VARCHAR2
48 ,p_init_msg_list IN VARCHAR2
49 ,p_validation_level IN NUMBER
50 ,p_counter_groups_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.counter_groups_rec
51 ,p_ctr_item_associations_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_item_associations_tbl
52 ,x_return_status OUT NOCOPY VARCHAR2
53 ,x_msg_count OUT NOCOPY NUMBER
54 ,x_msg_data OUT NOCOPY VARCHAR2
55 )
56 IS
57 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_COUNTER_GROUP';
58 l_api_version CONSTANT NUMBER := 1.0;
59 -- l_debug_level NUMBER;
60 l_flag VARCHAR2(1) := 'N';
61 l_msg_data VARCHAR2(2000);
62 l_msg_index NUMBER;
63 l_msg_count NUMBER;
64
65 l_count NUMBER;
66 l_return_message VARCHAR2(100);
67
68 BEGIN
69 -- Standard Start of API savepoint
70 SAVEPOINT create_counter_group;
71
72 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
73
74 -- csi_ctr_gen_utility_pvt.check_ib_active;
75
76 -- Standard call to check for call compatibility.
77 IF NOT FND_API.Compatible_API_Call (l_api_version,
78 p_api_version,
79 l_api_name ,
80 G_PKG_NAME )
81 THEN
82 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
83 END IF;
84
85 -- Initialize message list if p_init_msg_list is set to TRUE.
86 IF FND_API.to_Boolean( p_init_msg_list ) THEN
87 FND_MSG_PUB.initialize;
88 END IF;
89
90 -- Initialize API return status to success
91 x_return_status := FND_API.G_RET_STS_SUCCESS;
92
93 -- Read the debug profiles values in to global variable 7197402
94 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
95
96 -- Check the profile option debug_level for debug message reporting
97 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
98
99 -- If debug_level = 1 then dump the procedure name
100 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
101 csi_ctr_gen_utility_pvt.put_line( 'create_counter_group');
102 END IF;
103
104 -- If the debug level = 2 then dump all the parameters values.
105 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
106 csi_ctr_gen_utility_pvt.put_line( 'create_counter_group' ||
107 p_api_version ||'-'||
108 p_commit ||'-'||
109 p_init_msg_list ||'-'||
110 p_validation_level );
111 csi_ctr_gen_utility_pvt.dump_ctr_grp_rec(p_counter_groups_rec);
112 END IF;
113
114 -- Calling Customer Pre-processing Hook
115 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' ) ) then
116 CSI_COUNTER_TEMPLATE_CUHK.CREATE_COUNTER_GROUP_PRE
117 (
118 p_api_version => p_api_version
119 ,p_commit => p_commit
120 ,p_init_msg_list => p_init_msg_list
121 ,p_validation_level => p_validation_level
122 ,p_counter_groups_rec => p_counter_groups_rec
123 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
124 ,x_return_status => x_return_status
125 ,x_msg_count => x_msg_count
126 ,x_msg_data => x_msg_data
127 );
128 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
129 l_msg_index := 1;
130 l_msg_count := x_msg_count;
131 WHILE l_msg_count > 0 LOOP
132 x_msg_data := FND_MSG_PUB.GET
133 ( l_msg_index,
134 FND_API.G_FALSE
135 );
136 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.CREATE_COUNTER_GROUP_PRE API ');
137 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
138 l_msg_index := l_msg_index + 1;
139 l_msg_count := l_msg_count - 1;
140 END LOOP;
141 RAISE FND_API.G_EXC_ERROR;
142 END IF;
143 END IF;
144 --
145 -- Calling Vertical Pre-processing Hook
146 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' ) ) then
147 CSI_COUNTER_TEMPLATE_VUHK.CREATE_COUNTER_GROUP_PRE
148 (
149 p_api_version => p_api_version
150 ,p_commit => p_commit
151 ,p_init_msg_list => p_init_msg_list
152 ,p_validation_level => p_validation_level
153 ,p_counter_groups_rec => p_counter_groups_rec
154 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
155 ,x_return_status => x_return_status
156 ,x_msg_count => x_msg_count
157 ,x_msg_data => x_msg_data
158 );
159 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
160 l_msg_index := 1;
161 l_msg_count := x_msg_count;
162 WHILE l_msg_count > 0 LOOP
163 x_msg_data := FND_MSG_PUB.GET
164 ( l_msg_index,
165 FND_API.G_FALSE
166 );
167 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.CREATE_COUNTER_GROUP_PRE API ');
168 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
169 l_msg_index := l_msg_index + 1;
170 l_msg_count := l_msg_count - 1;
171 END LOOP;
172 RAISE FND_API.G_EXC_ERROR;
173 END IF;
174 END IF;
175
176 csi_counter_template_pvt.create_counter_group
177 (
178 p_api_version => p_api_version
179 ,p_commit => fnd_api.g_false
180 ,p_init_msg_list => p_init_msg_list
181 ,p_validation_level => p_validation_level
182 ,p_counter_groups_rec => p_counter_groups_rec
183 ,x_return_status => x_return_status
184 ,x_msg_count => x_msg_count
185 ,x_msg_data => x_msg_data
186 );
187
188 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
189 l_msg_index := 1;
190 l_msg_count := x_msg_count;
191
192 WHILE l_msg_count > 0 LOOP
193 x_msg_data := FND_MSG_PUB.GET
194 (l_msg_index,
195 FND_API.G_FALSE );
196 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.CREATE_COUNTER_GROUP');
197 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
198 l_msg_index := l_msg_index + 1;
199 l_msg_count := l_msg_count - 1;
200 END LOOP;
201 RAISE FND_API.G_EXC_ERROR;
202 END IF;
203
204 -- Calling Post Customer User Hook
205 BEGIN
206 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
207 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.CREATE_COUNTER_GROUP_Post ..');
208 CSI_COUNTER_TEMPLATE_CUHK.CREATE_COUNTER_GROUP_Post
209 (
210 p_api_version => 1.0
211 ,p_commit => fnd_api.g_false
212 ,p_init_msg_list => fnd_api.g_false
213 ,p_validation_level => fnd_api.g_valid_level_full
214 ,p_counter_groups_rec => p_counter_groups_rec
215 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
216 ,x_return_status => x_return_status
217 ,x_msg_count => x_msg_count
218 ,x_msg_data => x_msg_data
219 );
220 --
221 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
222 l_msg_index := 1;
223 l_msg_count := x_msg_count;
224 WHILE l_msg_count > 0 LOOP
225 x_msg_data := FND_MSG_PUB.GET
226 ( l_msg_index,
227 FND_API.G_FALSE );
228 csi_gen_utility_pvt.put_line('ERROR FROM CSI_ITEM_INSTANCE_CUHK.Create_Item_Instance_Post API ');
229 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
230 l_msg_index := l_msg_index + 1;
231 l_msg_count := l_msg_count - 1;
232 END LOOP;
233 RAISE FND_API.G_EXC_ERROR;
234 END IF;
235 --
236 END IF;
237 EXCEPTION
238 WHEN OTHERS THEN
239 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
240 RAISE FND_API.G_EXC_ERROR;
241 END;
242 --
243 -- Calling Post Vertical User Hook
244 BEGIN
245
246 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
247 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.CREATE_COUNTER_GROUP_Post ..');
248 CSI_COUNTER_TEMPLATE_VUHK.CREATE_COUNTER_GROUP_Post
249 (
250 p_api_version => 1.0
251 ,p_commit => fnd_api.g_false
252 ,p_init_msg_list => fnd_api.g_false
253 ,p_validation_level => fnd_api.g_valid_level_full
254 ,p_counter_groups_rec => p_counter_groups_rec
255 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
256 ,x_return_status => x_return_status
257 ,x_msg_count => x_msg_count
258 ,x_msg_data => x_msg_data
259 );
260 --
261 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
262 l_msg_index := 1;
263 l_msg_count := x_msg_count;
264 WHILE l_msg_count > 0 LOOP
265 x_msg_data := FND_MSG_PUB.GET
266 ( l_msg_index,
267 FND_API.G_FALSE );
268 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.CREATE_COUNTER_GROUP_Post API ');
269 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
270 l_msg_index := l_msg_index + 1;
271 l_msg_count := l_msg_count - 1;
272 END LOOP;
273 RAISE FND_API.G_EXC_ERROR;
274 END IF;
275 --
276 END IF;
277 EXCEPTION
278 WHEN OTHERS THEN
279 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
280 RAISE FND_API.G_EXC_ERROR;
281 END;
282 -- End of POST User Hooks
283
284 -- Call the create_item_associations to create the item associations
285
286 IF (p_ctr_item_associations_tbl.count > 0) THEN
287 FOR tab_row IN p_ctr_item_associations_tbl.FIRST .. p_ctr_item_associations_tbl.LAST
288 LOOP
289 IF p_ctr_item_associations_tbl.EXISTS(tab_row) THEN
290 p_ctr_item_associations_tbl(tab_row).group_id := p_counter_groups_rec.counter_group_id;
291
292 csi_ctr_gen_utility_pvt.put_line('inside item association..p_ctr_groups_rec = '||to_char(p_counter_groups_rec.counter_group_id));
293 csi_ctr_gen_utility_pvt.put_line('item group id = '||to_char(p_ctr_item_associations_tbl(tab_row).group_id));
294
295 create_item_association
296 (
297 p_api_version => p_api_version
298 ,p_commit => fnd_api.g_false
299 ,p_init_msg_list => p_init_msg_list
300 ,p_validation_level => p_validation_level
301 ,p_ctr_item_associations_rec => p_ctr_item_associations_tbl(tab_row)
302 ,x_return_status => x_return_status
303 ,x_msg_count => x_msg_count
304 ,x_msg_data => x_msg_data
305 );
306
307 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
308 l_msg_index := 1;
309 l_msg_count := x_msg_count;
310 WHILE l_msg_count > 0 LOOP
311 x_msg_data := FND_MSG_PUB.GET
312 (l_msg_index,
313 FND_API.G_FALSE);
314 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_ITEM_ASSOCIATIONS');
315 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
316 l_msg_index := l_msg_index + 1;
317 l_msg_count := l_msg_count - 1;
318 END LOOP;
319 RAISE FND_API.G_EXC_ERROR;
320 END IF;
321 END IF;
322 END LOOP;
323 END IF;
324
325 -- End of API body
326
327 -- Standard check of p_commit.
328 IF FND_API.To_Boolean( p_commit ) THEN
329 COMMIT WORK;
330 END IF;
331
332 EXCEPTION
333 WHEN FND_API.G_EXC_ERROR THEN
334 x_return_status := FND_API.G_RET_STS_ERROR ;
335 ROLLBACK TO create_counter_group;
336 FND_MSG_PUB.Count_And_Get
337 (p_count => x_msg_count,
338 p_data => x_msg_data
339 );
340
341 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
342 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
343 ROLLBACK TO create_counter_group;
344 FND_MSG_PUB.Count_And_Get
345 (p_count => x_msg_count,
346 p_data => x_msg_data
347 );
348 WHEN OTHERS THEN
349 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
350 ROLLBACK TO create_counter_group;
351 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
352 THEN
353 FND_MSG_PUB.Add_Exc_Msg
354 (G_PKG_NAME,
355 l_api_name
356 );
357 END IF;
358 FND_MSG_PUB.Count_And_Get
359 (p_count => x_msg_count,
360 p_data => x_msg_data
361 );
362
363 END create_counter_group;
364
365
366 --|---------------------------------------------------
370 --| counter group or counters
367 --| procedure name: create_item_association
368 --| description : procedure used to
369 --| create item association to
371 --|---------------------------------------------------
372 /*#
373 * This procedure is used to create counter item associations
374 * @param p_api_version Current API version
375 * @param p_commit API commits if set to fnd_api.g_true
376 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
377 * @param p_validation_level API validation level
378 * @param p_ctr_item_associations_rec Counter Item Associations Record structure
379 * @param x_return_status API Return Status
380 * @param x_msg_count Message count
381 * @param x_msg_data Message Data
382 * @rep:scope public
383 * @rep:lifecycle active
384 * @rep:displayname Create Item Association
385 */
386
387 PROCEDURE create_item_association
388 (
389 p_api_version IN NUMBER
390 ,p_commit IN VARCHAR2
391 ,p_init_msg_list IN VARCHAR2
392 ,p_validation_level IN NUMBER
393 ,p_ctr_item_associations_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_item_associations_rec
394 ,x_return_status OUT NOCOPY VARCHAR2
395 ,x_msg_count OUT NOCOPY NUMBER
396 ,x_msg_data OUT NOCOPY VARCHAR2
397 )
398 IS
399 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_ITEM_ASSOCIATION';
400 l_api_version CONSTANT NUMBER := 1.0;
401 -- l_debug_level NUMBER;
402 l_flag VARCHAR2(1) := 'N';
403 l_msg_data VARCHAR2(2000);
404 l_msg_index NUMBER;
405 l_msg_count NUMBER;
406
407 l_count NUMBER;
408 l_return_message VARCHAR2(100);
409
410 BEGIN
411 -- Standard Start of API savepoint
412 SAVEPOINT create_item_association;
413
414 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
415
416 -- csi_ctr_gen_utility_pvt.check_ib_active;
417
418 -- Standard call to check for call compatibility.
419 IF NOT FND_API.Compatible_API_Call (l_api_version,
420 p_api_version,
421 l_api_name ,
422 G_PKG_NAME )
423 THEN
424 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
425 END IF;
426
427 -- Initialize message list if p_init_msg_list is set to TRUE.
428 IF FND_API.to_Boolean( p_init_msg_list ) THEN
429 FND_MSG_PUB.initialize;
430 END IF;
431
432 -- Initialize API return status to success
433 x_return_status := FND_API.G_RET_STS_SUCCESS;
434
435 -- Read the debug profiles values in to global variable 7197402
436 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
437
438 -- Check the profile option debug_level for debug message reporting
439 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
440
441 -- If debug_level = 1 then dump the procedure name
442 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
443 csi_ctr_gen_utility_pvt.put_line( 'create_item_association');
444 END IF;
445
446 -- If the debug level = 2 then dump all the parameters values.
447 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
448 csi_ctr_gen_utility_pvt.put_line('create_item_association' ||
449 p_api_version ||'-'||
450 p_commit ||'-'||
451 p_init_msg_list ||'-'||
452 p_validation_level );
453 csi_ctr_gen_utility_pvt.dump_ctr_item_assoc_rec(p_ctr_item_associations_rec);
454 END IF;
455
456 -- Calling Customer Pre-processing Hook
457 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
458 CSI_COUNTER_TEMPLATE_CUHK.CREATE_ITEM_ASSOCIATION_PRE
459 (
460 p_api_version => p_api_version
461 ,p_commit => p_commit
462 ,p_init_msg_list => p_init_msg_list
463 ,p_validation_level => p_validation_level
464 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
465 ,x_return_status => x_return_status
466 ,x_msg_count => x_msg_count
467 ,x_msg_data => x_msg_data
468 );
469 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
470 l_msg_index := 1;
471 l_msg_count := x_msg_count;
472 WHILE l_msg_count > 0 LOOP
473 x_msg_data := FND_MSG_PUB.GET
474 ( l_msg_index,
475 FND_API.G_FALSE
476 );
477 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.CREATE_ITEM_ASSOCIATION_PRE API ');
478 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
479 l_msg_index := l_msg_index + 1;
480 l_msg_count := l_msg_count - 1;
481 END LOOP;
482 RAISE FND_API.G_EXC_ERROR;
483 END IF;
484 END IF;
485 --
486 -- Calling Vertical Pre-processing Hook
487 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
488 CSI_COUNTER_TEMPLATE_VUHK.CREATE_ITEM_ASSOCIATION_PRE
492 ,p_init_msg_list => p_init_msg_list
489 (
490 p_api_version => p_api_version
491 ,p_commit => p_commit
493 ,p_validation_level => p_validation_level
494 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
495 ,x_return_status => x_return_status
496 ,x_msg_count => x_msg_count
497 ,x_msg_data => x_msg_data
498 );
499 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
500 l_msg_index := 1;
501 l_msg_count := x_msg_count;
502 WHILE l_msg_count > 0 LOOP
503 x_msg_data := FND_MSG_PUB.GET
504 ( l_msg_index,
505 FND_API.G_FALSE
506 );
507 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.CREATE_ITEM_ASSOCIATION_PRE API ');
508 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
509 l_msg_index := l_msg_index + 1;
510 l_msg_count := l_msg_count - 1;
511 END LOOP;
512 RAISE FND_API.G_EXC_ERROR;
513 END IF;
514 END IF;
515
516 csi_counter_template_pvt.create_item_association
517 (
518 p_api_version => p_api_version
519 ,p_commit => fnd_api.g_false
520 ,p_init_msg_list => p_init_msg_list
521 ,p_validation_level => p_validation_level
522 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
523 ,x_return_status => x_return_status
524 ,x_msg_count => x_msg_count
525 ,x_msg_data => x_msg_data
526 );
527
528 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
529 l_msg_index := 1;
530 l_msg_count := x_msg_count;
531
532 WHILE l_msg_count > 0 LOOP
533 x_msg_data := FND_MSG_PUB.GET
534 (l_msg_index,
535 FND_API.G_FALSE );
536 csi_ctr_gen_utility_pvt.put_line(' Error from CSI_COUNTER_TEMPLATE_PVT.CREATE_ITEM_ASSOCIATION');
537 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
538 l_msg_index := l_msg_index + 1;
539 l_msg_count := l_msg_count - 1;
540 END LOOP;
541 RAISE FND_API.G_EXC_ERROR;
542 END IF;
543
544 -- Calling Post Customer User Hook
545 BEGIN
546 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
547 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.CREATE_ITEM_ASSOCIATION_Post ..');
548 CSI_COUNTER_TEMPLATE_CUHK.CREATE_ITEM_ASSOCIATION_Post
549 (
550 p_api_version => 1.0
551 ,p_commit => fnd_api.g_false
552 ,p_init_msg_list => fnd_api.g_false
553 ,p_validation_level => fnd_api.g_valid_level_full
554 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
555 ,x_return_status => x_return_status
556 ,x_msg_count => x_msg_count
557 ,x_msg_data => x_msg_data
558 );
559 --
560 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
561 l_msg_index := 1;
562 l_msg_count := x_msg_count;
563 WHILE l_msg_count > 0 LOOP
564 x_msg_data := FND_MSG_PUB.GET
565 ( l_msg_index,
566 FND_API.G_FALSE );
567 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.CREATE_ITEM_ASSOCIATION_Post API ');
568 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
569 l_msg_index := l_msg_index + 1;
570 l_msg_count := l_msg_count - 1;
571 END LOOP;
572 RAISE FND_API.G_EXC_ERROR;
573 END IF;
574 --
575 END IF;
576 EXCEPTION
577 WHEN OTHERS THEN
578 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
579 RAISE FND_API.G_EXC_ERROR;
580 END;
581 --
582 -- Calling Post Vertical User Hook
583 BEGIN
584
585 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
586 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.CREATE_ITEM_ASSOCIATION_Post ..');
587 CSI_COUNTER_TEMPLATE_VUHK.CREATE_ITEM_ASSOCIATION_Post
588 (
589 p_api_version => 1.0
590 ,p_commit => fnd_api.g_false
591 ,p_init_msg_list => fnd_api.g_false
592 ,p_validation_level => fnd_api.g_valid_level_full
593 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
594 ,x_return_status => x_return_status
595 ,x_msg_count => x_msg_count
596 ,x_msg_data => x_msg_data
597 );
598 --
599 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
600 l_msg_index := 1;
601 l_msg_count := x_msg_count;
602 WHILE l_msg_count > 0 LOOP
603 x_msg_data := FND_MSG_PUB.GET
604 ( l_msg_index,
605 FND_API.G_FALSE );
609 l_msg_count := l_msg_count - 1;
606 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.CREATE_ITEM_ASSOCIATION_Post API ');
607 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
608 l_msg_index := l_msg_index + 1;
610 END LOOP;
611 RAISE FND_API.G_EXC_ERROR;
612 END IF;
613 --
614 END IF;
615 EXCEPTION
616 WHEN OTHERS THEN
617 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
618 RAISE FND_API.G_EXC_ERROR;
619 END;
620 -- End of POST User Hooks
621
622 -- End of API body
623
624 -- Standard check of p_commit.
625 IF FND_API.To_Boolean( p_commit ) THEN
626 COMMIT WORK;
627 END IF;
628
629 EXCEPTION
630 WHEN FND_API.G_EXC_ERROR THEN
631 x_return_status := FND_API.G_RET_STS_ERROR ;
632 ROLLBACK TO create_item_association;
633 FND_MSG_PUB.Count_And_Get
634 (p_count => x_msg_count,
635 p_data => x_msg_data
636 );
637
638 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
639 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
640 ROLLBACK TO create_item_association;
641 FND_MSG_PUB.Count_And_Get
642 (p_count => x_msg_count,
643 p_data => x_msg_data
644 );
645 WHEN OTHERS THEN
646 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
647 ROLLBACK TO create_item_association;
648 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
649 THEN
650 FND_MSG_PUB.Add_Exc_Msg
651 (G_PKG_NAME,
652 l_api_name
653 );
654 END IF;
655 FND_MSG_PUB.Count_And_Get
656 (p_count => x_msg_count,
657 p_data => x_msg_data
658 );
659
660 END create_item_association;
661
662 --|---------------------------------------------------
663 --| procedure name: create_counter_template
664 --| description : procedure used to
665 --| create counter template
666 --|---------------------------------------------------
667 /*#
668 * This procedure is used to create counter template.
669 * This will also create Item Association, Properties
670 * derived filters, relationships.
671 * @param p_api_version Current API version
672 * @param p_commit API commits if set to fnd_api.g_true
673 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
674 * @param p_validation_level API validation level
675 * @param p_counter_template_rec Counter Template Record structure
676 * @param p_ctr_item_associations_tbl Counter Item Associations Table structure
677 * @param p_ctr_property_template_tbl Counter property template Table structure
678 * @param p_counter_relationships_tbl Counter relationships Table structure
679 * @param p_ctr_derived_filters_tbl Counter Derived Filters Table structure
680 * @param x_return_status API Return Status
681 * @param x_msg_count Message count
682 * @param x_msg_data Message Data
683 * @rep:scope public
684 * @rep:lifecycle active
685 * @rep:displayname Create Counter Template
686 */
687
688 PROCEDURE create_counter_template
689 (
690 p_api_version IN NUMBER
691 ,p_commit IN VARCHAR2
692 ,p_init_msg_list IN VARCHAR2
693 ,p_validation_level IN NUMBER
694 ,p_counter_template_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.counter_template_rec
695 ,p_ctr_item_associations_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_item_associations_tbl
696 ,p_ctr_property_template_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_property_template_tbl
697 ,p_counter_relationships_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.counter_relationships_tbl
698 ,p_ctr_derived_filters_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_derived_filters_tbl
699 ,x_return_status OUT NOCOPY VARCHAR2
700 ,x_msg_count OUT NOCOPY NUMBER
701 ,x_msg_data OUT NOCOPY VARCHAR2
702 )
703 IS
704 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_COUNTER_TEMPLATE';
705 l_api_version CONSTANT NUMBER := 1.0;
706 -- l_debug_level NUMBER;
707 l_flag VARCHAR2(1) := 'N';
708 l_msg_data VARCHAR2(2000);
709 l_msg_index NUMBER;
710 l_msg_count NUMBER;
711
712 l_count NUMBER;
713 l_return_message VARCHAR2(100);
714
715 BEGIN
716 -- Standard Start of API savepoint
717 SAVEPOINT create_counter_template ;
718
719 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
720
721 -- csi_ctr_gen_utility_pvt.check_ib_active;
722
723 -- Standard call to check for call compatibility.
724 IF NOT FND_API.Compatible_API_Call (l_api_version,
725 p_api_version,
726 l_api_name ,
727 G_PKG_NAME )
728 THEN
729 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
730 END IF;
731
735 END IF;
732 -- Initialize message list if p_init_msg_list is set to TRUE.
733 IF FND_API.to_Boolean( p_init_msg_list ) THEN
734 FND_MSG_PUB.initialize;
736
737 -- Initialize API return status to success
738 x_return_status := FND_API.G_RET_STS_SUCCESS;
739
740 -- Read the debug profiles values in to global variable 7197402
741 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
742
743 -- Check the profile option debug_level for debug message reporting
744 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
745
746 -- If debug_level = 1 then dump the procedure name
747 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
748 csi_ctr_gen_utility_pvt.put_line( 'create_counter_template');
749 END IF;
750
751 -- If the debug level = 2 then dump all the parameters values.
752 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
753 csi_ctr_gen_utility_pvt.put_line( 'create_counter_template' ||
754 p_api_version ||'-'||
755 p_commit ||'-'||
756 p_init_msg_list ||'-'||
757 p_validation_level );
758 csi_ctr_gen_utility_pvt.dump_ctr_template_rec(p_counter_template_rec);
759 END IF;
760
761 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
762 CSI_COUNTER_TEMPLATE_CUHK.create_counter_template_pre
763 (
764 p_api_version => p_api_version
765 ,p_commit => p_commit
766 ,p_init_msg_list => p_init_msg_list
767 ,p_validation_level => p_validation_level
768 ,p_counter_template_rec => p_counter_template_rec
769 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
770 ,p_ctr_property_template_tbl => p_ctr_property_template_tbl
771 ,p_counter_relationships_tbl => p_counter_relationships_tbl
772 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
773 ,x_return_status => x_return_status
774 ,x_msg_count => x_msg_count
775 ,x_msg_data => x_msg_data
776 );
777 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
778 l_msg_index := 1;
779 l_msg_count := x_msg_count;
780 WHILE l_msg_count > 0 LOOP
781 x_msg_data := FND_MSG_PUB.GET
782 ( l_msg_index,
783 FND_API.G_FALSE
784 );
785 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_counter_template_pre API ');
786 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
787 l_msg_index := l_msg_index + 1;
788 l_msg_count := l_msg_count - 1;
789 END LOOP;
790 RAISE FND_API.G_EXC_ERROR;
791 END IF;
792 END IF;
793 --
794 -- Calling Vertical Pre-processing Hook
795 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
796 CSI_COUNTER_TEMPLATE_VUHK.create_counter_template_pre
797 (
798 p_api_version => p_api_version
799 ,p_commit => p_commit
800 ,p_init_msg_list => p_init_msg_list
801 ,p_validation_level => p_validation_level
802 ,p_counter_template_rec => p_counter_template_rec
803 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
804 ,p_ctr_property_template_tbl => p_ctr_property_template_tbl
805 ,p_counter_relationships_tbl => p_counter_relationships_tbl
806 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
807 ,x_return_status => x_return_status
808 ,x_msg_count => x_msg_count
809 ,x_msg_data => x_msg_data
810 );
811 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
812 l_msg_index := 1;
813 l_msg_count := x_msg_count;
814 WHILE l_msg_count > 0 LOOP
815 x_msg_data := FND_MSG_PUB.GET
816 ( l_msg_index,
817 FND_API.G_FALSE
818 );
819 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_counter_template_pre API ');
820 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
821 l_msg_index := l_msg_index + 1;
822 l_msg_count := l_msg_count - 1;
823 END LOOP;
824 RAISE FND_API.G_EXC_ERROR;
825 END IF;
826 END IF;
827
828 csi_counter_template_pvt.create_counter_template
829 (
830 p_api_version => p_api_version
831 ,p_commit => fnd_api.g_false
832 ,p_init_msg_list => p_init_msg_list
833 ,p_validation_level => p_validation_level
834 ,p_counter_template_rec => p_counter_template_rec
835 ,x_return_status => x_return_status
836 ,x_msg_count => x_msg_count
837 ,x_msg_data => x_msg_data
838 );
839
840 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
841 l_msg_index := 1;
842 l_msg_count := x_msg_count;
843
844 WHILE l_msg_count > 0 LOOP
845 x_msg_data := FND_MSG_PUB.GET
846 (l_msg_index,
850 l_msg_index := l_msg_index + 1;
847 FND_API.G_FALSE );
848 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.CREATE_COUNTER_TEMPLATE');
849 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
851 l_msg_count := l_msg_count - 1;
852 END LOOP;
853 RAISE FND_API.G_EXC_ERROR;
854 END IF;
855
856 -- Calling Post Customer User Hook
857 BEGIN
858 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
859 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.create_counter_template_Post ..');
860 CSI_COUNTER_TEMPLATE_CUHK.create_counter_template_Post
861 (
862 p_api_version => 1.0
863 ,p_commit => fnd_api.g_false
864 ,p_init_msg_list => fnd_api.g_false
865 ,p_validation_level => fnd_api.g_valid_level_full
866 ,p_counter_template_rec => p_counter_template_rec
867 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
868 ,p_ctr_property_template_tbl => p_ctr_property_template_tbl
869 ,p_counter_relationships_tbl => p_counter_relationships_tbl
870 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
871 ,x_return_status => x_return_status
872 ,x_msg_count => x_msg_count
873 ,x_msg_data => x_msg_data
874 );
875 --
876 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
877 l_msg_index := 1;
878 l_msg_count := x_msg_count;
879 WHILE l_msg_count > 0 LOOP
880 x_msg_data := FND_MSG_PUB.GET
881 ( l_msg_index,
882 FND_API.G_FALSE );
883 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_counter_template_Post API ');
884 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
885 l_msg_index := l_msg_index + 1;
886 l_msg_count := l_msg_count - 1;
887 END LOOP;
888 RAISE FND_API.G_EXC_ERROR;
889 END IF;
890 --
891 END IF;
892 EXCEPTION
893 WHEN OTHERS THEN
894 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
895 RAISE FND_API.G_EXC_ERROR;
896 END;
897 --
898 -- Calling Post Vertical User Hook
899 BEGIN
900
901 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
902 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.create_counter_template_Post ..');
903 CSI_COUNTER_TEMPLATE_VUHK.create_counter_template_Post
904 (
905 p_api_version => 1.0
906 ,p_commit => fnd_api.g_false
907 ,p_init_msg_list => fnd_api.g_false
908 ,p_validation_level => fnd_api.g_valid_level_full
909 ,p_counter_template_rec => p_counter_template_rec
910 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
911 ,p_ctr_property_template_tbl => p_ctr_property_template_tbl
912 ,p_counter_relationships_tbl => p_counter_relationships_tbl
913 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
914 ,x_return_status => x_return_status
915 ,x_msg_count => x_msg_count
916 ,x_msg_data => x_msg_data
917 );
918 --
919 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
920 l_msg_index := 1;
921 l_msg_count := x_msg_count;
922 WHILE l_msg_count > 0 LOOP
923 x_msg_data := FND_MSG_PUB.GET
924 ( l_msg_index,
925 FND_API.G_FALSE );
926 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_counter_template_Post API ');
927 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
928 l_msg_index := l_msg_index + 1;
929 l_msg_count := l_msg_count - 1;
930 END LOOP;
931 RAISE FND_API.G_EXC_ERROR;
932 END IF;
933 --
934 END IF;
935 EXCEPTION
936 WHEN OTHERS THEN
937 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
938 RAISE FND_API.G_EXC_ERROR;
939 END;
940 -- End of POST User Hooks
941
942
943 IF (p_ctr_item_associations_tbl.count > 0) THEN
944 FOR tab_row IN p_ctr_item_associations_tbl.FIRST .. p_ctr_item_associations_tbl.LAST
945 LOOP
946 IF p_ctr_item_associations_tbl.EXISTS(tab_row) THEN
947 p_ctr_item_associations_tbl(tab_row).counter_id := p_counter_template_rec.counter_id;
948
949 create_item_association
950 (
951 p_api_version => p_api_version
952 ,p_commit => fnd_api.g_false
953 ,p_init_msg_list => p_init_msg_list
954 ,p_validation_level => p_validation_level
955 ,p_ctr_item_associations_rec => p_ctr_item_associations_tbl(tab_row)
956 ,x_return_status => x_return_status
957 ,x_msg_count => x_msg_count
961 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
958 ,x_msg_data => x_msg_data
959 );
960
962 l_msg_index := 1;
963 l_msg_count := x_msg_count;
964 WHILE l_msg_count > 0 LOOP
965 x_msg_data := FND_MSG_PUB.GET
966 (l_msg_index,
967 FND_API.G_FALSE);
968 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_ITEM_ASSOCIATIONS');
969 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
970 l_msg_index := l_msg_index + 1;
971 l_msg_count := l_msg_count - 1;
972 END LOOP;
973 RAISE FND_API.G_EXC_ERROR;
974 END IF;
975 END IF;
976 END LOOP;
977 END IF;
978
979 IF (p_ctr_property_template_tbl.count > 0) THEN
980 FOR tab_row IN p_ctr_property_template_tbl.FIRST .. p_ctr_property_template_tbl.LAST
981 LOOP
982 IF p_ctr_property_template_tbl.EXISTS(tab_row) THEN
983 p_ctr_property_template_tbl(tab_row).counter_id := p_counter_template_rec.counter_id;
984
985 create_ctr_property_template
986 (
987 p_api_version => p_api_version
988 ,p_commit => fnd_api.g_false
989 ,p_init_msg_list => p_init_msg_list
990 ,p_validation_level => p_validation_level
991 ,p_ctr_property_template_rec => p_ctr_property_template_tbl(tab_row)
992 ,x_return_status => x_return_status
993 ,x_msg_count => x_msg_count
994 ,x_msg_data => x_msg_data
995 );
996
997 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
998 l_msg_index := 1;
999 l_msg_count := x_msg_count;
1000 WHILE l_msg_count > 0 LOOP
1001 x_msg_data := FND_MSG_PUB.GET
1002 (l_msg_index,
1003 FND_API.G_FALSE);
1004 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_CTR_PROPERTY_TEMPLATE');
1005 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1006 l_msg_index := l_msg_index + 1;
1007 l_msg_count := l_msg_count - 1;
1008 END LOOP;
1009 RAISE FND_API.G_EXC_ERROR;
1010 END IF;
1011 END IF;
1012 END LOOP;
1013 END IF;
1014
1015 IF p_counter_template_rec.counter_type = 'FORMULA' AND
1016 p_counter_template_rec.derive_function IS NULL THEN
1017
1018 csi_ctr_gen_utility_pvt.put_line(' Inside formula validation ');
1019 csi_ctr_gen_utility_pvt.put_line(' tbl count = '||to_char(p_counter_relationships_tbl.count));
1020 IF nvl(p_counter_relationships_tbl.count,0) = 0 THEN
1021 CSI_CTR_GEN_UTILITY_PVT.ExitWithErrMsg('CSI_API_CTR_REQ_FORMULA_REF');
1022 END IF;
1023 END IF;
1024
1025 IF (p_counter_relationships_tbl.count > 0) THEN
1026 FOR tab_row IN p_counter_relationships_tbl.FIRST .. p_counter_relationships_tbl.LAST
1027 LOOP
1028 IF p_counter_relationships_tbl.EXISTS(tab_row) THEN
1029 p_counter_relationships_tbl(tab_row).object_counter_id := p_counter_template_rec.counter_id;
1030
1031 create_counter_relationship
1032 (
1033 p_api_version => p_api_version
1034 ,p_commit => fnd_api.g_false
1035 ,p_init_msg_list => p_init_msg_list
1036 ,p_validation_level => p_validation_level
1037 ,p_counter_relationships_rec => p_counter_relationships_tbl(tab_row)
1038 ,x_return_status => x_return_status
1039 ,x_msg_count => x_msg_count
1040 ,x_msg_data => x_msg_data
1041 );
1042
1043 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1044 l_msg_index := 1;
1045 l_msg_count := x_msg_count;
1046 WHILE l_msg_count > 0 LOOP
1047 x_msg_data := FND_MSG_PUB.GET
1048 (l_msg_index,
1049 FND_API.G_FALSE);
1050 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_COUNTER_RELATIONSHIP');
1051 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1052 l_msg_index := l_msg_index + 1;
1053 l_msg_count := l_msg_count - 1;
1054 END LOOP;
1055 RAISE FND_API.G_EXC_ERROR;
1056 END IF;
1057 END IF;
1058 END LOOP;
1059 END IF;
1060
1061 IF (p_ctr_derived_filters_tbl.count > 0) THEN
1062 FOR tab_row IN p_ctr_derived_filters_tbl.FIRST .. p_ctr_derived_filters_tbl.LAST
1063 LOOP
1064 IF p_ctr_derived_filters_tbl.EXISTS(tab_row) THEN
1065 p_ctr_derived_filters_tbl(tab_row).counter_id := p_counter_template_rec.counter_id;
1066 END IF;
1067 END LOOP;
1068
1069 create_derived_filters
1070 (
1071 p_api_version => p_api_version
1072 ,p_commit => fnd_api.g_false
1073 ,p_init_msg_list => p_init_msg_list
1074 ,p_validation_level => p_validation_level
1075 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
1079 );
1076 ,x_return_status => x_return_status
1077 ,x_msg_count => x_msg_count
1078 ,x_msg_data => x_msg_data
1080
1081 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1082 l_msg_index := 1;
1083 l_msg_count := x_msg_count;
1084 WHILE l_msg_count > 0 LOOP
1085 x_msg_data := FND_MSG_PUB.GET
1086 (l_msg_index,
1087 FND_API.G_FALSE);
1088 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_DERIVED_FILTERS');
1089 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1090 l_msg_index := l_msg_index + 1;
1091 l_msg_count := l_msg_count - 1;
1092 END LOOP;
1093 RAISE FND_API.G_EXC_ERROR;
1094 END IF;
1095 -- END IF;
1096 -- END LOOP;
1097 END IF;
1098
1099 -- End of API body
1100 -- Standard check of p_commit.
1101 IF FND_API.To_Boolean( p_commit ) THEN
1102 COMMIT WORK;
1103 END IF;
1104
1105 EXCEPTION
1106 WHEN FND_API.G_EXC_ERROR THEN
1107 x_return_status := FND_API.G_RET_STS_ERROR ;
1108 ROLLBACK TO create_counter_template;
1109 FND_MSG_PUB.Count_And_Get
1110 (p_count => x_msg_count,
1111 p_data => x_msg_data
1112 );
1113
1114 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1115 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1116 ROLLBACK TO create_counter_template;
1117 FND_MSG_PUB.Count_And_Get
1118 (p_count => x_msg_count,
1119 p_data => x_msg_data
1120 );
1121 WHEN OTHERS THEN
1122 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1123 ROLLBACK TO create_counter_template;
1124 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1125 THEN
1126 FND_MSG_PUB.Add_Exc_Msg
1127 (G_PKG_NAME,
1128 l_api_name
1129 );
1130 END IF;
1131 FND_MSG_PUB.Count_And_Get
1132 (p_count => x_msg_count,
1133 p_data => x_msg_data
1134 );
1135
1136 END create_counter_template;
1137
1138
1139 --|---------------------------------------------------
1140 --| procedure name: create_ctr_property_template
1141 --| description : procedure used to
1142 --| create counter properties
1143 --|---------------------------------------------------
1144 /*#
1145 * This procedure is used to create counter property template.
1146 * @param p_api_version Current API version
1147 * @param p_commit API commits if set to fnd_api.g_true
1148 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
1149 * @param p_validation_level API validation level
1150 * @param p_ctr_property_template_rec Counter property template Record structure
1151 * @param x_return_status API Return Status
1152 * @param x_msg_count Message count
1153 * @param x_msg_data Message Data
1154 * @rep:scope public
1155 * @rep:lifecycle active
1156 * @rep:displayname Create Counter Property Template
1157 */
1158
1159 PROCEDURE create_ctr_property_template
1160 (
1161 p_api_version IN NUMBER
1162 ,p_commit IN VARCHAR2
1163 ,p_init_msg_list IN VARCHAR2
1164 ,p_validation_level IN NUMBER
1165 ,p_ctr_property_template_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_property_template_rec
1166 ,x_return_status OUT NOCOPY VARCHAR2
1167 ,x_msg_count OUT NOCOPY NUMBER
1168 ,x_msg_data OUT NOCOPY VARCHAR2
1169 )
1170 IS
1171 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_CTR_PROPERTY_TEMPLATE';
1172 l_api_version CONSTANT NUMBER := 1.0;
1173 -- l_debug_level NUMBER;
1174 l_flag VARCHAR2(1) := 'N';
1175 l_msg_data VARCHAR2(2000);
1176 l_msg_index NUMBER;
1177 l_msg_count NUMBER;
1178
1179 l_count NUMBER;
1180 l_return_message VARCHAR2(100);
1181
1182 BEGIN
1183 -- Standard Start of API savepoint
1184 SAVEPOINT create_ctr_property_template;
1185
1186 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
1187
1188 -- csi_ctr_gen_utility_pvt.check_ib_active;
1189
1190 -- Standard call to check for call compatibility.
1191 IF NOT FND_API.Compatible_API_Call (l_api_version,
1192 p_api_version,
1193 l_api_name ,
1194 G_PKG_NAME )
1195 THEN
1196 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1197 END IF;
1198
1199 -- Initialize message list if p_init_msg_list is set to TRUE.
1200 IF FND_API.to_Boolean( p_init_msg_list ) THEN
1201 FND_MSG_PUB.initialize;
1202 END IF;
1203
1204 -- Initialize API return status to success
1205 x_return_status := FND_API.G_RET_STS_SUCCESS;
1206
1207 -- Read the debug profiles values in to global variable 7197402
1208 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
1212
1209
1210 -- Check the profile option debug_level for debug message reporting
1211 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
1213 -- If debug_level = 1 then dump the procedure name
1214 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
1215 csi_ctr_gen_utility_pvt.put_line( 'create_ctr_property_template');
1216 END IF;
1217
1218 -- If the debug level = 2 then dump all the parameters values.
1219 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
1220 csi_ctr_gen_utility_pvt.put_line( 'create_ctr_property_template' ||
1221 p_api_version ||'-'||
1222 p_commit ||'-'||
1223 p_init_msg_list ||'-'||
1224 p_validation_level );
1225 csi_ctr_gen_utility_pvt.dump_ctr_property_template_rec(p_ctr_property_template_rec);
1226 END IF;
1227
1228 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
1229 CSI_COUNTER_TEMPLATE_CUHK.create_ctr_prop_template_pre
1230 (
1231 p_api_version => p_api_version
1232 ,p_commit => p_commit
1233 ,p_init_msg_list => p_init_msg_list
1234 ,p_validation_level => p_validation_level
1235 ,p_ctr_property_template_rec => p_ctr_property_template_rec
1236 ,x_return_status => x_return_status
1237 ,x_msg_count => x_msg_count
1238 ,x_msg_data => x_msg_data
1239 );
1240 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1241 l_msg_index := 1;
1242 l_msg_count := x_msg_count;
1243 WHILE l_msg_count > 0 LOOP
1244 x_msg_data := FND_MSG_PUB.GET
1245 ( l_msg_index,
1246 FND_API.G_FALSE
1247 );
1248 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_ctr_prop_template_pre API ');
1249 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1250 l_msg_index := l_msg_index + 1;
1251 l_msg_count := l_msg_count - 1;
1252 END LOOP;
1253 RAISE FND_API.G_EXC_ERROR;
1254 END IF;
1255 END IF;
1256 --
1257 -- Calling Vertical Pre-processing Hook
1258 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
1259 CSI_COUNTER_TEMPLATE_VUHK.create_ctr_prop_template_pre
1260 (
1261 p_api_version => p_api_version
1262 ,p_commit => p_commit
1263 ,p_init_msg_list => p_init_msg_list
1264 ,p_validation_level => p_validation_level
1265 ,p_ctr_property_template_rec => p_ctr_property_template_rec
1266 ,x_return_status => x_return_status
1267 ,x_msg_count => x_msg_count
1268 ,x_msg_data => x_msg_data
1269 );
1270 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1271 l_msg_index := 1;
1272 l_msg_count := x_msg_count;
1273 WHILE l_msg_count > 0 LOOP
1274 x_msg_data := FND_MSG_PUB.GET
1275 ( l_msg_index,
1276 FND_API.G_FALSE
1277 );
1278 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_ctr_prop_template_pre API ');
1279 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1280 l_msg_index := l_msg_index + 1;
1281 l_msg_count := l_msg_count - 1;
1282 END LOOP;
1283 RAISE FND_API.G_EXC_ERROR;
1284 END IF;
1285 END IF;
1286
1287 csi_counter_template_pvt.create_ctr_property_template
1288 (
1289 p_api_version => p_api_version
1290 ,p_commit => fnd_api.g_false
1291 ,p_init_msg_list => p_init_msg_list
1292 ,p_validation_level => p_validation_level
1293 ,p_ctr_property_template_rec => p_ctr_property_template_rec
1294 ,x_return_status => x_return_status
1295 ,x_msg_count => x_msg_count
1296 ,x_msg_data => x_msg_data
1297 );
1298
1299 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1300 l_msg_index := 1;
1301 l_msg_count := x_msg_count;
1302
1303 WHILE l_msg_count > 0 LOOP
1304 x_msg_data := FND_MSG_PUB.GET
1305 (l_msg_index,
1306 FND_API.G_FALSE );
1307 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.CREATE_CTR_PROPERTY_TEMPLATE');
1308 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1309 l_msg_index := l_msg_index + 1;
1310 l_msg_count := l_msg_count - 1;
1311 END LOOP;
1312 RAISE FND_API.G_EXC_ERROR;
1313 END IF;
1314
1315 -- Calling Post Customer User Hook
1316 BEGIN
1317 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
1318 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.create_ctr_prop_template_Post ..');
1319 CSI_COUNTER_TEMPLATE_CUHK.create_ctr_prop_template_Post
1320 (
1321 p_api_version => 1.0
1322 ,p_commit => fnd_api.g_false
1323 ,p_init_msg_list => fnd_api.g_false
1327 ,x_msg_count => x_msg_count
1324 ,p_validation_level => fnd_api.g_valid_level_full
1325 ,p_ctr_property_template_rec => p_ctr_property_template_rec
1326 ,x_return_status => x_return_status
1328 ,x_msg_data => x_msg_data
1329 );
1330 --
1331 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1332 l_msg_index := 1;
1333 l_msg_count := x_msg_count;
1334 WHILE l_msg_count > 0 LOOP
1335 x_msg_data := FND_MSG_PUB.GET
1336 ( l_msg_index,
1337 FND_API.G_FALSE );
1338 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_ctr_prop_template_Post API ');
1339 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1340 l_msg_index := l_msg_index + 1;
1341 l_msg_count := l_msg_count - 1;
1342 END LOOP;
1343 RAISE FND_API.G_EXC_ERROR;
1344 END IF;
1345 --
1346 END IF;
1347 EXCEPTION
1348 WHEN OTHERS THEN
1349 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
1350 RAISE FND_API.G_EXC_ERROR;
1351 END;
1352 --
1353 -- Calling Post Vertical User Hook
1354 BEGIN
1355
1356 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
1357 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.create_ctr_prop_template_Post ..');
1358 CSI_COUNTER_TEMPLATE_VUHK.create_ctr_prop_template_Post
1359 (
1360 p_api_version => 1.0
1361 ,p_commit => fnd_api.g_false
1362 ,p_init_msg_list => fnd_api.g_false
1363 ,p_validation_level => fnd_api.g_valid_level_full
1364 ,p_ctr_property_template_rec => p_ctr_property_template_rec
1365 ,x_return_status => x_return_status
1366 ,x_msg_count => x_msg_count
1367 ,x_msg_data => x_msg_data
1368 );
1369 --
1370 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1371 l_msg_index := 1;
1372 l_msg_count := x_msg_count;
1373 WHILE l_msg_count > 0 LOOP
1374 x_msg_data := FND_MSG_PUB.GET
1375 ( l_msg_index,
1376 FND_API.G_FALSE );
1377 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_ctr_prop_template_Post API ');
1378 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1379 l_msg_index := l_msg_index + 1;
1380 l_msg_count := l_msg_count - 1;
1381 END LOOP;
1382 RAISE FND_API.G_EXC_ERROR;
1383 END IF;
1384 --
1385 END IF;
1386 EXCEPTION
1387 WHEN OTHERS THEN
1388 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
1389 RAISE FND_API.G_EXC_ERROR;
1390 END;
1391 -- End of POST User Hooks
1392
1393 -- End of API body
1394
1395 -- Standard check of p_commit.
1396 IF FND_API.To_Boolean( p_commit ) THEN
1397 COMMIT WORK;
1398 END IF;
1399
1400 EXCEPTION
1401 WHEN FND_API.G_EXC_ERROR THEN
1402 x_return_status := FND_API.G_RET_STS_ERROR ;
1403 ROLLBACK TO create_ctr_property_template;
1404 FND_MSG_PUB.Count_And_Get
1405 (p_count => x_msg_count,
1406 p_data => x_msg_data
1407 );
1408
1409 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1410 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1411 ROLLBACK TO create_ctr_property_template;
1412 FND_MSG_PUB.Count_And_Get
1413 (p_count => x_msg_count,
1414 p_data => x_msg_data
1415 );
1416 WHEN OTHERS THEN
1417 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1418 ROLLBACK TO create_ctr_property_template;
1419 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1420 THEN
1421 FND_MSG_PUB.Add_Exc_Msg
1422 (G_PKG_NAME,
1423 l_api_name
1424 );
1425 END IF;
1426 FND_MSG_PUB.Count_And_Get
1427 (p_count => x_msg_count,
1428 p_data => x_msg_data
1429 );
1430
1431 END create_ctr_property_template;
1432
1433 --|---------------------------------------------------
1434 --| procedure name: create_counter_relationship
1435 --| description : procedure used to
1436 --| create counter relationship
1437 --|---------------------------------------------------
1438 /*#
1439 * This procedure is used to create counter relationships.
1440 * @param p_api_version Current API version
1441 * @param p_commit API commits if set to fnd_api.g_true
1442 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
1443 * @param p_validation_level API validation level
1444 * @param p_counter_relationships_rec Counter relationships Record structure
1445 * @param x_return_status API Return Status
1446 * @param x_msg_count Message count
1447 * @param x_msg_data Message Data
1448 * @rep:scope public
1449 * @rep:lifecycle active
1450 * @rep:displayname Create Counter Relationships
1451 */
1455 p_api_version IN NUMBER
1452
1453 PROCEDURE create_counter_relationship
1454 (
1456 ,p_commit IN VARCHAR2
1457 ,p_init_msg_list IN VARCHAR2
1458 ,p_validation_level IN NUMBER
1459 ,p_counter_relationships_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.counter_relationships_rec
1460 ,x_return_status OUT NOCOPY VARCHAR2
1461 ,x_msg_count OUT NOCOPY NUMBER
1462 ,x_msg_data OUT NOCOPY VARCHAR2
1463 )
1464 IS
1465 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_COUNTER_RELATIONSHIP';
1466 l_api_version CONSTANT NUMBER := 1.0;
1467 -- l_debug_level NUMBER;
1468 l_flag VARCHAR2(1) := 'N';
1469 l_msg_data VARCHAR2(2000);
1470 l_msg_index NUMBER;
1471 l_msg_count NUMBER;
1472
1473 l_count NUMBER;
1474 l_return_message VARCHAR2(100);
1475
1476 BEGIN
1477 -- Standard Start of API savepoint
1478 SAVEPOINT create_counter_relationship;
1479
1480 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
1481
1482 -- csi_ctr_gen_utility_pvt.check_ib_active;
1483
1484 -- Standard call to check for call compatibility.
1485 IF NOT FND_API.Compatible_API_Call (l_api_version,
1486 p_api_version,
1487 l_api_name ,
1488 G_PKG_NAME )
1489 THEN
1490 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1491 END IF;
1492
1493 -- Initialize message list if p_init_msg_list is set to TRUE.
1494 IF FND_API.to_Boolean( p_init_msg_list ) THEN
1495 FND_MSG_PUB.initialize;
1496 END IF;
1497
1498 -- Initialize API return status to success
1499 x_return_status := FND_API.G_RET_STS_SUCCESS;
1500
1501 -- Read the debug profiles values in to global variable 7197402
1502 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
1503
1504 -- Check the profile option debug_level for debug message reporting
1505 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
1506
1507 -- If debug_level = 1 then dump the procedure name
1508 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
1509 csi_ctr_gen_utility_pvt.put_line( 'create_counter_relationship');
1510 END IF;
1511
1512 -- If the debug level = 2 then dump all the parameters values.
1513 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
1514 csi_ctr_gen_utility_pvt.put_line( 'create_counter_relationship' ||
1515 p_api_version ||'-'||
1516 p_commit ||'-'||
1517 p_init_msg_list ||'-'||
1518 p_validation_level );
1519 csi_ctr_gen_utility_pvt.dump_ctr_relationship_rec(p_counter_relationships_rec);
1520 END IF;
1521
1522 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
1523 CSI_COUNTER_TEMPLATE_CUHK.create_ctr_relationship_pre
1524 (
1525 p_api_version => p_api_version
1526 ,p_commit => p_commit
1527 ,p_init_msg_list => p_init_msg_list
1528 ,p_validation_level => p_validation_level
1529 ,p_counter_relationships_rec => p_counter_relationships_rec
1530 ,x_return_status => x_return_status
1531 ,x_msg_count => x_msg_count
1532 ,x_msg_data => x_msg_data
1533 );
1534 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1535 l_msg_index := 1;
1536 l_msg_count := x_msg_count;
1537 WHILE l_msg_count > 0 LOOP
1538 x_msg_data := FND_MSG_PUB.GET
1539 ( l_msg_index,
1540 FND_API.G_FALSE
1541 );
1542 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_ctr_relationship_pre API ');
1543 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1544 l_msg_index := l_msg_index + 1;
1545 l_msg_count := l_msg_count - 1;
1546 END LOOP;
1547 RAISE FND_API.G_EXC_ERROR;
1548 END IF;
1549 END IF;
1550 --
1551 -- Calling Vertical Pre-processing Hook
1552 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
1553 CSI_COUNTER_TEMPLATE_VUHK.create_ctr_relationship_pre
1554 (
1555 p_api_version => p_api_version
1556 ,p_commit => p_commit
1557 ,p_init_msg_list => p_init_msg_list
1558 ,p_validation_level => p_validation_level
1559 ,p_counter_relationships_rec => p_counter_relationships_rec
1560 ,x_return_status => x_return_status
1561 ,x_msg_count => x_msg_count
1562 ,x_msg_data => x_msg_data
1563 );
1564 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1565 l_msg_index := 1;
1566 l_msg_count := x_msg_count;
1567 WHILE l_msg_count > 0 LOOP
1568 x_msg_data := FND_MSG_PUB.GET
1569 ( l_msg_index,
1570 FND_API.G_FALSE
1571 );
1575 l_msg_count := l_msg_count - 1;
1572 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_ctr_relationship_pre API ');
1573 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1574 l_msg_index := l_msg_index + 1;
1576 END LOOP;
1577 RAISE FND_API.G_EXC_ERROR;
1578 END IF;
1579 END IF;
1580
1581 csi_counter_template_pvt.create_counter_relationship
1582 (
1583 p_api_version => p_api_version
1584 ,p_commit => fnd_api.g_false
1585 ,p_init_msg_list => p_init_msg_list
1586 ,p_validation_level => p_validation_level
1587 ,p_counter_relationships_rec => p_counter_relationships_rec
1588 ,x_return_status => x_return_status
1589 ,x_msg_count => x_msg_count
1590 ,x_msg_data => x_msg_data
1591 );
1592
1593 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1594 l_msg_index := 1;
1595 l_msg_count := x_msg_count;
1596
1597 WHILE l_msg_count > 0 LOOP
1598 x_msg_data := FND_MSG_PUB.GET
1599 (l_msg_index,
1600 FND_API.G_FALSE );
1601 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.CREATE_COUNTER_RELATIONSHIP');
1602 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1603 l_msg_index := l_msg_index + 1;
1604 l_msg_count := l_msg_count - 1;
1605 END LOOP;
1606 RAISE FND_API.G_EXC_ERROR;
1607 END IF;
1608
1609 -- Calling Post Customer User Hook
1610 BEGIN
1611 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
1612 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.create_ctr_relationship_Post ..');
1613 CSI_COUNTER_TEMPLATE_CUHK.create_ctr_relationship_Post
1614 (
1615 p_api_version => 1.0
1616 ,p_commit => fnd_api.g_false
1617 ,p_init_msg_list => fnd_api.g_false
1618 ,p_validation_level => fnd_api.g_valid_level_full
1619 ,p_counter_relationships_rec => p_counter_relationships_rec
1620 ,x_return_status => x_return_status
1621 ,x_msg_count => x_msg_count
1622 ,x_msg_data => x_msg_data
1623 );
1624 --
1625 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1626 l_msg_index := 1;
1627 l_msg_count := x_msg_count;
1628 WHILE l_msg_count > 0 LOOP
1629 x_msg_data := FND_MSG_PUB.GET
1630 ( l_msg_index,
1631 FND_API.G_FALSE );
1632 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_ctr_relationship_Post API ');
1633 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1634 l_msg_index := l_msg_index + 1;
1635 l_msg_count := l_msg_count - 1;
1636 END LOOP;
1637 RAISE FND_API.G_EXC_ERROR;
1638 END IF;
1639 --
1640 END IF;
1641 EXCEPTION
1642 WHEN OTHERS THEN
1643 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
1644 RAISE FND_API.G_EXC_ERROR;
1645 END;
1646 --
1647 -- Calling Post Vertical User Hook
1648 BEGIN
1649
1650 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
1651 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.create_ctr_relationship_Post ..');
1652 CSI_COUNTER_TEMPLATE_VUHK.create_ctr_relationship_Post
1653 (
1654 p_api_version => 1.0
1655 ,p_commit => fnd_api.g_false
1656 ,p_init_msg_list => fnd_api.g_false
1657 ,p_validation_level => fnd_api.g_valid_level_full
1658 ,p_counter_relationships_rec => p_counter_relationships_rec
1659 ,x_return_status => x_return_status
1660 ,x_msg_count => x_msg_count
1661 ,x_msg_data => x_msg_data
1662 );
1663 --
1664 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1665 l_msg_index := 1;
1666 l_msg_count := x_msg_count;
1667 WHILE l_msg_count > 0 LOOP
1668 x_msg_data := FND_MSG_PUB.GET
1669 ( l_msg_index,
1670 FND_API.G_FALSE );
1671 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_ctr_relationship_Post API ');
1672 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1673 l_msg_index := l_msg_index + 1;
1674 l_msg_count := l_msg_count - 1;
1675 END LOOP;
1676 RAISE FND_API.G_EXC_ERROR;
1677 END IF;
1678 --
1679 END IF;
1680 EXCEPTION
1681 WHEN OTHERS THEN
1682 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
1683 RAISE FND_API.G_EXC_ERROR;
1684 END;
1685 -- End of POST User Hooks
1686
1687 -- End of API body
1688
1689 -- Standard check of p_commit.
1690 IF FND_API.To_Boolean( p_commit ) THEN
1691 COMMIT WORK;
1695 WHEN FND_API.G_EXC_ERROR THEN
1692 END IF;
1693
1694 EXCEPTION
1696 x_return_status := FND_API.G_RET_STS_ERROR ;
1697 ROLLBACK TO create_counter_relationship;
1698 FND_MSG_PUB.Count_And_Get
1699 (p_count => x_msg_count,
1700 p_data => x_msg_data
1701 );
1702
1703 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1704 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1705 ROLLBACK TO create_counter_relationship;
1706 FND_MSG_PUB.Count_And_Get
1707 (p_count => x_msg_count,
1708 p_data => x_msg_data
1709 );
1710 WHEN OTHERS THEN
1711 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1712 ROLLBACK TO create_counter_relationship;
1713 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1714 THEN
1715 FND_MSG_PUB.Add_Exc_Msg
1716 (G_PKG_NAME,
1717 l_api_name
1718 );
1719 END IF;
1720 FND_MSG_PUB.Count_And_Get
1721 (p_count => x_msg_count,
1722 p_data => x_msg_data
1723 );
1724
1725 END create_counter_relationship;
1726
1727
1728 /*#
1729 * This procedure is used to create derived filters.
1730 * @param p_api_version Current API version
1731 * @param p_commit API commits if set to fnd_api.g_true
1732 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
1733 * @param p_validation_level API validation level
1734 * @param p_ctr_derived_filters_tbl Counter Derived Filters Table structure
1735 * @param x_return_status API Return Status
1736 * @param x_msg_count Message count
1737 * @param x_msg_data Message Data
1738 * @rep:scope public
1739 * @rep:lifecycle active
1740 * @rep:displayname Create Counter Derived Filters
1741 */
1742 PROCEDURE create_derived_filters
1743 (
1744 p_api_version IN NUMBER
1745 ,p_commit IN VARCHAR2
1746 ,p_init_msg_list IN VARCHAR2
1747 ,p_validation_level IN NUMBER
1748 ,p_ctr_derived_filters_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_derived_filters_tbl
1749 ,x_return_status OUT NOCOPY VARCHAR2
1750 ,x_msg_count OUT NOCOPY NUMBER
1751 ,x_msg_data OUT NOCOPY VARCHAR2
1752 )
1753 IS
1754 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_DERIVED_FILTERS';
1755 l_api_version CONSTANT NUMBER := 1.0;
1756 -- l_debug_level NUMBER;
1757 l_flag VARCHAR2(1) := 'N';
1758 l_msg_data VARCHAR2(2000);
1759 l_msg_index NUMBER;
1760 l_msg_count NUMBER;
1761
1762 l_count NUMBER;
1763 l_return_message VARCHAR2(100);
1764
1765 BEGIN
1766 -- Standard Start of API savepoint
1767 SAVEPOINT create_derived_filters;
1768
1769 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
1770
1771 -- csi_ctr_gen_utility_pvt.check_ib_active;
1772
1773 -- Standard call to check for call compatibility.
1774 IF NOT FND_API.Compatible_API_Call (l_api_version,
1775 p_api_version,
1776 l_api_name ,
1777 G_PKG_NAME )
1778 THEN
1779 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1780 END IF;
1781
1782 -- Initialize message list if p_init_msg_list is set to TRUE.
1783 IF FND_API.to_Boolean( p_init_msg_list ) THEN
1784 FND_MSG_PUB.initialize;
1785 END IF;
1786
1787 -- Initialize API return status to success
1788 x_return_status := FND_API.G_RET_STS_SUCCESS;
1789
1790 -- Read the debug profiles values in to global variable 7197402
1791 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
1792
1793 -- Check the profile option debug_level for debug message reporting
1794 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
1795
1796 -- If debug_level = 1 then dump the procedure name
1797 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
1798 csi_ctr_gen_utility_pvt.put_line( 'create_derived_filters');
1799 END IF;
1800
1801 -- If the debug level = 2 then dump all the parameters values.
1802 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
1803 csi_ctr_gen_utility_pvt.put_line( 'create_derived_filters' ||
1804 p_api_version ||'-'||
1805 p_commit ||'-'||
1806 p_init_msg_list ||'-'||
1807 p_validation_level );
1808 csi_ctr_gen_utility_pvt.dump_ctr_derived_filters_tbl(p_ctr_derived_filters_tbl);
1809 END IF;
1810
1811 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
1812 CSI_COUNTER_TEMPLATE_CUHK.create_derived_filters_pre
1813 (
1814 p_api_version => p_api_version
1815 ,p_commit => p_commit
1816 ,p_init_msg_list => p_init_msg_list
1817 ,p_validation_level => p_validation_level
1818 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
1819 ,x_return_status => x_return_status
1820 ,x_msg_count => x_msg_count
1821 ,x_msg_data => x_msg_data
1822 );
1826 WHILE l_msg_count > 0 LOOP
1823 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1824 l_msg_index := 1;
1825 l_msg_count := x_msg_count;
1827 x_msg_data := FND_MSG_PUB.GET
1828 ( l_msg_index,
1829 FND_API.G_FALSE
1830 );
1831 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_derived_filters_pre API ');
1832 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1833 l_msg_index := l_msg_index + 1;
1834 l_msg_count := l_msg_count - 1;
1835 END LOOP;
1836 RAISE FND_API.G_EXC_ERROR;
1837 END IF;
1838 END IF;
1839 --
1840 -- Calling Vertical Pre-processing Hook
1841 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
1842 CSI_COUNTER_TEMPLATE_VUHK.create_derived_filters_pre
1843 (
1844 p_api_version => p_api_version
1845 ,p_commit => p_commit
1846 ,p_init_msg_list => p_init_msg_list
1847 ,p_validation_level => p_validation_level
1848 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
1849 ,x_return_status => x_return_status
1850 ,x_msg_count => x_msg_count
1851 ,x_msg_data => x_msg_data
1852 );
1853 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1854 l_msg_index := 1;
1855 l_msg_count := x_msg_count;
1856 WHILE l_msg_count > 0 LOOP
1857 x_msg_data := FND_MSG_PUB.GET
1858 ( l_msg_index,
1859 FND_API.G_FALSE
1860 );
1861 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_derived_filters_pre API ');
1862 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1863 l_msg_index := l_msg_index + 1;
1864 l_msg_count := l_msg_count - 1;
1865 END LOOP;
1866 RAISE FND_API.G_EXC_ERROR;
1867 END IF;
1868 END IF;
1869
1870 csi_counter_template_pvt.create_derived_filters
1871 (
1872 p_api_version => p_api_version
1873 ,p_commit => fnd_api.g_false
1874 ,p_init_msg_list => p_init_msg_list
1875 ,p_validation_level => p_validation_level
1876 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
1877 ,x_return_status => x_return_status
1878 ,x_msg_count => x_msg_count
1879 ,x_msg_data => x_msg_data
1880 );
1881
1882 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1883 l_msg_index := 1;
1884 l_msg_count := x_msg_count;
1885
1886 WHILE l_msg_count > 0 LOOP
1887 x_msg_data := FND_MSG_PUB.GET
1888 (l_msg_index,
1889 FND_API.G_FALSE );
1890 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.CREATE_DERIVED_FILTERS');
1891 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1892 l_msg_index := l_msg_index + 1;
1893 l_msg_count := l_msg_count - 1;
1894 END LOOP;
1895 RAISE FND_API.G_EXC_ERROR;
1896 END IF;
1897
1898 -- Calling Post Customer User Hook
1899 BEGIN
1900 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
1901 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.create_derived_filters_Post ..');
1902 CSI_COUNTER_TEMPLATE_CUHK.create_derived_filters_Post
1903 (
1904 p_api_version => 1.0
1905 ,p_commit => fnd_api.g_false
1906 ,p_init_msg_list => fnd_api.g_false
1907 ,p_validation_level => fnd_api.g_valid_level_full
1908 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
1909 ,x_return_status => x_return_status
1910 ,x_msg_count => x_msg_count
1911 ,x_msg_data => x_msg_data
1912 );
1913 --
1914 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1915 l_msg_index := 1;
1916 l_msg_count := x_msg_count;
1917 WHILE l_msg_count > 0 LOOP
1918 x_msg_data := FND_MSG_PUB.GET
1919 ( l_msg_index,
1920 FND_API.G_FALSE );
1921 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_derived_filters_Post API ');
1922 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1923 l_msg_index := l_msg_index + 1;
1924 l_msg_count := l_msg_count - 1;
1925 END LOOP;
1926 RAISE FND_API.G_EXC_ERROR;
1927 END IF;
1928 --
1929 END IF;
1930 EXCEPTION
1931 WHEN OTHERS THEN
1932 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
1933 RAISE FND_API.G_EXC_ERROR;
1934 END;
1935 --
1936 -- Calling Post Vertical User Hook
1937 BEGIN
1938
1939 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
1940 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.create_derived_filters_Post ..');
1941 CSI_COUNTER_TEMPLATE_VUHK.create_derived_filters_Post
1942 (
1946 ,p_validation_level => fnd_api.g_valid_level_full
1943 p_api_version => 1.0
1944 ,p_commit => fnd_api.g_false
1945 ,p_init_msg_list => fnd_api.g_false
1947 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
1948 ,x_return_status => x_return_status
1949 ,x_msg_count => x_msg_count
1950 ,x_msg_data => x_msg_data
1951 );
1952 --
1953 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
1954 l_msg_index := 1;
1955 l_msg_count := x_msg_count;
1956 WHILE l_msg_count > 0 LOOP
1957 x_msg_data := FND_MSG_PUB.GET
1958 ( l_msg_index,
1959 FND_API.G_FALSE );
1960 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_derived_filters_Post API ');
1961 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
1962 l_msg_index := l_msg_index + 1;
1963 l_msg_count := l_msg_count - 1;
1964 END LOOP;
1965 RAISE FND_API.G_EXC_ERROR;
1966 END IF;
1967 --
1968 END IF;
1969 EXCEPTION
1970 WHEN OTHERS THEN
1971 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
1972 RAISE FND_API.G_EXC_ERROR;
1973 END;
1974 -- End of POST User Hooks
1975 -- End of API body
1976
1977 -- Standard check of p_commit.
1978 IF FND_API.To_Boolean( p_commit ) THEN
1979 COMMIT WORK;
1980 END IF;
1981
1982 EXCEPTION
1983 WHEN FND_API.G_EXC_ERROR THEN
1984 x_return_status := FND_API.G_RET_STS_ERROR ;
1985 ROLLBACK TO create_derived_filters;
1986 FND_MSG_PUB.Count_And_Get
1987 (p_count => x_msg_count,
1988 p_data => x_msg_data
1989 );
1990
1991 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1992 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1993 ROLLBACK TO create_derived_filters;
1994 FND_MSG_PUB.Count_And_Get
1995 (p_count => x_msg_count,
1996 p_data => x_msg_data
1997 );
1998
1999 WHEN OTHERS THEN
2000 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2001 ROLLBACK TO create_derived_filters;
2002 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2003 THEN
2004 FND_MSG_PUB.Add_Exc_Msg
2005 (G_PKG_NAME,
2006 l_api_name
2007 );
2008 END IF;
2009 FND_MSG_PUB.Count_And_Get
2010 (p_count => x_msg_count,
2011 p_data => x_msg_data
2012 );
2013
2014 END create_derived_filters;
2015
2016
2017 --|---------------------------------------------------
2018 --| procedure name: update_counter_group
2019 --| description : procedure used to
2020 --| update counter group
2021 --|---------------------------------------------------
2022 /*#
2023 * This procedure is used to update counter group
2024 * In this process, it also update/create counter item associations
2025 * @param p_api_version Current API version
2026 * @param p_commit API commits if set to fnd_api.g_true
2027 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
2028 * @param p_validation_level API validation level
2029 * @param p_counter_groups_rec Counter Group Record structure
2030 * @param p_ctr_item_associations_tbl Counter Item Associations Table structure
2031 * @param x_return_status API Return Status
2032 * @param x_msg_count Message count
2033 * @param x_msg_data Message Data
2034 * @rep:scope public
2035 * @rep:lifecycle active
2036 * @rep:displayname Update Counter Group
2037 */
2038
2039
2040 PROCEDURE update_counter_group
2041 (
2042 p_api_version IN NUMBER
2043 ,p_commit IN VARCHAR2
2044 ,p_init_msg_list IN VARCHAR2
2045 ,p_validation_level IN NUMBER
2046 ,p_counter_groups_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.counter_groups_rec
2047 ,p_ctr_item_associations_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_item_associations_tbl
2048 ,x_return_status OUT NOCOPY VARCHAR2
2049 ,x_msg_count OUT NOCOPY NUMBER
2050 ,x_msg_data OUT NOCOPY VARCHAR2
2051 )
2052 IS
2053 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_COUNTER_GROUP';
2054 l_api_version CONSTANT NUMBER := 1.0;
2055 -- l_debug_level NUMBER;
2056 l_flag VARCHAR2(1) := 'N';
2057 l_msg_data VARCHAR2(2000);
2058 l_msg_index NUMBER;
2059 l_msg_count NUMBER;
2060
2061 l_count NUMBER;
2062 l_return_message VARCHAR2(100);
2063
2064 CURSOR c1(p_counter_group_id NUMBER, p_inventory_item_id NUMBER) IS
2065 SELECT counter_id
2066 FROM csi_ctr_item_associations
2067 WHERE nvl(associated_to_group,'N') = 'Y'
2068 AND counter_id IS NOT NULL
2069 AND group_id = p_counter_group_id
2070 AND inventory_item_id = p_inventory_item_id; --Modified for 6112648
2071 BEGIN
2072 -- Standard Start of API savepoint
2076
2073 SAVEPOINT update_counter_group;
2074
2075 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
2077 -- csi_ctr_gen_utility_pvt.check_ib_active;
2078
2079 -- Standard call to check for call compatibility.
2080 IF NOT FND_API.Compatible_API_Call (l_api_version,
2081 p_api_version,
2082 l_api_name ,
2083 G_PKG_NAME )
2084 THEN
2085 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2086 END IF;
2087
2088 -- Initialize message list if p_init_msg_list is set to TRUE.
2089 IF FND_API.to_Boolean( p_init_msg_list ) THEN
2090 FND_MSG_PUB.initialize;
2091 END IF;
2092
2093 -- Initialize API return status to success
2094 x_return_status := FND_API.G_RET_STS_SUCCESS;
2095
2096 -- Read the debug profiles values in to global variable 7197402
2097 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
2098
2099 -- Check the profile option debug_level for debug message reporting
2100 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
2101
2102 -- If debug_level = 1 then dump the procedure name
2103 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
2104 csi_ctr_gen_utility_pvt.put_line( 'update_counter_group');
2105 END IF;
2106
2107 -- If the debug level = 2 then dump all the parameters values.
2108 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
2109 csi_ctr_gen_utility_pvt.put_line( 'update_counter_group' ||
2110 p_api_version ||'-'||
2111 p_commit ||'-'||
2112 p_init_msg_list ||'-'||
2113 p_validation_level );
2114 csi_ctr_gen_utility_pvt.dump_ctr_grp_rec(p_counter_groups_rec);
2115 END IF;
2116
2117 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
2118 CSI_COUNTER_TEMPLATE_CUHK.update_counter_group_pre
2119 (
2120 p_api_version => p_api_version
2121 ,p_commit => p_commit
2122 ,p_init_msg_list => p_init_msg_list
2123 ,p_validation_level => p_validation_level
2124 ,p_counter_groups_rec => p_counter_groups_rec
2125 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
2126 ,x_return_status => x_return_status
2127 ,x_msg_count => x_msg_count
2128 ,x_msg_data => x_msg_data
2129 );
2130 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2131 l_msg_index := 1;
2132 l_msg_count := x_msg_count;
2133 WHILE l_msg_count > 0 LOOP
2134 x_msg_data := FND_MSG_PUB.GET
2135 ( l_msg_index,
2136 FND_API.G_FALSE
2137 );
2138 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_counter_group_pre API ');
2139 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2140 l_msg_index := l_msg_index + 1;
2141 l_msg_count := l_msg_count - 1;
2142 END LOOP;
2143 RAISE FND_API.G_EXC_ERROR;
2144 END IF;
2145 END IF;
2146 --
2147 -- Calling Vertical Pre-processing Hook
2148 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
2149 CSI_COUNTER_TEMPLATE_VUHK.update_counter_group_pre
2150 (
2151 p_api_version => p_api_version
2152 ,p_commit => p_commit
2153 ,p_init_msg_list => p_init_msg_list
2154 ,p_validation_level => p_validation_level
2155 ,p_counter_groups_rec => p_counter_groups_rec
2156 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
2157 ,x_return_status => x_return_status
2158 ,x_msg_count => x_msg_count
2159 ,x_msg_data => x_msg_data
2160 );
2161 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2162 l_msg_index := 1;
2163 l_msg_count := x_msg_count;
2164 WHILE l_msg_count > 0 LOOP
2165 x_msg_data := FND_MSG_PUB.GET
2166 ( l_msg_index,
2167 FND_API.G_FALSE
2168 );
2169 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_counter_group_pre API ');
2170 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2171 l_msg_index := l_msg_index + 1;
2172 l_msg_count := l_msg_count - 1;
2173 END LOOP;
2174 RAISE FND_API.G_EXC_ERROR;
2175 END IF;
2176 END IF;
2177
2178 csi_counter_template_pvt.update_counter_group
2179 (
2180 p_api_version => p_api_version
2181 ,p_commit => fnd_api.g_false
2182 ,p_init_msg_list => p_init_msg_list
2183 ,p_validation_level => p_validation_level
2184 ,p_counter_groups_rec => p_counter_groups_rec
2185 ,x_return_status => x_return_status
2186 ,x_msg_count => x_msg_count
2187 ,x_msg_data => x_msg_data
2188 );
2189
2190 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2191 l_msg_index := 1;
2192 l_msg_count := x_msg_count;
2193
2194 WHILE l_msg_count > 0 LOOP
2198 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.UPDATE_COUNTER_GROUP');
2195 x_msg_data := FND_MSG_PUB.GET
2196 (l_msg_index,
2197 FND_API.G_FALSE );
2199 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2200 l_msg_index := l_msg_index + 1;
2201 l_msg_count := l_msg_count - 1;
2202 END LOOP;
2203 RAISE FND_API.G_EXC_ERROR;
2204 END IF;
2205
2206 -- Calling Post Customer User Hook
2207 BEGIN
2208 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
2209 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.update_counter_group_Post ..');
2210 CSI_COUNTER_TEMPLATE_CUHK.update_counter_group_Post
2211 (
2212 p_api_version => 1.0
2213 ,p_commit => fnd_api.g_false
2214 ,p_init_msg_list => fnd_api.g_false
2215 ,p_validation_level => fnd_api.g_valid_level_full
2216 ,p_counter_groups_rec => p_counter_groups_rec
2217 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
2218 ,x_return_status => x_return_status
2219 ,x_msg_count => x_msg_count
2220 ,x_msg_data => x_msg_data
2221 );
2222 --
2223 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2224 l_msg_index := 1;
2225 l_msg_count := x_msg_count;
2226 WHILE l_msg_count > 0 LOOP
2227 x_msg_data := FND_MSG_PUB.GET
2228 ( l_msg_index,
2229 FND_API.G_FALSE );
2230 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_counter_group_Post API ');
2231 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2232 l_msg_index := l_msg_index + 1;
2233 l_msg_count := l_msg_count - 1;
2234 END LOOP;
2235 RAISE FND_API.G_EXC_ERROR;
2236 END IF;
2237 --
2238 END IF;
2239 EXCEPTION
2240 WHEN OTHERS THEN
2241 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
2242 RAISE FND_API.G_EXC_ERROR;
2243 END;
2244 --
2245 -- Calling Post Vertical User Hook
2246 BEGIN
2247
2248 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
2249 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.update_counter_group_Post ..');
2250 CSI_COUNTER_TEMPLATE_VUHK.update_counter_group_Post
2251 (
2252 p_api_version => 1.0
2253 ,p_commit => fnd_api.g_false
2254 ,p_init_msg_list => fnd_api.g_false
2255 ,p_validation_level => fnd_api.g_valid_level_full
2256 ,p_counter_groups_rec => p_counter_groups_rec
2257 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
2258 ,x_return_status => x_return_status
2259 ,x_msg_count => x_msg_count
2260 ,x_msg_data => x_msg_data
2261 );
2262 --
2263 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2264 l_msg_index := 1;
2265 l_msg_count := x_msg_count;
2266 WHILE l_msg_count > 0 LOOP
2267 x_msg_data := FND_MSG_PUB.GET
2268 ( l_msg_index,
2269 FND_API.G_FALSE );
2270 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_counter_group_Post API ');
2271 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2272 l_msg_index := l_msg_index + 1;
2273 l_msg_count := l_msg_count - 1;
2274 END LOOP;
2275 RAISE FND_API.G_EXC_ERROR;
2276 END IF;
2277 --
2278 END IF;
2279 EXCEPTION
2280 WHEN OTHERS THEN
2281 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
2282 RAISE FND_API.G_EXC_ERROR;
2283 END;
2284 -- End of POST User Hooks
2285
2286 -- Call the create_item_associations to create the item associations
2287
2288 IF (p_ctr_item_associations_tbl.count > 0) THEN
2289 FOR tab_row IN p_ctr_item_associations_tbl.FIRST .. p_ctr_item_associations_tbl.LAST
2290 LOOP
2291 IF p_ctr_item_associations_tbl.EXISTS(tab_row) THEN
2292 IF ((p_ctr_item_associations_tbl(tab_row).ctr_association_id IS NULL)
2293 OR
2294 (p_ctr_item_associations_tbl(tab_row).ctr_association_id = FND_API.G_MISS_NUM))
2295 THEN
2296 p_ctr_item_associations_tbl(tab_row).group_id := p_counter_groups_rec.counter_group_id;
2297 create_item_association
2298 ( p_api_version => p_api_version
2299 ,p_commit => fnd_api.g_false
2300 ,p_init_msg_list => p_init_msg_list
2301 ,p_validation_level => p_validation_level
2302 ,p_ctr_item_associations_rec => p_ctr_item_associations_tbl(tab_row)
2303 ,x_return_status => x_return_status
2304 ,x_msg_count => x_msg_count
2305 ,x_msg_data => x_msg_data
2309 l_msg_index := 1;
2306 );
2307
2308 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2310 l_msg_count := x_msg_count;
2311 WHILE l_msg_count > 0 LOOP
2312 x_msg_data := FND_MSG_PUB.GET
2313 (l_msg_index,
2314 FND_API.G_FALSE);
2315 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_ITEM_ASSOCIATIONS');
2316 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data); l_msg_index := l_msg_index + 1;
2317 l_msg_count := l_msg_count - 1;
2318 END LOOP;
2319 RAISE FND_API.G_EXC_ERROR;
2320 END IF;
2321
2322 /* Also create the item association for Counters currently
2323 attach to the Counter Group */
2324 ----Modified for 6112648
2325 FOR c1_rec in c1(p_counter_groups_rec.counter_group_id, p_ctr_item_associations_tbl(tab_row).inventory_item_id) LOOP
2326 p_ctr_item_associations_tbl(tab_row).group_id := p_counter_groups_rec.counter_group_id;
2327 p_ctr_item_associations_tbl(tab_row).counter_id := c1_rec.counter_id;
2328 create_item_association
2329 (p_api_version => p_api_version
2330 ,p_commit => fnd_api.g_false
2331 ,p_init_msg_list => p_init_msg_list
2332 ,p_validation_level => p_validation_level
2333 ,p_ctr_item_associations_rec => p_ctr_item_associations_tbl(tab_row)
2334 ,x_return_status => x_return_status
2335 ,x_msg_count => x_msg_count
2336 ,x_msg_data => x_msg_data
2337 );
2338
2339 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2340 l_msg_index := 1;
2341 l_msg_count := x_msg_count;
2342 WHILE l_msg_count > 0 LOOP
2343 x_msg_data := FND_MSG_PUB.GET
2344 (l_msg_index,
2345 FND_API.G_FALSE);
2346 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_ITEM_ASSOCIATIONS');
2347 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data); l_msg_index := l_msg_index + 1;
2348 l_msg_count := l_msg_count - 1;
2349 END LOOP;
2350 RAISE FND_API.G_EXC_ERROR;
2351 END IF;
2352 END LOOP;
2353 /* End of addition */
2354 ELSE
2355 p_ctr_item_associations_tbl(tab_row).group_id := p_counter_groups_rec.counter_group_id;
2356 update_item_association
2357 (p_api_version => p_api_version
2358 ,p_commit => fnd_api.g_false
2359 ,p_init_msg_list => p_init_msg_list
2360 ,p_validation_level => p_validation_level
2361 ,p_ctr_item_associations_rec => p_ctr_item_associations_tbl(tab_row)
2362 ,x_return_status => x_return_status
2363 ,x_msg_count => x_msg_count
2364 ,x_msg_data => x_msg_data
2365 );
2366
2367 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2368 l_msg_index := 1;
2369 l_msg_count := x_msg_count;
2370 WHILE l_msg_count > 0 LOOP
2371 x_msg_data := FND_MSG_PUB.GET
2372 (l_msg_index,
2373 FND_API.G_FALSE);
2374 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.UPDATE_ITEM_ASSOCIATIONS');
2375 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2376 l_msg_index := l_msg_index + 1;
2377 l_msg_count := l_msg_count - 1;
2378 END LOOP;
2379 RAISE FND_API.G_EXC_ERROR;
2380 END IF;
2381 END IF;
2382 END IF;
2383 END LOOP;
2384 END IF;
2385
2386 -- End of API body
2387
2388 -- Standard check of p_commit.
2389 IF FND_API.To_Boolean( p_commit ) THEN
2390 COMMIT WORK;
2391 END IF;
2392
2393 EXCEPTION
2394 WHEN FND_API.G_EXC_ERROR THEN
2395 x_return_status := FND_API.G_RET_STS_ERROR ;
2396 ROLLBACK TO update_counter_group;
2397 FND_MSG_PUB.Count_And_Get
2398 (p_count => x_msg_count,
2399 p_data => x_msg_data
2400 );
2401
2402 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2403 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2404 ROLLBACK TO update_counter_group;
2405 FND_MSG_PUB.Count_And_Get
2406 (p_count => x_msg_count,
2407 p_data => x_msg_data
2408 );
2409 WHEN OTHERS THEN
2410 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2411 ROLLBACK TO update_counter_group;
2412 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2413 THEN
2414 FND_MSG_PUB.Add_Exc_Msg
2415 (G_PKG_NAME,
2416 l_api_name
2417 );
2418 END IF;
2419 FND_MSG_PUB.Count_And_Get
2423
2420 (p_count => x_msg_count,
2421 p_data => x_msg_data
2422 );
2424 END update_counter_group;
2425
2426
2427 --|---------------------------------------------------
2428 --| procedure name: update_item_association
2429 --| description : procedure used to
2430 --| update item association to
2431 --| counter group or counters
2432 --|---------------------------------------------------
2433 /*#
2434 * This procedure is used to update counter item associations
2435 * @param p_api_version Current API version
2436 * @param p_commit API commits if set to fnd_api.g_true
2437 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
2438 * @param p_validation_level API validation level
2439 * @param p_ctr_item_associations_rec Counter Item Associations Record structure
2440 * @param x_return_status API Return Status
2441 * @param x_msg_count Message count
2442 * @param x_msg_data Message Data
2443 * @rep:scope public
2444 * @rep:lifecycle active
2445 * @rep:displayname Update Item Association
2446 */
2447
2448 PROCEDURE update_item_association
2449 (
2450 p_api_version IN NUMBER
2451 ,p_commit IN VARCHAR2
2452 ,p_init_msg_list IN VARCHAR2
2453 ,p_validation_level IN NUMBER
2454 ,p_ctr_item_associations_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_item_associations_rec
2455 ,x_return_status OUT NOCOPY VARCHAR2
2456 ,x_msg_count OUT NOCOPY NUMBER
2457 ,x_msg_data OUT NOCOPY VARCHAR2
2458 )
2459 IS
2460 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_ITEM_ASSOCIATION';
2461 l_api_version CONSTANT NUMBER := 1.0;
2462 -- l_debug_level NUMBER;
2463 l_flag VARCHAR2(1) := 'N';
2464 l_msg_data VARCHAR2(2000);
2465 l_msg_index NUMBER;
2466 l_msg_count NUMBER;
2467
2468 l_count NUMBER;
2469 l_return_message VARCHAR2(100);
2470
2471 BEGIN
2472 -- Standard Start of API savepoint
2473 SAVEPOINT update_item_association;
2474
2475 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
2476
2477 -- csi_ctr_gen_utility_pvt.check_ib_active;
2478
2479 -- Standard call to check for call compatibility.
2480 IF NOT FND_API.Compatible_API_Call (l_api_version,
2481 p_api_version,
2482 l_api_name ,
2483 G_PKG_NAME )
2484 THEN
2485 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2486 END IF;
2487
2488 -- Initialize message list if p_init_msg_list is set to TRUE.
2489 IF FND_API.to_Boolean( p_init_msg_list ) THEN
2490 FND_MSG_PUB.initialize;
2491 END IF;
2492
2493 -- Initialize API return status to success
2494 x_return_status := FND_API.G_RET_STS_SUCCESS;
2495
2496 -- Check the profile option debug_level for debug message reporting
2497 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
2498
2499 -- Read the debug profiles values in to global variable 7197402
2500 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
2501
2502 -- If debug_level = 1 then dump the procedure name
2503 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
2504 csi_ctr_gen_utility_pvt.put_line( 'update_item_association');
2505 END IF;
2506
2507 -- If the debug level = 2 then dump all the parameters values.
2508 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
2509 csi_ctr_gen_utility_pvt.put_line( 'update_item_association' ||
2510 p_api_version ||'-'||
2511 p_commit ||'-'||
2512 p_init_msg_list ||'-'||
2513 p_validation_level );
2514 csi_ctr_gen_utility_pvt.dump_ctr_item_assoc_rec(p_ctr_item_associations_rec);
2515 END IF;
2516
2517 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
2518 CSI_COUNTER_TEMPLATE_CUHK.update_item_association_pre
2519 (
2520 p_api_version => p_api_version
2521 ,p_commit => p_commit
2522 ,p_init_msg_list => p_init_msg_list
2523 ,p_validation_level => p_validation_level
2524 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
2525 ,x_return_status => x_return_status
2526 ,x_msg_count => x_msg_count
2527 ,x_msg_data => x_msg_data
2528 );
2529 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2530 l_msg_index := 1;
2531 l_msg_count := x_msg_count;
2532 WHILE l_msg_count > 0 LOOP
2533 x_msg_data := FND_MSG_PUB.GET
2534 ( l_msg_index,
2535 FND_API.G_FALSE
2536 );
2537 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_item_association_pre API ');
2538 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2539 l_msg_index := l_msg_index + 1;
2540 l_msg_count := l_msg_count - 1;
2544 END IF;
2541 END LOOP;
2542 RAISE FND_API.G_EXC_ERROR;
2543 END IF;
2545 --
2546 -- Calling Vertical Pre-processing Hook
2547 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
2548 CSI_COUNTER_TEMPLATE_VUHK.update_item_association_pre
2549 (
2550 p_api_version => p_api_version
2551 ,p_commit => p_commit
2552 ,p_init_msg_list => p_init_msg_list
2553 ,p_validation_level => p_validation_level
2554 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
2555 ,x_return_status => x_return_status
2556 ,x_msg_count => x_msg_count
2557 ,x_msg_data => x_msg_data
2558 );
2559 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2560 l_msg_index := 1;
2561 l_msg_count := x_msg_count;
2562 WHILE l_msg_count > 0 LOOP
2563 x_msg_data := FND_MSG_PUB.GET
2564 ( l_msg_index,
2565 FND_API.G_FALSE
2566 );
2567 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_item_association_pre API ');
2568 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2569 l_msg_index := l_msg_index + 1;
2570 l_msg_count := l_msg_count - 1;
2571 END LOOP;
2572 RAISE FND_API.G_EXC_ERROR;
2573 END IF;
2574 END IF;
2575
2576 csi_counter_template_pvt.update_item_association
2577 (
2578 p_api_version => p_api_version
2579 ,p_commit => fnd_api.g_false
2580 ,p_init_msg_list => p_init_msg_list
2581 ,p_validation_level => p_validation_level
2582 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
2583 ,x_return_status => x_return_status
2584 ,x_msg_count => x_msg_count
2585 ,x_msg_data => x_msg_data
2586 );
2587
2588 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2589 l_msg_index := 1;
2590 l_msg_count := x_msg_count;
2591
2592 WHILE l_msg_count > 0 LOOP
2593 x_msg_data := FND_MSG_PUB.GET
2594 (l_msg_index,
2595 FND_API.G_FALSE );
2596 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.UPDATE_ITEM_ASSOCIATION');
2597 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2598 l_msg_index := l_msg_index + 1;
2599 l_msg_count := l_msg_count - 1;
2600 END LOOP;
2601 RAISE FND_API.G_EXC_ERROR;
2602 END IF;
2603
2604 -- Calling Post Customer User Hook
2605 BEGIN
2606 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
2607 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.update_item_association_Post ..');
2608 CSI_COUNTER_TEMPLATE_CUHK.update_item_association_Post
2609 (
2610 p_api_version => 1.0
2611 ,p_commit => fnd_api.g_false
2612 ,p_init_msg_list => fnd_api.g_false
2613 ,p_validation_level => fnd_api.g_valid_level_full
2614 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
2615 ,x_return_status => x_return_status
2616 ,x_msg_count => x_msg_count
2617 ,x_msg_data => x_msg_data
2618 );
2619 --
2620 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2621 l_msg_index := 1;
2622 l_msg_count := x_msg_count;
2623 WHILE l_msg_count > 0 LOOP
2624 x_msg_data := FND_MSG_PUB.GET
2625 ( l_msg_index,
2626 FND_API.G_FALSE );
2627 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_item_association_Post API ');
2628 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2629 l_msg_index := l_msg_index + 1;
2630 l_msg_count := l_msg_count - 1;
2631 END LOOP;
2632 RAISE FND_API.G_EXC_ERROR;
2633 END IF;
2634 --
2635 END IF;
2636 EXCEPTION
2637 WHEN OTHERS THEN
2638 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
2639 RAISE FND_API.G_EXC_ERROR;
2640 END;
2641 --
2642 -- Calling Post Vertical User Hook
2643 BEGIN
2644
2645 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
2646 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.update_item_association_Post ..');
2647 CSI_COUNTER_TEMPLATE_VUHK.update_item_association_Post
2648 (
2649 p_api_version => 1.0
2650 ,p_commit => fnd_api.g_false
2651 ,p_init_msg_list => fnd_api.g_false
2652 ,p_validation_level => fnd_api.g_valid_level_full
2653 ,p_ctr_item_associations_rec => p_ctr_item_associations_rec
2654 ,x_return_status => x_return_status
2655 ,x_msg_count => x_msg_count
2656 ,x_msg_data => x_msg_data
2657 );
2658 --
2659 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2660 l_msg_index := 1;
2664 ( l_msg_index,
2661 l_msg_count := x_msg_count;
2662 WHILE l_msg_count > 0 LOOP
2663 x_msg_data := FND_MSG_PUB.GET
2665 FND_API.G_FALSE );
2666 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_item_association_Post API ');
2667 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2668 l_msg_index := l_msg_index + 1;
2669 l_msg_count := l_msg_count - 1;
2670 END LOOP;
2671 RAISE FND_API.G_EXC_ERROR;
2672 END IF;
2673 --
2674 END IF;
2675 EXCEPTION
2676 WHEN OTHERS THEN
2677 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
2678 RAISE FND_API.G_EXC_ERROR;
2679 END;
2680 -- End of POST User Hooks
2681 -- End of API body
2682
2683 -- Standard check of p_commit.
2684 IF FND_API.To_Boolean( p_commit ) THEN
2685 COMMIT WORK;
2686 END IF;
2687
2688 EXCEPTION
2689 WHEN FND_API.G_EXC_ERROR THEN
2690 x_return_status := FND_API.G_RET_STS_ERROR ;
2691 ROLLBACK TO update_item_association;
2692 FND_MSG_PUB.Count_And_Get
2693 (p_count => x_msg_count,
2694 p_data => x_msg_data
2695 );
2696
2697 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2698 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2699 ROLLBACK TO update_item_association;
2700 FND_MSG_PUB.Count_And_Get
2701 (p_count => x_msg_count,
2702 p_data => x_msg_data
2703 );
2704 WHEN OTHERS THEN
2705 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2706 ROLLBACK TO update_item_association;
2707 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2708 THEN
2709 FND_MSG_PUB.Add_Exc_Msg
2710 (G_PKG_NAME,
2711 l_api_name
2712 );
2713 END IF;
2714 FND_MSG_PUB.Count_And_Get
2715 (p_count => x_msg_count,
2716 p_data => x_msg_data
2717 );
2718
2719 END update_item_association;
2720
2721 --|---------------------------------------------------
2722 --| procedure name: update_counter_template
2723 --| description : procedure used to
2724 --| update counter template
2725 --|---------------------------------------------------
2726 /*#
2727 * This procedure is used to update counter template.
2728 * This will also create/update Item Association, Properties
2729 * derived filters, relationships.
2730 * @param p_api_version Current API version
2731 * @param p_commit API commits if set to fnd_api.g_true
2732 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
2733 * @param p_validation_level API validation level
2734 * @param p_counter_template_rec Counter Template Record structure
2735 * @param p_ctr_item_associations_tbl Counter Item Associations Table structure
2736 * @param p_ctr_property_template_tbl Counter property template Table structure
2737 * @param p_counter_relationships_tbl Counter relationships Table structure
2738 * @param p_ctr_derived_filters_tbl Counter Derived Filters Table structure
2739 * @param x_return_status API Return Status
2740 * @param x_msg_count Message count
2741 * @param x_msg_data Message Data
2742 * @rep:scope public
2743 * @rep:lifecycle active
2744 * @rep:displayname Update Counter Template
2745 */
2746
2747 PROCEDURE update_counter_template
2748 (
2749 p_api_version IN NUMBER
2750 ,p_commit IN VARCHAR2
2751 ,p_init_msg_list IN VARCHAR2
2752 ,p_validation_level IN NUMBER
2753 ,p_counter_template_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.counter_template_rec
2754 ,p_ctr_item_associations_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_item_associations_tbl
2755 ,p_ctr_property_template_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_property_template_tbl
2756 ,p_counter_relationships_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.counter_relationships_tbl
2757 ,p_ctr_derived_filters_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_derived_filters_tbl
2758 ,x_return_status OUT NOCOPY VARCHAR2
2759 ,x_msg_count OUT NOCOPY NUMBER
2760 ,x_msg_data OUT NOCOPY VARCHAR2
2761 )
2762 IS
2763 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_COUNTER_TEMPLATE';
2764 l_api_version CONSTANT NUMBER := 1.0;
2765 -- l_debug_level NUMBER;
2766 l_flag VARCHAR2(1) := 'N';
2767 l_msg_data VARCHAR2(2000);
2768 l_msg_index NUMBER;
2769 l_msg_count NUMBER;
2770
2771 l_count NUMBER;
2772 l_return_message VARCHAR2(100);
2773
2774 BEGIN
2775 -- Standard Start of API savepoint
2776 SAVEPOINT update_counter_template ;
2777
2778 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
2779
2780 -- csi_ctr_gen_utility_pvt.check_ib_active;
2781
2782 -- Standard call to check for call compatibility.
2783 IF NOT FND_API.Compatible_API_Call (l_api_version,
2784 p_api_version,
2788 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2785 l_api_name ,
2786 G_PKG_NAME )
2787 THEN
2789 END IF;
2790
2791 -- Initialize message list if p_init_msg_list is set to TRUE.
2792 IF FND_API.to_Boolean( p_init_msg_list ) THEN
2793 FND_MSG_PUB.initialize;
2794 END IF;
2795
2796 -- Initialize API return status to success
2797 x_return_status := FND_API.G_RET_STS_SUCCESS;
2798
2799 -- Read the debug profiles values in to global variable 7197402
2800 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
2801
2802 -- Check the profile option debug_level for debug message reporting
2803 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
2804
2805 -- If debug_level = 1 then dump the procedure name
2806 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
2807 csi_ctr_gen_utility_pvt.put_line( 'update_counter_template');
2808 END IF;
2809
2810 -- If the debug level = 2 then dump all the parameters values.
2811 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
2812 csi_ctr_gen_utility_pvt.put_line( 'update_counter_template' ||
2813 p_api_version ||'-'||
2814 p_commit ||'-'||
2815 p_init_msg_list ||'-'||
2816 p_validation_level );
2817 csi_ctr_gen_utility_pvt.dump_ctr_template_rec(p_counter_template_rec);
2818 END IF;
2819
2820 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
2821 CSI_COUNTER_TEMPLATE_CUHK.update_counter_template_pre
2822 (
2823 p_api_version => p_api_version
2824 ,p_commit => p_commit
2825 ,p_init_msg_list => p_init_msg_list
2826 ,p_validation_level => p_validation_level
2827 ,p_counter_template_rec => p_counter_template_rec
2828 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
2829 ,p_ctr_property_template_tbl => p_ctr_property_template_tbl
2830 ,p_counter_relationships_tbl => p_counter_relationships_tbl
2831 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
2832 ,x_return_status => x_return_status
2833 ,x_msg_count => x_msg_count
2834 ,x_msg_data => x_msg_data
2835 );
2836 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2837 l_msg_index := 1;
2838 l_msg_count := x_msg_count;
2839 WHILE l_msg_count > 0 LOOP
2840 x_msg_data := FND_MSG_PUB.GET
2841 ( l_msg_index,
2842 FND_API.G_FALSE
2843 );
2844 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_counter_template_pre API ');
2845 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2846 l_msg_index := l_msg_index + 1;
2847 l_msg_count := l_msg_count - 1;
2848 END LOOP;
2849 RAISE FND_API.G_EXC_ERROR;
2850 END IF;
2851 END IF;
2852 --
2853 -- Calling Vertical Pre-processing Hook
2854 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
2855 CSI_COUNTER_TEMPLATE_VUHK.update_counter_template_pre
2856 (
2857 p_api_version => p_api_version
2858 ,p_commit => p_commit
2859 ,p_init_msg_list => p_init_msg_list
2860 ,p_validation_level => p_validation_level
2861 ,p_counter_template_rec => p_counter_template_rec
2862 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
2863 ,p_ctr_property_template_tbl => p_ctr_property_template_tbl
2864 ,p_counter_relationships_tbl => p_counter_relationships_tbl
2865 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
2866 ,x_return_status => x_return_status
2867 ,x_msg_count => x_msg_count
2868 ,x_msg_data => x_msg_data
2869 );
2870 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2871 l_msg_index := 1;
2872 l_msg_count := x_msg_count;
2873 WHILE l_msg_count > 0 LOOP
2874 x_msg_data := FND_MSG_PUB.GET
2875 ( l_msg_index,
2876 FND_API.G_FALSE
2877 );
2878 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_counter_template_pre API ');
2879 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2880 l_msg_index := l_msg_index + 1;
2881 l_msg_count := l_msg_count - 1;
2882 END LOOP;
2883 RAISE FND_API.G_EXC_ERROR;
2884 END IF;
2885 END IF;
2886
2887 csi_counter_template_pvt.update_counter_template
2888 (
2889 p_api_version => p_api_version
2890 ,p_commit => fnd_api.g_false
2891 ,p_init_msg_list => p_init_msg_list
2892 ,p_validation_level => p_validation_level
2893 ,p_counter_template_rec => p_counter_template_rec
2894 ,x_return_status => x_return_status
2895 ,x_msg_count => x_msg_count
2896 ,x_msg_data => x_msg_data
2897 );
2898
2899
2900
2901 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2902 l_msg_index := 1;
2906 x_msg_data := FND_MSG_PUB.GET
2903 l_msg_count := x_msg_count;
2904
2905 WHILE l_msg_count > 0 LOOP
2907 (l_msg_index,
2908 FND_API.G_FALSE );
2909 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.UPDATE_COUNTER_TEMPLATE');
2910 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2911 l_msg_index := l_msg_index + 1;
2912 l_msg_count := l_msg_count - 1;
2913 END LOOP;
2914 RAISE FND_API.G_EXC_ERROR;
2915 END IF;
2916
2917 -- Calling Post Customer User Hook
2918 BEGIN
2919 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
2920 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.update_counter_template_Post ..');
2921 CSI_COUNTER_TEMPLATE_CUHK.update_counter_template_Post
2922 (
2923 p_api_version => 1.0
2924 ,p_commit => fnd_api.g_false
2925 ,p_init_msg_list => fnd_api.g_false
2926 ,p_validation_level => fnd_api.g_valid_level_full
2927 ,p_counter_template_rec => p_counter_template_rec
2928 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
2929 ,p_ctr_property_template_tbl => p_ctr_property_template_tbl
2930 ,p_counter_relationships_tbl => p_counter_relationships_tbl
2931 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
2932 ,x_return_status => x_return_status
2933 ,x_msg_count => x_msg_count
2934 ,x_msg_data => x_msg_data
2935 );
2936 --
2937 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2938 l_msg_index := 1;
2939 l_msg_count := x_msg_count;
2940 WHILE l_msg_count > 0 LOOP
2941 x_msg_data := FND_MSG_PUB.GET
2942 ( l_msg_index,
2943 FND_API.G_FALSE );
2944 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_counter_template_Post API ');
2945 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2946 l_msg_index := l_msg_index + 1;
2947 l_msg_count := l_msg_count - 1;
2948 END LOOP;
2949 RAISE FND_API.G_EXC_ERROR;
2950 END IF;
2951 --
2952 END IF;
2953 EXCEPTION
2954 WHEN OTHERS THEN
2955 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
2956 RAISE FND_API.G_EXC_ERROR;
2957 END;
2958 --
2959 -- Calling Post Vertical User Hook
2960 BEGIN
2961
2962 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
2963 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.update_counter_template_Post ..');
2964 CSI_COUNTER_TEMPLATE_VUHK.update_counter_template_Post
2965 (
2966 p_api_version => 1.0
2967 ,p_commit => fnd_api.g_false
2968 ,p_init_msg_list => fnd_api.g_false
2969 ,p_validation_level => fnd_api.g_valid_level_full
2970 ,p_counter_template_rec => p_counter_template_rec
2971 ,p_ctr_item_associations_tbl => p_ctr_item_associations_tbl
2972 ,p_ctr_property_template_tbl => p_ctr_property_template_tbl
2973 ,p_counter_relationships_tbl => p_counter_relationships_tbl
2974 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
2975 ,x_return_status => x_return_status
2976 ,x_msg_count => x_msg_count
2977 ,x_msg_data => x_msg_data
2978 );
2979 --
2980 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
2981 l_msg_index := 1;
2982 l_msg_count := x_msg_count;
2983 WHILE l_msg_count > 0 LOOP
2984 x_msg_data := FND_MSG_PUB.GET
2985 ( l_msg_index,
2986 FND_API.G_FALSE );
2987 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_counter_template_Post API ');
2988 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
2989 l_msg_index := l_msg_index + 1;
2990 l_msg_count := l_msg_count - 1;
2991 END LOOP;
2992 RAISE FND_API.G_EXC_ERROR;
2993 END IF;
2994 --
2995 END IF;
2996 EXCEPTION
2997 WHEN OTHERS THEN
2998 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
2999 RAISE FND_API.G_EXC_ERROR;
3000 END;
3001 -- End of POST User Hooks
3002
3003
3004 IF (p_ctr_item_associations_tbl.count > 0) THEN
3005 FOR tab_row IN p_ctr_item_associations_tbl.FIRST .. p_ctr_item_associations_tbl.LAST
3006 LOOP
3007 IF p_ctr_item_associations_tbl.EXISTS(tab_row) THEN
3008 IF ((p_ctr_item_associations_tbl(tab_row).ctr_association_id IS NULL)
3009 OR
3010 (p_ctr_item_associations_tbl(tab_row).ctr_association_id = FND_API.G_MISS_NUM))
3011 THEN
3012 p_ctr_item_associations_tbl(tab_row).counter_id := p_counter_template_rec.counter_id;
3013 create_item_association
3014 (p_api_version => p_api_version
3018 ,p_ctr_item_associations_rec => p_ctr_item_associations_tbl(tab_row)
3015 ,p_commit => fnd_api.g_false
3016 ,p_init_msg_list => p_init_msg_list
3017 ,p_validation_level => p_validation_level
3019 ,x_return_status => x_return_status
3020 ,x_msg_count => x_msg_count
3021 ,x_msg_data => x_msg_data
3022 );
3023
3024 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3025 l_msg_index := 1;
3026 l_msg_count := x_msg_count;
3027 WHILE l_msg_count > 0 LOOP
3028 x_msg_data := FND_MSG_PUB.GET
3029 (l_msg_index,
3030 FND_API.G_FALSE);
3031 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_ITEM_ASSOCIATIONS');
3032 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3033 l_msg_index := l_msg_index + 1;
3034 l_msg_count := l_msg_count - 1;
3035 END LOOP;
3036 RAISE FND_API.G_EXC_ERROR;
3037 END IF;
3038 ELSE
3039 update_item_association
3040 (
3041 p_api_version => p_api_version
3042 ,p_commit => fnd_api.g_false
3043 ,p_init_msg_list => p_init_msg_list
3044 ,p_validation_level => p_validation_level
3045 ,p_ctr_item_associations_rec => p_ctr_item_associations_tbl(tab_row)
3046 ,x_return_status => x_return_status
3047 ,x_msg_count => x_msg_count
3048 ,x_msg_data => x_msg_data
3049 );
3050 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3051 l_msg_index := 1;
3052 l_msg_count := x_msg_count;
3053 WHILE l_msg_count > 0 LOOP
3054 x_msg_data := FND_MSG_PUB.GET
3055 (l_msg_index,
3056 FND_API.G_FALSE);
3057 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.UPDATE_ITEM_ASSOCIATIONS');
3058 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3059 l_msg_index := l_msg_index + 1;
3060 l_msg_count := l_msg_count - 1;
3061 END LOOP;
3062 RAISE FND_API.G_EXC_ERROR;
3063 END IF;
3064 END IF;
3065 END IF;
3066 END LOOP;
3067 END IF;
3068
3069 IF (p_ctr_property_template_tbl.count > 0) THEN
3070 FOR tab_row IN p_ctr_property_template_tbl.FIRST .. p_ctr_property_template_tbl.LAST
3071 LOOP
3072 IF p_ctr_property_template_tbl.EXISTS(tab_row) THEN
3073 IF ((p_ctr_property_template_tbl(tab_row).counter_property_id IS NULL)
3074 OR
3075 (p_ctr_property_template_tbl(tab_row).counter_property_id = FND_API.G_MISS_NUM))
3076 THEN
3077 p_ctr_property_template_tbl(tab_row).counter_id := p_counter_template_rec.counter_id;
3078 create_ctr_property_template
3079 (p_api_version => p_api_version
3080 ,p_commit => fnd_api.g_false
3081 ,p_init_msg_list => p_init_msg_list
3082 ,p_validation_level => p_validation_level
3083 ,p_ctr_property_template_rec => p_ctr_property_template_tbl(tab_row)
3084 ,x_return_status => x_return_status
3085 ,x_msg_count => x_msg_count
3086 ,x_msg_data => x_msg_data
3087 );
3088
3089 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3090 l_msg_index := 1;
3091 l_msg_count := x_msg_count;
3092 WHILE l_msg_count > 0 LOOP
3093 x_msg_data := FND_MSG_PUB.GET
3094 (l_msg_index,
3095 FND_API.G_FALSE);
3096 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_CTR_PROPERTY_TEMPLATE');
3097 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3098 l_msg_index := l_msg_index + 1;
3099 l_msg_count := l_msg_count - 1;
3100 END LOOP;
3101 RAISE FND_API.G_EXC_ERROR;
3102 END IF;
3103 ELSE
3104 update_ctr_property_template
3105 (p_api_version => p_api_version
3106 ,p_commit => fnd_api.g_false
3107 ,p_init_msg_list => p_init_msg_list
3108 ,p_validation_level => p_validation_level
3109 ,p_ctr_property_template_rec => p_ctr_property_template_tbl(tab_row)
3110 ,x_return_status => x_return_status
3111 ,x_msg_count => x_msg_count
3112 ,x_msg_data => x_msg_data
3113 );
3114
3115 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3116 l_msg_index := 1;
3117 l_msg_count := x_msg_count;
3118 WHILE l_msg_count > 0 LOOP
3119 x_msg_data := FND_MSG_PUB.GET
3120 (l_msg_index,
3121 FND_API.G_FALSE);
3125 l_msg_count := l_msg_count - 1;
3122 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.UPDATE_CTR_PROPERTY_TEMPLATE');
3123 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3124 l_msg_index := l_msg_index + 1;
3126 END LOOP;
3127 RAISE FND_API.G_EXC_ERROR;
3128 END IF;
3129 END IF;
3130 END IF;
3131 END LOOP;
3132 END IF;
3133
3134 IF p_counter_template_rec.counter_type = 'FORMULA' AND
3135 p_counter_template_rec.derive_function IS NULL THEN
3136
3137 IF nvl(p_counter_relationships_tbl.count,0) = 0 THEN
3138 CSI_CTR_GEN_UTILITY_PVT.ExitWithErrMsg('CSI_API_CTR_REQ_FORMULA_REF');
3139 END IF;
3140 END IF;
3141
3142 IF (p_counter_relationships_tbl.count > 0) THEN
3143 FOR tab_row IN p_counter_relationships_tbl.FIRST .. p_counter_relationships_tbl.LAST
3144 LOOP
3145 IF p_counter_relationships_tbl.EXISTS(tab_row) THEN
3146 IF ((p_counter_relationships_tbl(tab_row).relationship_id IS NULL)
3147 OR
3148 (p_counter_relationships_tbl(tab_row).relationship_id = FND_API.G_MISS_NUM))
3149 THEN
3150 p_counter_relationships_tbl(tab_row).object_counter_id := p_counter_template_rec.counter_id;
3151 create_counter_relationship
3152 (
3153 p_api_version => p_api_version
3154 ,p_commit => fnd_api.g_false
3155 ,p_init_msg_list => p_init_msg_list
3156 ,p_validation_level => p_validation_level
3157 ,p_counter_relationships_rec => p_counter_relationships_tbl(tab_row)
3158 ,x_return_status => x_return_status
3159 ,x_msg_count => x_msg_count
3160 ,x_msg_data => x_msg_data
3161 );
3162
3163 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3164 l_msg_index := 1;
3165 l_msg_count := x_msg_count;
3166 WHILE l_msg_count > 0 LOOP
3167 x_msg_data := FND_MSG_PUB.GET
3168 (l_msg_index,
3169 FND_API.G_FALSE);
3170 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.CREATE_COUNTER_RELATIONSHIP');
3171 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3172 l_msg_index := l_msg_index + 1;
3173 l_msg_count := l_msg_count - 1;
3174 END LOOP;
3175 RAISE FND_API.G_EXC_ERROR;
3176 END IF;
3177
3178 ELSE
3179 update_counter_relationship
3180 (
3181 p_api_version => p_api_version
3182 ,p_commit => fnd_api.g_false
3183 ,p_init_msg_list => p_init_msg_list
3184 ,p_validation_level => p_validation_level
3185 ,p_counter_relationships_rec => p_counter_relationships_tbl(tab_row)
3186 ,x_return_status => x_return_status
3187 ,x_msg_count => x_msg_count
3188 ,x_msg_data => x_msg_data
3189 );
3190
3191 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3192 l_msg_index := 1;
3193 l_msg_count := x_msg_count;
3194 WHILE l_msg_count > 0 LOOP
3195 x_msg_data := FND_MSG_PUB.GET
3196 (l_msg_index,
3197 FND_API.G_FALSE);
3198 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.UPDATE_COUNTER_RELATIONSHIP');
3199 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3200 l_msg_index := l_msg_index + 1;
3201 l_msg_count := l_msg_count - 1;
3202 END LOOP;
3203 RAISE FND_API.G_EXC_ERROR;
3204 END IF;
3205 END IF;
3206 END IF;
3207 END LOOP;
3208 END IF;
3209
3210 IF (p_ctr_derived_filters_tbl.count > 0) THEN
3211 FOR tab_row IN p_ctr_derived_filters_tbl.FIRST .. p_ctr_derived_filters_tbl.LAST
3212 LOOP
3213 IF p_ctr_derived_filters_tbl.EXISTS(tab_row) THEN
3214 p_ctr_derived_filters_tbl(tab_row).counter_id := p_counter_template_rec.counter_id;
3215 END IF;
3216 END LOOP;
3217
3218 update_derived_filters
3219 (
3220 p_api_version => p_api_version
3221 ,p_commit => fnd_api.g_false
3222 ,p_init_msg_list => p_init_msg_list
3223 ,p_validation_level => p_validation_level
3224 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
3225 ,x_return_status => x_return_status
3226 ,x_msg_count => x_msg_count
3227 ,x_msg_data => x_msg_data
3228 );
3229
3230 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3231 l_msg_index := 1;
3232 l_msg_count := x_msg_count;
3233 WHILE l_msg_count > 0 LOOP
3234 x_msg_data := FND_MSG_PUB.GET
3235 (l_msg_index,
3236 FND_API.G_FALSE);
3237 csi_ctr_gen_utility_pvt.put_line('Error from CSI_COUNTER_TEMPLATE_PUB.UPDATE_DERIVED_FILTERS');
3238 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3239 l_msg_index := l_msg_index + 1;
3240 l_msg_count := l_msg_count - 1;
3244 -- END IF;
3241 END LOOP;
3242 RAISE FND_API.G_EXC_ERROR;
3243 END IF;
3245 -- END LOOP;
3246 END IF;
3247
3248 -- End of API body
3249 -- Standard check of p_commit.
3250 IF FND_API.To_Boolean( p_commit ) THEN
3251 COMMIT WORK;
3252 END IF;
3253 EXCEPTION
3254 WHEN FND_API.G_EXC_ERROR THEN
3255 x_return_status := FND_API.G_RET_STS_ERROR ;
3256 ROLLBACK TO update_counter_template;
3257 FND_MSG_PUB.Count_And_Get
3258 (p_count => x_msg_count,
3259 p_data => x_msg_data
3260 );
3261
3262 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3263 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3264 ROLLBACK TO update_counter_template;
3265 FND_MSG_PUB.Count_And_Get
3266 (p_count => x_msg_count,
3267 p_data => x_msg_data
3268 );
3269 WHEN OTHERS THEN
3270 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3271 ROLLBACK TO update_counter_template;
3272 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3273 THEN
3274 FND_MSG_PUB.Add_Exc_Msg
3275 (G_PKG_NAME,
3276 l_api_name
3277 );
3278 END IF;
3279 FND_MSG_PUB.Count_And_Get
3280 (p_count => x_msg_count,
3281 p_data => x_msg_data
3282 );
3283
3284 END update_counter_template;
3285
3286
3287 --|---------------------------------------------------
3288 --| procedure name: update_ctr_property_template
3289 --| description : procedure used to
3290 --| create counter properties
3291 --|---------------------------------------------------
3292 /*#
3293 * This procedure is used to update counter property template.
3294 * @param p_api_version Current API version
3295 * @param p_commit API commits if set to fnd_api.g_true
3296 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
3297 * @param p_validation_level API validation level
3298 * @param p_ctr_property_template_rec Counter property template record structure
3299 * @param x_return_status API Return Status
3300 * @param x_msg_count Message count
3301 * @param x_msg_data Message Data
3302 * @rep:scope public
3303 * @rep:lifecycle active
3304 * @rep:displayname Update Counter Property Template
3305 */
3306
3307 PROCEDURE update_ctr_property_template
3308 (
3309 p_api_version IN NUMBER
3310 ,p_commit IN VARCHAR2
3311 ,p_init_msg_list IN VARCHAR2
3312 ,p_validation_level IN NUMBER
3313 ,p_ctr_property_template_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_property_template_rec
3314 ,x_return_status OUT NOCOPY VARCHAR2
3315 ,x_msg_count OUT NOCOPY NUMBER
3316 ,x_msg_data OUT NOCOPY VARCHAR2
3317 )
3318 IS
3319 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_CTR_PROPERTY_TEMPLATE';
3320 l_api_version CONSTANT NUMBER := 1.0;
3321 -- l_debug_level NUMBER;
3322 l_flag VARCHAR2(1) := 'N';
3323 l_msg_data VARCHAR2(2000);
3324 l_msg_index NUMBER;
3325 l_msg_count NUMBER;
3326
3327 l_count NUMBER;
3328 l_return_message VARCHAR2(100);
3329
3330 BEGIN
3331 -- Standard Start of API savepoint
3332 SAVEPOINT update_ctr_property_template;
3333
3334 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
3335
3336 -- csi_ctr_gen_utility_pvt.check_ib_active;
3337
3338 -- Standard call to check for call compatibility.
3339 IF NOT FND_API.Compatible_API_Call (l_api_version,
3340 p_api_version,
3341 l_api_name ,
3342 G_PKG_NAME )
3343 THEN
3344 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3345 END IF;
3346
3347 -- Initialize message list if p_init_msg_list is set to TRUE.
3348 IF FND_API.to_Boolean( p_init_msg_list ) THEN
3349 FND_MSG_PUB.initialize;
3350 END IF;
3351
3352 -- Initialize API return status to success
3353 x_return_status := FND_API.G_RET_STS_SUCCESS;
3354
3355 -- Read the debug profiles values in to global variable 7197402
3356 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
3357
3358 -- Check the profile option debug_level for debug message reporting
3359 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
3360
3361 -- If debug_level = 1 then dump the procedure name
3362 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
3363 csi_ctr_gen_utility_pvt.put_line( 'update_ctr_property_template');
3364 END IF;
3365
3366 -- If the debug level = 2 then dump all the parameters values.
3367 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
3368 csi_ctr_gen_utility_pvt.put_line( 'update_ctr_property_template' ||
3369 p_api_version ||'-'||
3370 p_commit ||'-'||
3371 p_init_msg_list ||'-'||
3375
3372 p_validation_level );
3373 csi_ctr_gen_utility_pvt.dump_ctr_property_template_rec(p_ctr_property_template_rec);
3374 END IF;
3376 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
3377 CSI_COUNTER_TEMPLATE_CUHK.update_ctr_prop_template_pre
3378 (
3379 p_api_version => p_api_version
3380 ,p_commit => p_commit
3381 ,p_init_msg_list => p_init_msg_list
3382 ,p_validation_level => p_validation_level
3383 ,p_ctr_property_template_rec => p_ctr_property_template_rec
3384 ,x_return_status => x_return_status
3385 ,x_msg_count => x_msg_count
3386 ,x_msg_data => x_msg_data
3387 );
3388 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3389 l_msg_index := 1;
3390 l_msg_count := x_msg_count;
3391 WHILE l_msg_count > 0 LOOP
3392 x_msg_data := FND_MSG_PUB.GET
3393 ( l_msg_index,
3394 FND_API.G_FALSE
3395 );
3396 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_ctr_prop_template_pre API ');
3397 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3398 l_msg_index := l_msg_index + 1;
3399 l_msg_count := l_msg_count - 1;
3400 END LOOP;
3401 RAISE FND_API.G_EXC_ERROR;
3402 END IF;
3403 END IF;
3404 --
3405 -- Calling Vertical Pre-processing Hook
3406 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
3407 CSI_COUNTER_TEMPLATE_VUHK.update_ctr_prop_template_pre
3408 (
3409 p_api_version => p_api_version
3410 ,p_commit => p_commit
3411 ,p_init_msg_list => p_init_msg_list
3412 ,p_validation_level => p_validation_level
3413 ,p_ctr_property_template_rec => p_ctr_property_template_rec
3414 ,x_return_status => x_return_status
3415 ,x_msg_count => x_msg_count
3416 ,x_msg_data => x_msg_data
3417 );
3418 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3419 l_msg_index := 1;
3420 l_msg_count := x_msg_count;
3421 WHILE l_msg_count > 0 LOOP
3422 x_msg_data := FND_MSG_PUB.GET
3423 ( l_msg_index,
3424 FND_API.G_FALSE
3425 );
3426 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_ctr_prop_template_pre API ');
3427 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3428 l_msg_index := l_msg_index + 1;
3429 l_msg_count := l_msg_count - 1;
3430 END LOOP;
3431 RAISE FND_API.G_EXC_ERROR;
3432 END IF;
3433 END IF;
3434
3435 csi_counter_template_pvt.update_ctr_property_template
3436 (
3437 p_api_version => p_api_version
3438 ,p_commit => fnd_api.g_false
3439 ,p_init_msg_list => p_init_msg_list
3440 ,p_validation_level => p_validation_level
3441 ,p_ctr_property_template_rec => p_ctr_property_template_rec
3442 ,x_return_status => x_return_status
3443 ,x_msg_count => x_msg_count
3444 ,x_msg_data => x_msg_data
3445 );
3446
3447 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3448 l_msg_index := 1;
3449 l_msg_count := x_msg_count;
3450
3451 WHILE l_msg_count > 0 LOOP
3452 x_msg_data := FND_MSG_PUB.GET
3453 (l_msg_index,
3454 FND_API.G_FALSE );
3455 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.UPDATE_CTR_PROPERTY_TEMPLATE');
3456 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3457 l_msg_index := l_msg_index + 1;
3458 l_msg_count := l_msg_count - 1;
3459 END LOOP;
3460 RAISE FND_API.G_EXC_ERROR;
3461 END IF;
3462
3463 -- Calling Post Customer User Hook
3464 BEGIN
3465 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
3466 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.update_ctr_prop_template_post ..');
3467 CSI_COUNTER_TEMPLATE_CUHK.update_ctr_prop_template_post
3468 (
3469 p_api_version => 1.0
3470 ,p_commit => fnd_api.g_false
3471 ,p_init_msg_list => fnd_api.g_false
3472 ,p_validation_level => fnd_api.g_valid_level_full
3473 ,p_ctr_property_template_rec => p_ctr_property_template_rec
3474 ,x_return_status => x_return_status
3475 ,x_msg_count => x_msg_count
3476 ,x_msg_data => x_msg_data
3477 );
3478 --
3479 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3480 l_msg_index := 1;
3481 l_msg_count := x_msg_count;
3482 WHILE l_msg_count > 0 LOOP
3483 x_msg_data := FND_MSG_PUB.GET
3484 ( l_msg_index,
3485 FND_API.G_FALSE );
3486 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_ctr_prop_template_post API ');
3487 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3491 RAISE FND_API.G_EXC_ERROR;
3488 l_msg_index := l_msg_index + 1;
3489 l_msg_count := l_msg_count - 1;
3490 END LOOP;
3492 END IF;
3493 --
3494 END IF;
3495 EXCEPTION
3496 WHEN OTHERS THEN
3497 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
3498 RAISE FND_API.G_EXC_ERROR;
3499 END;
3500 --
3501 -- Calling Post Vertical User Hook
3502 BEGIN
3503
3504 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
3505 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.update_ctr_prop_template_post ..');
3506 CSI_COUNTER_TEMPLATE_VUHK.update_ctr_prop_template_post
3507 (
3508 p_api_version => 1.0
3509 ,p_commit => fnd_api.g_false
3510 ,p_init_msg_list => fnd_api.g_false
3511 ,p_validation_level => fnd_api.g_valid_level_full
3512 ,p_ctr_property_template_rec => p_ctr_property_template_rec
3513 ,x_return_status => x_return_status
3514 ,x_msg_count => x_msg_count
3515 ,x_msg_data => x_msg_data
3516 );
3517 --
3518 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3519 l_msg_index := 1;
3520 l_msg_count := x_msg_count;
3521 WHILE l_msg_count > 0 LOOP
3522 x_msg_data := FND_MSG_PUB.GET
3523 ( l_msg_index,
3524 FND_API.G_FALSE );
3525 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_ctr_prop_template_post API ');
3526 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3527 l_msg_index := l_msg_index + 1;
3528 l_msg_count := l_msg_count - 1;
3529 END LOOP;
3530 RAISE FND_API.G_EXC_ERROR;
3531 END IF;
3532 --
3533 END IF;
3534 EXCEPTION
3535 WHEN OTHERS THEN
3536 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
3537 RAISE FND_API.G_EXC_ERROR;
3538 END;
3539 -- End of POST User Hooks
3540
3541 -- End of API body
3542
3543 -- Standard check of p_commit.
3544 IF FND_API.To_Boolean( p_commit ) THEN
3545 COMMIT WORK;
3546 END IF;
3547
3548 EXCEPTION
3549 WHEN FND_API.G_EXC_ERROR THEN
3550 x_return_status := FND_API.G_RET_STS_ERROR ;
3551 ROLLBACK TO update_ctr_property_template;
3552 FND_MSG_PUB.Count_And_Get
3553 (p_count => x_msg_count,
3554 p_data => x_msg_data
3555 );
3556
3557 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3558 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3559 ROLLBACK TO update_ctr_property_template;
3560 FND_MSG_PUB.Count_And_Get
3561 (p_count => x_msg_count,
3562 p_data => x_msg_data
3563 );
3564 WHEN OTHERS THEN
3565 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3566 ROLLBACK TO update_ctr_property_template;
3567 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3568 THEN
3569 FND_MSG_PUB.Add_Exc_Msg
3570 (G_PKG_NAME,
3571 l_api_name
3572 );
3573 END IF;
3574 FND_MSG_PUB.Count_And_Get
3575 (p_count => x_msg_count,
3576 p_data => x_msg_data
3577 );
3578
3579 END update_ctr_property_template;
3580
3581 --|---------------------------------------------------
3582 --| procedure name: update_counter_relationship
3583 --| description : procedure used to
3584 --| update counter relationship
3585 --|---------------------------------------------------
3586 /*#
3587 * This procedure is used to update counter relationship.
3588 * @param p_api_version Current API version
3589 * @param p_commit API commits if set to fnd_api.g_true
3590 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
3591 * @param p_validation_level API validation level
3592 * @param p_counter_relationships_rec Counter relationships Record structure
3593 * @param x_return_status API Return Status
3594 * @param x_msg_count Message count
3595 * @param x_msg_data Message Data
3596 * @rep:scope public
3597 * @rep:lifecycle active
3598 * @rep:displayname Update Counter Relationship
3599 */
3600
3601 PROCEDURE update_counter_relationship
3602 (
3603 p_api_version IN NUMBER
3604 ,p_commit IN VARCHAR2
3605 ,p_init_msg_list IN VARCHAR2
3606 ,p_validation_level IN NUMBER
3607 ,p_counter_relationships_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.counter_relationships_rec
3608 ,x_return_status OUT NOCOPY VARCHAR2
3609 ,x_msg_count OUT NOCOPY NUMBER
3610 ,x_msg_data OUT NOCOPY VARCHAR2
3611 )
3612 IS
3613 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_COUNTER_RELATIONSHIP';
3614 l_api_version CONSTANT NUMBER := 1.0;
3615 -- l_debug_level NUMBER;
3616 l_flag VARCHAR2(1) := 'N';
3620
3617 l_msg_data VARCHAR2(2000);
3618 l_msg_index NUMBER;
3619 l_msg_count NUMBER;
3621 l_count NUMBER;
3622 l_return_message VARCHAR2(100);
3623
3624 BEGIN
3625 -- Standard Start of API savepoint
3626 SAVEPOINT update_counter_relationship;
3627
3628 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
3629
3630 -- csi_ctr_gen_utility_pvt.check_ib_active;
3631
3632 -- Standard call to check for call compatibility.
3633 IF NOT FND_API.Compatible_API_Call (l_api_version,
3634 p_api_version,
3635 l_api_name ,
3636 G_PKG_NAME )
3637 THEN
3638 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3639 END IF;
3640
3641 -- Initialize message list if p_init_msg_list is set to TRUE.
3642 IF FND_API.to_Boolean( p_init_msg_list ) THEN
3643 FND_MSG_PUB.initialize;
3644 END IF;
3645
3646 -- Initialize API return status to success
3647 x_return_status := FND_API.G_RET_STS_SUCCESS;
3648
3649 -- Read the debug profiles values in to global variable 7197402
3650 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
3651
3652 -- Check the profile option debug_level for debug message reporting
3653 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
3654
3655 -- If debug_level = 1 then dump the procedure name
3656 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
3657 csi_ctr_gen_utility_pvt.put_line( 'update_counter_relationship');
3658 END IF;
3659
3660 -- If the debug level = 2 then dump all the parameters values.
3661 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
3662 csi_ctr_gen_utility_pvt.put_line( 'update_counter_relationship' ||
3663 p_api_version ||'-'||
3664 p_commit ||'-'||
3665 p_init_msg_list ||'-'||
3666 p_validation_level );
3667 csi_ctr_gen_utility_pvt.dump_ctr_relationship_rec(p_counter_relationships_rec);
3668 END IF;
3669
3670 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
3671 CSI_COUNTER_TEMPLATE_CUHK.update_ctr_relationship_pre
3672 (
3673 p_api_version => p_api_version
3674 ,p_commit => p_commit
3675 ,p_init_msg_list => p_init_msg_list
3676 ,p_validation_level => p_validation_level
3677 ,p_counter_relationships_rec => p_counter_relationships_rec
3678 ,x_return_status => x_return_status
3679 ,x_msg_count => x_msg_count
3680 ,x_msg_data => x_msg_data
3681 );
3682 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3683 l_msg_index := 1;
3684 l_msg_count := x_msg_count;
3685 WHILE l_msg_count > 0 LOOP
3686 x_msg_data := FND_MSG_PUB.GET
3687 ( l_msg_index,
3688 FND_API.G_FALSE
3689 );
3690 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_ctr_relationship_pre API ');
3691 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3692 l_msg_index := l_msg_index + 1;
3693 l_msg_count := l_msg_count - 1;
3694 END LOOP;
3695 RAISE FND_API.G_EXC_ERROR;
3696 END IF;
3697 END IF;
3698 --
3699 -- Calling Vertical Pre-processing Hook
3700 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
3701 CSI_COUNTER_TEMPLATE_VUHK.update_ctr_relationship_pre
3702 (
3703 p_api_version => p_api_version
3704 ,p_commit => p_commit
3705 ,p_init_msg_list => p_init_msg_list
3706 ,p_validation_level => p_validation_level
3707 ,p_counter_relationships_rec => p_counter_relationships_rec
3708 ,x_return_status => x_return_status
3709 ,x_msg_count => x_msg_count
3710 ,x_msg_data => x_msg_data
3711 );
3712 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3713 l_msg_index := 1;
3714 l_msg_count := x_msg_count;
3715 WHILE l_msg_count > 0 LOOP
3716 x_msg_data := FND_MSG_PUB.GET
3717 ( l_msg_index,
3718 FND_API.G_FALSE
3719 );
3720 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_ctr_relationship_pre API ');
3721 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3722 l_msg_index := l_msg_index + 1;
3723 l_msg_count := l_msg_count - 1;
3724 END LOOP;
3725 RAISE FND_API.G_EXC_ERROR;
3726 END IF;
3727 END IF;
3728
3729 csi_counter_template_pvt.update_counter_relationship
3730 (
3731 p_api_version => p_api_version
3732 ,p_commit => fnd_api.g_false
3733 ,p_init_msg_list => p_init_msg_list
3734 ,p_validation_level => p_validation_level
3735 ,p_counter_relationships_rec => p_counter_relationships_rec
3736 ,x_return_status => x_return_status
3737 ,x_msg_count => x_msg_count
3741 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3738 ,x_msg_data => x_msg_data
3739 );
3740
3742 l_msg_index := 1;
3743 l_msg_count := x_msg_count;
3744
3745 WHILE l_msg_count > 0 LOOP
3746 x_msg_data := FND_MSG_PUB.GET
3747 (l_msg_index,
3748 FND_API.G_FALSE );
3749 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.UPDATE_COUNTER_RELATIONSHIP');
3750 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3751 l_msg_index := l_msg_index + 1;
3752 l_msg_count := l_msg_count - 1;
3753 END LOOP;
3754 RAISE FND_API.G_EXC_ERROR;
3755 END IF;
3756
3757 -- Calling Post Customer User Hook
3758 BEGIN
3759 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
3760 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.update_ctr_relationship_post ..');
3761 CSI_COUNTER_TEMPLATE_CUHK.update_ctr_relationship_post
3762 (
3763 p_api_version => 1.0
3764 ,p_commit => fnd_api.g_false
3765 ,p_init_msg_list => fnd_api.g_false
3766 ,p_validation_level => fnd_api.g_valid_level_full
3767 ,p_counter_relationships_rec => p_counter_relationships_rec
3768 ,x_return_status => x_return_status
3769 ,x_msg_count => x_msg_count
3770 ,x_msg_data => x_msg_data
3771 );
3772 --
3773 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3774 l_msg_index := 1;
3775 l_msg_count := x_msg_count;
3776 WHILE l_msg_count > 0 LOOP
3777 x_msg_data := FND_MSG_PUB.GET
3778 ( l_msg_index,
3779 FND_API.G_FALSE );
3780 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_ctr_relationship_post API ');
3781 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3782 l_msg_index := l_msg_index + 1;
3783 l_msg_count := l_msg_count - 1;
3784 END LOOP;
3785 RAISE FND_API.G_EXC_ERROR;
3786 END IF;
3787 --
3788 END IF;
3789 EXCEPTION
3790 WHEN OTHERS THEN
3791 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
3792 RAISE FND_API.G_EXC_ERROR;
3793 END;
3794 --
3795 -- Calling Post Vertical User Hook
3796 BEGIN
3797
3798 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
3799 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.update_ctr_relationship_post ..');
3800 CSI_COUNTER_TEMPLATE_VUHK.update_ctr_relationship_post
3801 (
3802 p_api_version => 1.0
3803 ,p_commit => fnd_api.g_false
3804 ,p_init_msg_list => fnd_api.g_false
3805 ,p_validation_level => fnd_api.g_valid_level_full
3806 ,p_counter_relationships_rec => p_counter_relationships_rec
3807 ,x_return_status => x_return_status
3808 ,x_msg_count => x_msg_count
3809 ,x_msg_data => x_msg_data
3810 );
3811 --
3812 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3813 l_msg_index := 1;
3814 l_msg_count := x_msg_count;
3815 WHILE l_msg_count > 0 LOOP
3816 x_msg_data := FND_MSG_PUB.GET
3817 ( l_msg_index,
3818 FND_API.G_FALSE );
3819 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_ctr_relationship_post API ');
3820 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3821 l_msg_index := l_msg_index + 1;
3822 l_msg_count := l_msg_count - 1;
3823 END LOOP;
3824 RAISE FND_API.G_EXC_ERROR;
3825 END IF;
3826 --
3827 END IF;
3828 EXCEPTION
3829 WHEN OTHERS THEN
3830 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
3831 RAISE FND_API.G_EXC_ERROR;
3832 END;
3833 -- End of POST User Hooks
3834 -- End of API body
3835
3836 -- Standard check of p_commit.
3837 IF FND_API.To_Boolean( p_commit ) THEN
3838 COMMIT WORK;
3839 END IF;
3840
3841 EXCEPTION
3842 WHEN FND_API.G_EXC_ERROR THEN
3843 x_return_status := FND_API.G_RET_STS_ERROR ;
3844 ROLLBACK TO update_counter_relationship;
3845 FND_MSG_PUB.Count_And_Get
3846 (p_count => x_msg_count,
3847 p_data => x_msg_data
3848 );
3849
3850 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3851 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3852 ROLLBACK TO update_counter_relationship;
3853 FND_MSG_PUB.Count_And_Get
3854 (p_count => x_msg_count,
3855 p_data => x_msg_data
3856 );
3857 WHEN OTHERS THEN
3858 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3859 ROLLBACK TO update_counter_relationship;
3860 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3864 l_api_name
3861 THEN
3862 FND_MSG_PUB.Add_Exc_Msg
3863 (G_PKG_NAME,
3865 );
3866 END IF;
3867 FND_MSG_PUB.Count_And_Get
3868 (p_count => x_msg_count,
3869 p_data => x_msg_data
3870 );
3871
3872 END update_counter_relationship;
3873
3874 --|---------------------------------------------------
3875 --| procedure name: update_derived_filters
3876 --| description : procedure used to
3877 --| update derived filters
3878 --|---------------------------------------------------
3879 /*#
3880 * This procedure is used to update derived filters
3881 * @param p_api_version Current API version
3882 * @param p_commit API commits if set to fnd_api.g_true
3883 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
3884 * @param p_validation_level API validation level
3885 * @param p_ctr_derived_filters_rec Counter Derived Filters Record structure
3886 * @param x_return_status API Return Status
3887 * @param x_msg_count Message count
3888 * @param x_msg_data Message Data
3889 * @rep:scope public
3890 * @rep:lifecycle active
3891 * @rep:displayname Update Derived Filters
3892 */
3893
3894 PROCEDURE update_derived_filters
3895 (
3896 p_api_version IN NUMBER
3897 ,p_commit IN VARCHAR2
3898 ,p_init_msg_list IN VARCHAR2
3899 ,p_validation_level IN NUMBER
3900 ,p_ctr_derived_filters_tbl IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_derived_filters_tbl
3901 ,x_return_status OUT NOCOPY VARCHAR2
3902 ,x_msg_count OUT NOCOPY NUMBER
3903 ,x_msg_data OUT NOCOPY VARCHAR2
3904 )
3905 IS
3906 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_DERIVED_FILTERS';
3907 l_api_version CONSTANT NUMBER := 1.0;
3908 -- l_debug_level NUMBER;
3909 l_flag VARCHAR2(1) := 'N';
3910 l_msg_data VARCHAR2(2000);
3911 l_msg_index NUMBER;
3912 l_msg_count NUMBER;
3913
3914 l_count NUMBER;
3915 l_return_message VARCHAR2(100);
3916
3917 BEGIN
3918 -- Standard Start of API savepoint
3919 SAVEPOINT update_derived_filters;
3920
3921 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
3922
3923 -- csi_ctr_gen_utility_pvt.check_ib_active;
3924
3925 -- Standard call to check for call compatibility.
3926 IF NOT FND_API.Compatible_API_Call (l_api_version,
3927 p_api_version,
3928 l_api_name ,
3929 G_PKG_NAME )
3930 THEN
3931 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3932 END IF;
3933
3934 -- Initialize message list if p_init_msg_list is set to TRUE.
3935 IF FND_API.to_Boolean( p_init_msg_list ) THEN
3936 FND_MSG_PUB.initialize;
3937 END IF;
3938
3939 -- Initialize API return status to success
3940 x_return_status := FND_API.G_RET_STS_SUCCESS;
3941
3942 -- Read the debug profiles values in to global variable 7197402
3943 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
3944
3945 -- Check the profile option debug_level for debug message reporting
3946 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
3947
3948 -- If debug_level = 1 then dump the procedure name
3949 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
3950 csi_ctr_gen_utility_pvt.put_line( 'update_derived_filters');
3951 END IF;
3952
3953 -- If the debug level = 2 then dump all the parameters values.
3954 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
3955 csi_ctr_gen_utility_pvt.put_line( 'update_derived_filters' ||
3956 p_api_version ||'-'||
3957 p_commit ||'-'||
3958 p_init_msg_list ||'-'||
3959 p_validation_level );
3960 csi_ctr_gen_utility_pvt.dump_ctr_derived_filters_tbl(p_ctr_derived_filters_tbl);
3961 END IF;
3962
3963 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
3964 CSI_COUNTER_TEMPLATE_CUHK.update_derived_filters_pre
3965 (
3966 p_api_version => p_api_version
3967 ,p_commit => p_commit
3968 ,p_init_msg_list => p_init_msg_list
3969 ,p_validation_level => p_validation_level
3970 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
3971 ,x_return_status => x_return_status
3972 ,x_msg_count => x_msg_count
3973 ,x_msg_data => x_msg_data
3974 );
3975 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
3976 l_msg_index := 1;
3977 l_msg_count := x_msg_count;
3978 WHILE l_msg_count > 0 LOOP
3979 x_msg_data := FND_MSG_PUB.GET
3980 ( l_msg_index,
3981 FND_API.G_FALSE
3982 );
3983 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_derived_filters_pre API ');
3984 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
3985 l_msg_index := l_msg_index + 1;
3986 l_msg_count := l_msg_count - 1;
3987 END LOOP;
3988 RAISE FND_API.G_EXC_ERROR;
3989 END IF;
3990 END IF;
3994 CSI_COUNTER_TEMPLATE_VUHK.update_derived_filters_pre
3991 --
3992 -- Calling Vertical Pre-processing Hook
3993 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
3995 (
3996 p_api_version => p_api_version
3997 ,p_commit => p_commit
3998 ,p_init_msg_list => p_init_msg_list
3999 ,p_validation_level => p_validation_level
4000 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
4001 ,x_return_status => x_return_status
4002 ,x_msg_count => x_msg_count
4003 ,x_msg_data => x_msg_data
4004 );
4005 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4006 l_msg_index := 1;
4007 l_msg_count := x_msg_count;
4008 WHILE l_msg_count > 0 LOOP
4009 x_msg_data := FND_MSG_PUB.GET
4010 ( l_msg_index,
4011 FND_API.G_FALSE
4012 );
4013 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_derived_filters_pre API ');
4014 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4015 l_msg_index := l_msg_index + 1;
4016 l_msg_count := l_msg_count - 1;
4017 END LOOP;
4018 RAISE FND_API.G_EXC_ERROR;
4019 END IF;
4020 END IF;
4021
4022
4023 csi_counter_template_pvt.update_derived_filters
4024 (
4025 p_api_version => p_api_version
4026 ,p_commit => fnd_api.g_false
4027 ,p_init_msg_list => p_init_msg_list
4028 ,p_validation_level => p_validation_level
4029 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
4030 ,x_return_status => x_return_status
4031 ,x_msg_count => x_msg_count
4032 ,x_msg_data => x_msg_data
4033 );
4034
4035 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4036 l_msg_index := 1;
4037 l_msg_count := x_msg_count;
4038
4039 WHILE l_msg_count > 0 LOOP
4040 x_msg_data := FND_MSG_PUB.GET
4041 (l_msg_index,
4042 FND_API.G_FALSE );
4043 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.UPDATE_DERIVED_FILTERS');
4044 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4045 l_msg_index := l_msg_index + 1;
4046 l_msg_count := l_msg_count - 1;
4047 END LOOP;
4048 RAISE FND_API.G_EXC_ERROR;
4049 END IF;
4050
4051 -- Calling Post Customer User Hook
4052 BEGIN
4053 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
4054 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.update_derived_filters_post ..');
4055 CSI_COUNTER_TEMPLATE_CUHK.update_derived_filters_post
4056 (
4057 p_api_version => 1.0
4058 ,p_commit => fnd_api.g_false
4059 ,p_init_msg_list => fnd_api.g_false
4060 ,p_validation_level => fnd_api.g_valid_level_full
4061 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
4062 ,x_return_status => x_return_status
4063 ,x_msg_count => x_msg_count
4064 ,x_msg_data => x_msg_data
4065 );
4066 --
4067 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4068 l_msg_index := 1;
4069 l_msg_count := x_msg_count;
4070 WHILE l_msg_count > 0 LOOP
4071 x_msg_data := FND_MSG_PUB.GET
4072 ( l_msg_index,
4073 FND_API.G_FALSE );
4074 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_derived_filters_post API ');
4075 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4076 l_msg_index := l_msg_index + 1;
4077 l_msg_count := l_msg_count - 1;
4078 END LOOP;
4079 RAISE FND_API.G_EXC_ERROR;
4080 END IF;
4081 --
4082 END IF;
4083 EXCEPTION
4084 WHEN OTHERS THEN
4085 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
4086 RAISE FND_API.G_EXC_ERROR;
4087 END;
4088 --
4089 -- Calling Post Vertical User Hook
4090 BEGIN
4091
4092 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
4093 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.update_derived_filters_post ..');
4094 CSI_COUNTER_TEMPLATE_VUHK.update_derived_filters_post
4095 (
4096 p_api_version => 1.0
4097 ,p_commit => fnd_api.g_false
4098 ,p_init_msg_list => fnd_api.g_false
4099 ,p_validation_level => fnd_api.g_valid_level_full
4100 ,p_ctr_derived_filters_tbl => p_ctr_derived_filters_tbl
4101 ,x_return_status => x_return_status
4102 ,x_msg_count => x_msg_count
4103 ,x_msg_data => x_msg_data
4104 );
4105 --
4106 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4107 l_msg_index := 1;
4108 l_msg_count := x_msg_count;
4109 WHILE l_msg_count > 0 LOOP
4113 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_derived_filters_post API ');
4110 x_msg_data := FND_MSG_PUB.GET
4111 ( l_msg_index,
4112 FND_API.G_FALSE );
4114 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4115 l_msg_index := l_msg_index + 1;
4116 l_msg_count := l_msg_count - 1;
4117 END LOOP;
4118 RAISE FND_API.G_EXC_ERROR;
4119 END IF;
4120 --
4121 END IF;
4122 EXCEPTION
4123 WHEN OTHERS THEN
4124 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
4125 RAISE FND_API.G_EXC_ERROR;
4126 END;
4127 -- End of POST User Hooks
4128
4129 -- End of API body
4130
4131 -- Standard check of p_commit.
4132 IF FND_API.To_Boolean( p_commit ) THEN
4133 COMMIT WORK;
4134 END IF;
4135
4136 EXCEPTION
4137 WHEN FND_API.G_EXC_ERROR THEN
4138 x_return_status := FND_API.G_RET_STS_ERROR ;
4139 ROLLBACK TO update_derived_filters;
4140 FND_MSG_PUB.Count_And_Get
4141 (p_count => x_msg_count,
4142 p_data => x_msg_data
4143 );
4144
4145 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4146 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4147 ROLLBACK TO update_derived_filters;
4148 FND_MSG_PUB.Count_And_Get
4149 (p_count => x_msg_count,
4150 p_data => x_msg_data
4151 );
4152
4153 WHEN OTHERS THEN
4154 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4155 ROLLBACK TO update_derived_filters;
4156 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4157 THEN
4158 FND_MSG_PUB.Add_Exc_Msg
4159 (G_PKG_NAME,
4160 l_api_name
4161 );
4162 END IF;
4163 FND_MSG_PUB.Count_And_Get
4164 (p_count => x_msg_count,
4165 p_data => x_msg_data
4166 );
4167
4168 END update_derived_filters;
4169
4170 /*#
4171 * This procedure is used to create estimation method
4172 * @param p_api_version Current API version
4173 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
4174 * @param p_commit API commits if set to fnd_api.g_true
4175 * @param p_validation_level API validation level
4176 * @param x_return_status API Return Status
4177 * @param x_msg_count Message count
4178 * @param x_msg_data Message Data
4179 * @param p_ctr_estimation_rec Counter Estimation Record structure
4180 * @rep:scope public
4181 * @rep:lifecycle active
4182 * @rep:displayname Create Estimation Method
4183 */
4184 PROCEDURE create_estimation_method
4185 (
4186 p_api_version IN NUMBER
4187 ,p_init_msg_list IN VARCHAR2
4188 ,p_commit IN VARCHAR2
4189 ,p_validation_level IN NUMBER
4190 ,x_return_status OUT NOCOPY VARCHAR2
4191 ,x_msg_count OUT NOCOPY NUMBER
4192 ,x_msg_data OUT NOCOPY VARCHAR2
4193 ,p_ctr_estimation_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_estimation_methods_rec
4194 ) IS
4195 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_ESTIMATION_METHOD';
4196 l_api_version CONSTANT NUMBER := 1.0;
4197 -- l_debug_level NUMBER;
4198 l_flag VARCHAR2(1) := 'N';
4199 l_msg_data VARCHAR2(2000);
4200 l_msg_index NUMBER;
4201 l_msg_count NUMBER;
4202
4203 l_count NUMBER;
4204 l_return_message VARCHAR2(100);
4205
4206 BEGIN
4207 -- Standard Start of API savepoint
4208 SAVEPOINT create_estimation_method;
4209
4210 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
4211
4212 -- csi_ctr_gen_utility_pvt.check_ib_active;
4213
4214 -- Standard call to check for call compatibility.
4215 IF NOT FND_API.Compatible_API_Call (l_api_version,
4216 p_api_version,
4217 l_api_name ,
4218 G_PKG_NAME )
4219 THEN
4220 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4221 END IF;
4222
4223 -- Initialize message list if p_init_msg_list is set to TRUE.
4224 IF FND_API.to_Boolean( p_init_msg_list ) THEN
4225 FND_MSG_PUB.initialize;
4226 END IF;
4227
4228 -- Initialize API return status to success
4229 x_return_status := FND_API.G_RET_STS_SUCCESS;
4230
4231 -- Read the debug profiles values in to global variable 7197402
4232 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
4233
4234 -- Check the profile option debug_level for debug message reporting
4235 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
4236
4237 -- If debug_level = 1 then dump the procedure name
4238 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
4239 csi_ctr_gen_utility_pvt.put_line( 'create_derived_filters');
4240 END IF;
4241
4242 -- If the debug level = 2 then dump all the parameters values.
4246 p_commit ||'-'||
4243 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
4244 csi_ctr_gen_utility_pvt.put_line( 'create_estimation_method ' ||
4245 p_api_version ||'-'||
4247 p_init_msg_list ||'-'||
4248 p_validation_level );
4249 csi_ctr_gen_utility_pvt.dm_ctr_estimation_methods_rec(p_ctr_estimation_rec);
4250 END IF;
4251
4252 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
4253 CSI_COUNTER_TEMPLATE_CUHK.create_estimation_method_pre
4254 (
4255 p_api_version => p_api_version
4256 ,p_init_msg_list => p_init_msg_list
4257 ,p_commit => p_commit
4258 ,p_validation_level => p_validation_level
4259 ,x_return_status => x_return_status
4260 ,x_msg_count => x_msg_count
4261 ,x_msg_data => x_msg_data
4262 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4263 );
4264 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4265 l_msg_index := 1;
4266 l_msg_count := x_msg_count;
4267 WHILE l_msg_count > 0 LOOP
4268 x_msg_data := FND_MSG_PUB.GET
4269 ( l_msg_index,
4270 FND_API.G_FALSE
4271 );
4272 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_estimation_method_pre API ');
4273 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4274 l_msg_index := l_msg_index + 1;
4275 l_msg_count := l_msg_count - 1;
4276 END LOOP;
4277 RAISE FND_API.G_EXC_ERROR;
4278 END IF;
4279 END IF;
4280 --
4281 -- Calling Vertical Pre-processing Hook
4282 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
4283 CSI_COUNTER_TEMPLATE_VUHK.create_estimation_method_pre
4284 (
4285 p_api_version => p_api_version
4286 ,p_init_msg_list => p_init_msg_list
4287 ,p_commit => p_commit
4288 ,p_validation_level => p_validation_level
4289 ,x_return_status => x_return_status
4290 ,x_msg_count => x_msg_count
4291 ,x_msg_data => x_msg_data
4292 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4293 );
4294 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4295 l_msg_index := 1;
4296 l_msg_count := x_msg_count;
4297 WHILE l_msg_count > 0 LOOP
4298 x_msg_data := FND_MSG_PUB.GET
4299 ( l_msg_index,
4300 FND_API.G_FALSE
4301 );
4302 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_estimation_method_pre API ');
4303 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4304 l_msg_index := l_msg_index + 1;
4305 l_msg_count := l_msg_count - 1;
4306 END LOOP;
4307 RAISE FND_API.G_EXC_ERROR;
4308 END IF;
4309 END IF;
4310
4311 csi_counter_template_pvt.create_estimation_method
4312 (
4313 p_api_version => p_api_version
4314 ,p_commit => fnd_api.g_false
4315 ,p_init_msg_list => p_init_msg_list
4316 ,p_validation_level => p_validation_level
4317 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4318 ,x_return_status => x_return_status
4319 ,x_msg_count => x_msg_count
4320 ,x_msg_data => x_msg_data
4321 );
4322
4323 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4324 l_msg_index := 1;
4325 l_msg_count := x_msg_count;
4326
4327 WHILE l_msg_count > 0 LOOP
4328 x_msg_data := FND_MSG_PUB.GET
4329 (l_msg_index,
4330 FND_API.G_FALSE );
4331 csi_ctr_gen_utility_pvt.put_line( ' Error from csi_counter_template_pvt.create_estimation_method');
4332 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4333 l_msg_index := l_msg_index + 1;
4334 l_msg_count := l_msg_count - 1;
4335 END LOOP;
4336 RAISE FND_API.G_EXC_ERROR;
4337 END IF;
4338
4339 -- Calling Post Customer User Hook
4340 BEGIN
4341 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
4342 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.create_estimation_method_post ..');
4343 CSI_COUNTER_TEMPLATE_CUHK.create_estimation_method_post
4344 (
4345 p_api_version => p_api_version
4346 ,p_init_msg_list => p_init_msg_list
4347 ,p_commit => p_commit
4348 ,p_validation_level => p_validation_level
4349 ,x_return_status => x_return_status
4350 ,x_msg_count => x_msg_count
4351 ,x_msg_data => x_msg_data
4352 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4353 );
4354 --
4355 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4356 l_msg_index := 1;
4357 l_msg_count := x_msg_count;
4358 WHILE l_msg_count > 0 LOOP
4359 x_msg_data := FND_MSG_PUB.GET
4360 ( l_msg_index,
4361 FND_API.G_FALSE );
4365 l_msg_count := l_msg_count - 1;
4362 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.create_estimation_method_post API ');
4363 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4364 l_msg_index := l_msg_index + 1;
4366 END LOOP;
4367 RAISE FND_API.G_EXC_ERROR;
4368 END IF;
4369 --
4370 END IF;
4371 EXCEPTION
4372 WHEN OTHERS THEN
4373 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
4374 RAISE FND_API.G_EXC_ERROR;
4375 END;
4376 --
4377 -- Calling Post Vertical User Hook
4378 BEGIN
4379
4380 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
4381 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.create_estimation_method_post ..');
4382 CSI_COUNTER_TEMPLATE_VUHK.create_estimation_method_post
4383 ( p_api_version => p_api_version
4384 ,p_init_msg_list => p_init_msg_list
4385 ,p_commit => p_commit
4386 ,p_validation_level => p_validation_level
4387 ,x_return_status => x_return_status
4388 ,x_msg_count => x_msg_count
4389 ,x_msg_data => x_msg_data
4390 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4391 );
4392 --
4393 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4394 l_msg_index := 1;
4395 l_msg_count := x_msg_count;
4396 WHILE l_msg_count > 0 LOOP
4397 x_msg_data := FND_MSG_PUB.GET
4398 ( l_msg_index,
4399 FND_API.G_FALSE );
4400 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.create_estimation_method_post ');
4401 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4402 l_msg_index := l_msg_index + 1;
4403 l_msg_count := l_msg_count - 1;
4404 END LOOP;
4405 RAISE FND_API.G_EXC_ERROR;
4406 END IF;
4407 --
4408 END IF;
4409 EXCEPTION
4410 WHEN OTHERS THEN
4411 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
4412 RAISE FND_API.G_EXC_ERROR;
4413 END;
4414 -- End of POST User Hooks
4415
4416 -- End of API body
4417
4418 -- Standard check of p_commit.
4419 IF FND_API.To_Boolean( p_commit ) THEN
4420 COMMIT WORK;
4421 END IF;
4422
4423 EXCEPTION
4424 WHEN FND_API.G_EXC_ERROR THEN
4425 x_return_status := FND_API.G_RET_STS_ERROR ;
4426 ROLLBACK TO create_estimation_method;
4427 FND_MSG_PUB.Count_And_Get
4428 (p_count => x_msg_count,
4429 p_data => x_msg_data
4430 );
4431
4432 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4433 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4434 ROLLBACK TO create_estimation_method;
4435 FND_MSG_PUB.Count_And_Get
4436 (p_count => x_msg_count,
4437 p_data => x_msg_data
4438 );
4439
4440 WHEN OTHERS THEN
4441 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4442 ROLLBACK TO create_estimation_method;
4443 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4444 THEN
4445 FND_MSG_PUB.Add_Exc_Msg
4446 (G_PKG_NAME,
4447 l_api_name
4448 );
4449 END IF;
4450 FND_MSG_PUB.Count_And_Get
4451 (p_count => x_msg_count,
4452 p_data => x_msg_data
4453 );
4454 END create_estimation_method;
4455
4456 /*#
4457 * This procedure is used to update estimation method
4458 * @param p_api_version Current API version
4459 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
4460 * @param p_commit API commits if set to fnd_api.g_true
4461 * @param p_validation_level API validation level
4462 * @param x_return_status API Return Status
4463 * @param x_msg_count Message count
4464 * @param x_msg_data Message Data
4465 * @param p_ctr_estimation_rec Counter Estimation Record structure
4466 * @rep:scope public
4467 * @rep:lifecycle active
4468 * @rep:displayname Update Estimation Method
4469 */
4470 PROCEDURE Update_Estimation_Method
4471 (
4472 p_api_version IN NUMBER
4473 ,p_init_msg_list IN VARCHAR2
4474 ,p_commit IN VARCHAR2
4475 ,p_validation_level IN NUMBER
4476 ,x_return_status OUT NOCOPY VARCHAR2
4477 ,x_msg_count OUT NOCOPY NUMBER
4478 ,x_msg_data OUT NOCOPY VARCHAR2
4479 ,p_ctr_estimation_rec IN OUT NOCOPY CSI_CTR_DATASTRUCTURES_PUB.ctr_estimation_methods_rec
4480 ) IS
4481 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_ESTIMATION_METHOD';
4482 l_api_version CONSTANT NUMBER := 1.0;
4483 -- l_debug_level NUMBER;
4484 l_flag VARCHAR2(1) := 'N';
4485 l_msg_data VARCHAR2(2000);
4486 l_msg_index NUMBER;
4487 l_msg_count NUMBER;
4488
4489 l_count NUMBER;
4493 -- Standard Start of API savepoint
4490 l_return_message VARCHAR2(100);
4491
4492 BEGIN
4494 SAVEPOINT update_estimation_method;
4495
4496 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
4497
4498 -- csi_ctr_gen_utility_pvt.check_ib_active;
4499
4500 -- Standard call to check for call compatibility.
4501 IF NOT FND_API.Compatible_API_Call (l_api_version,
4502 p_api_version,
4503 l_api_name ,
4504 G_PKG_NAME )
4505 THEN
4506 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4507 END IF;
4508
4509 -- Initialize message list if p_init_msg_list is set to TRUE.
4510 IF FND_API.to_Boolean( p_init_msg_list ) THEN
4511 FND_MSG_PUB.initialize;
4512 END IF;
4513
4514 -- Initialize API return status to success
4515 x_return_status := FND_API.G_RET_STS_SUCCESS;
4516
4517 -- Read the debug profiles values in to global variable 7197402
4518 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
4519
4520 -- Check the profile option debug_level for debug message reporting
4521 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
4522
4523 -- If debug_level = 1 then dump the procedure name
4524 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
4525 csi_ctr_gen_utility_pvt.put_line( 'update_estimation_method');
4526 END IF;
4527
4528 -- If the debug level = 2 then dump all the parameters values.
4529 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
4530 csi_ctr_gen_utility_pvt.put_line( 'update_estimation_method ' ||
4531 p_api_version ||'-'||
4532 p_commit ||'-'||
4533 p_init_msg_list ||'-'||
4534 p_validation_level );
4535 csi_ctr_gen_utility_pvt.dm_ctr_estimation_methods_rec(p_ctr_estimation_rec);
4536 END IF;
4537
4538 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
4539 CSI_COUNTER_TEMPLATE_CUHK.update_estimation_method_pre
4540 (
4541 p_api_version => p_api_version
4542 ,p_init_msg_list => p_init_msg_list
4543 ,p_commit => p_commit
4544 ,p_validation_level => p_validation_level
4545 ,x_return_status => x_return_status
4546 ,x_msg_count => x_msg_count
4547 ,x_msg_data => x_msg_data
4548 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4549 );
4550 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4551 l_msg_index := 1;
4552 l_msg_count := x_msg_count;
4553 WHILE l_msg_count > 0 LOOP
4554 x_msg_data := FND_MSG_PUB.GET
4555 ( l_msg_index,
4556 FND_API.G_FALSE
4557 );
4558 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_estimation_method_pre API ');
4559 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4560 l_msg_index := l_msg_index + 1;
4561 l_msg_count := l_msg_count - 1;
4562 END LOOP;
4563 RAISE FND_API.G_EXC_ERROR;
4564 END IF;
4565 END IF;
4566 --
4567 -- Calling Vertical Pre-processing Hook
4568 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
4569 CSI_COUNTER_TEMPLATE_VUHK.update_estimation_method_pre
4570 (
4571 p_api_version => p_api_version
4572 ,p_init_msg_list => p_init_msg_list
4573 ,p_commit => p_commit
4574 ,p_validation_level => p_validation_level
4575 ,x_return_status => x_return_status
4576 ,x_msg_count => x_msg_count
4577 ,x_msg_data => x_msg_data
4578 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4579 );
4580 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4581 l_msg_index := 1;
4582 l_msg_count := x_msg_count;
4583 WHILE l_msg_count > 0 LOOP
4584 x_msg_data := FND_MSG_PUB.GET
4585 ( l_msg_index,
4586 FND_API.G_FALSE
4587 );
4588 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_estimation_method_pre API ');
4589 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4590 l_msg_index := l_msg_index + 1;
4591 l_msg_count := l_msg_count - 1;
4592 END LOOP;
4593 RAISE FND_API.G_EXC_ERROR;
4594 END IF;
4595 END IF;
4596
4597
4598 csi_counter_template_pvt.update_estimation_method
4599 (
4600 p_api_version => p_api_version
4601 ,p_commit => fnd_api.g_false
4602 ,p_init_msg_list => p_init_msg_list
4603 ,p_validation_level => p_validation_level
4604 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4605 ,x_return_status => x_return_status
4606 ,x_msg_count => x_msg_count
4607 ,x_msg_data => x_msg_data
4608 );
4609
4610 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4611 l_msg_index := 1;
4612 l_msg_count := x_msg_count;
4613
4614 WHILE l_msg_count > 0 LOOP
4615 x_msg_data := FND_MSG_PUB.GET
4616 (l_msg_index,
4620 l_msg_index := l_msg_index + 1;
4617 FND_API.G_FALSE );
4618 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.UPDATE_ESTIMATION_METHOD');
4619 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4621 l_msg_count := l_msg_count - 1;
4622 END LOOP;
4623 RAISE FND_API.G_EXC_ERROR;
4624 END IF;
4625
4626 -- Calling Post Customer User Hook
4627 BEGIN
4628 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
4629 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.update_estimation_method_post ..');
4630 CSI_COUNTER_TEMPLATE_CUHK.update_estimation_method_post
4631 (
4632 p_api_version => p_api_version
4633 ,p_init_msg_list => p_init_msg_list
4634 ,p_commit => p_commit
4635 ,p_validation_level => p_validation_level
4636 ,x_return_status => x_return_status
4637 ,x_msg_count => x_msg_count
4638 ,x_msg_data => x_msg_data
4639 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4640 );
4641 --
4642 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4643 l_msg_index := 1;
4644 l_msg_count := x_msg_count;
4645 WHILE l_msg_count > 0 LOOP
4646 x_msg_data := FND_MSG_PUB.GET
4647 ( l_msg_index,
4648 FND_API.G_FALSE );
4649 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.update_estimation_method_post API ');
4650 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4651 l_msg_index := l_msg_index + 1;
4652 l_msg_count := l_msg_count - 1;
4653 END LOOP;
4654 RAISE FND_API.G_EXC_ERROR;
4655 END IF;
4656 --
4657 END IF;
4658 EXCEPTION
4659 WHEN OTHERS THEN
4660 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
4661 RAISE FND_API.G_EXC_ERROR;
4662 END;
4663 --
4664 -- Calling Post Vertical User Hook
4665 BEGIN
4666
4667 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
4668 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.update_estimation_method_post ..');
4669 CSI_COUNTER_TEMPLATE_VUHK.update_estimation_method_post
4670 (
4671 p_api_version => p_api_version
4672 ,p_init_msg_list => p_init_msg_list
4673 ,p_commit => p_commit
4674 ,p_validation_level => p_validation_level
4675 ,x_return_status => x_return_status
4676 ,x_msg_count => x_msg_count
4677 ,x_msg_data => x_msg_data
4678 ,p_ctr_estimation_rec => p_ctr_estimation_rec
4679 );
4680 --
4681 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4682 l_msg_index := 1;
4683 l_msg_count := x_msg_count;
4684 WHILE l_msg_count > 0 LOOP
4685 x_msg_data := FND_MSG_PUB.GET
4686 ( l_msg_index,
4687 FND_API.G_FALSE );
4688 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.update_estimation_method_post API ');
4689 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4690 l_msg_index := l_msg_index + 1;
4691 l_msg_count := l_msg_count - 1;
4692 END LOOP;
4693 RAISE FND_API.G_EXC_ERROR;
4694 END IF;
4695 --
4696 END IF;
4697 EXCEPTION
4698 WHEN OTHERS THEN
4699 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
4700 RAISE FND_API.G_EXC_ERROR;
4701 END;
4702 -- End of POST User Hooks
4703 -- End of API body
4704
4705 -- Standard check of p_commit.
4706 IF FND_API.To_Boolean( p_commit ) THEN
4707 COMMIT WORK;
4708 END IF;
4709
4710 EXCEPTION
4711 WHEN FND_API.G_EXC_ERROR THEN
4712 x_return_status := FND_API.G_RET_STS_ERROR ;
4713 ROLLBACK TO update_estimation_method;
4714 FND_MSG_PUB.Count_And_Get
4715 (p_count => x_msg_count,
4716 p_data => x_msg_data
4717 );
4718
4719 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4720 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4721 ROLLBACK TO update_estimation_method;
4722 FND_MSG_PUB.Count_And_Get
4723 (p_count => x_msg_count,
4724 p_data => x_msg_data
4725 );
4726
4727 WHEN OTHERS THEN
4728 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
4729 ROLLBACK TO update_estimation_method;
4730 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4731 THEN
4732 FND_MSG_PUB.Add_Exc_Msg
4733 (G_PKG_NAME,
4734 l_api_name
4735 );
4736 END IF;
4737 FND_MSG_PUB.Count_And_Get
4738 (p_count => x_msg_count,
4739 p_data => x_msg_data
4740 );
4741 END update_estimation_method;
4742
4743 /*#
4747 * @param p_api_version Current API version
4744 * This procedure is used to prepare Counter template
4745 * data before instantiating them to become Counter
4746 * Instance.
4748 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
4749 * @param p_commit API commits if set to fnd_api.g_true
4750 * @param x_return_status API Return Status
4751 * @param x_msg_count Message count
4752 * @param x_msg_data Message Data
4753 * @param p_source_object_id_template The Inventory Item Id
4754 * @param p_source_object_id_instance The counter Id
4755 * @param x_ctr_id_template The counter id
4756 * @param x_ctr_id_instance The new item instance id
4757 * @param p_organization_id The organization id
4758 * @rep:scope public
4759 * @rep:lifecycle active
4760 * @rep:displayname Autoinstantiate Counters
4761 */
4762
4763 PROCEDURE AutoInstantiate_Counters
4764 (
4765 p_api_version IN NUMBER
4766 ,p_init_msg_list IN VARCHAR2
4767 ,p_commit IN VARCHAR2
4768 ,x_return_status OUT NOCOPY VARCHAR2
4769 ,x_msg_count OUT NOCOPY NUMBER
4770 ,x_msg_data OUT NOCOPY VARCHAR2
4771 ,p_source_object_id_template IN NUMBER
4772 ,p_source_object_id_instance IN NUMBER
4773 ,x_ctr_id_template IN OUT NOCOPY ctr_template_autoinst_tbl
4774 ,x_ctr_id_instance IN OUT NOCOPY counter_autoinstantiate_tbl
4775 ,x_ctr_grp_id_template IN OUT NOCOPY NUMBER
4776 ,x_ctr_grp_id_instance IN OUT NOCOPY NUMBER
4777 ,p_organization_id IN NUMBER
4778 ) IS
4779
4780 CURSOR ctr_item_assoc(p_source_object_id_template NUMBER) IS
4781 SELECT cia.counter_id, cia.group_id, cia.associated_to_group,
4782 ctr.counter_type, cia.primary_failure_flag
4783 FROM csi_ctr_item_associations cia, csi_counter_template_b ctr
4784 WHERE cia.counter_id = ctr.counter_id
4785 AND inventory_item_id = p_source_object_id_template
4786 AND nvl(cia.associated_to_group,'N') = 'N'
4787 AND nvl (cia.end_date_active, sysdate+1) > sysdate
4788 ORDER BY counter_type DESC;
4789
4790 CURSOR ctr_grp_assoc(p_source_object_id_template NUMBER) IS
4791 SELECT cia.counter_id, cia.group_id,
4792 cia.associated_to_group, cia.primary_failure_flag
4793 FROM csi_ctr_item_associations cia, cs_csi_counter_groups cg
4794 WHERE cia.group_id = cg.counter_group_id
4795 AND cia.inventory_item_id = p_source_object_id_template
4796 AND cia.counter_id IS NULL
4797 AND nvl (cia.end_date_active, sysdate+1) > sysdate
4798 AND nvl(cia.associated_to_group,'N') = 'Y';
4799
4800 l_api_name CONSTANT VARCHAR2(30) := 'AUTOINSTANTIATE_COUNTERS';
4801 l_api_version CONSTANT NUMBER := 1.0;
4802 -- l_debug_level NUMBER;
4803 l_flag VARCHAR2(1) := 'N';
4804 l_msg_data VARCHAR2(2000);
4805 l_msg_index NUMBER;
4806 l_msg_count NUMBER;
4807
4808 l_count NUMBER;
4809 l_return_message VARCHAR2(100);
4810
4811 l_COMMS_NL_TRACKABLE_FLAG VARCHAR2(1);
4812 l_item VARCHAR2(40);
4813 l_counter_id NUMBER;
4814 l_validation_level NUMBER;
4815 l_source_object_cd VARCHAR2(30);
4816
4817 l_group_id NUMBER;
4818 l_associated_to_group NUMBER;
4819 l_ctr_id_template NUMBER;
4820 l_ctr_id_instance NUMBER;
4821 l_ctr_template_autoinst_tbl ctr_template_autoinst_tbl;
4822 l_ctr_template_autoinst_count NUMBER := 0;
4823 l_counter_autoinstantiate_tbl counter_autoinstantiate_tbl;
4824 l_counter_autoinst_count NUMBER := 0;
4825 l_curr_maint_org_id NUMBER;
4826 l_eam_item_type NUMBER;
4827 BEGIN
4828 -- Standard Start of API savepoint
4829 SAVEPOINT autoinstantiate_counters;
4830
4831 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
4832
4833 -- csi_ctr_gen_utility_pvt.check_ib_active;
4834
4835 -- Standard call to check for call compatibility.
4836 IF NOT FND_API.Compatible_API_Call (l_api_version,
4837 p_api_version,
4838 l_api_name ,
4839 G_PKG_NAME )
4840 THEN
4841 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4842 END IF;
4843
4844 -- Initialize message list if p_init_msg_list is set to TRUE.
4845 IF FND_API.to_Boolean( p_init_msg_list ) THEN
4846 FND_MSG_PUB.initialize;
4847 END IF;
4848
4849 -- Initialize API return status to success
4850 x_return_status := FND_API.G_RET_STS_SUCCESS;
4851
4852 -- Read the debug profiles values in to global variable 7197402
4853 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
4854
4855 -- Check the profile option debug_level for debug message reporting
4856 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
4857
4858 -- If debug_level = 1 then dump the procedure name
4859 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
4860 csi_ctr_gen_utility_pvt.put_line( 'autoinstantiate_counters');
4861 END IF;
4862
4863 -- If the debug level = 2 then dump all the parameters values.
4864 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
4865 csi_ctr_gen_utility_pvt.put_line( 'autoinstantiate_counters' ||
4869 l_validation_level );
4866 p_api_version ||'-'||
4867 p_commit ||'-'||
4868 p_init_msg_list ||'-'||
4870 -- csi_ctr_gen_utility_pvt.dump_instantiate_ctr_rec(p_);
4871 END IF;
4872
4873 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
4874 CSI_COUNTER_TEMPLATE_CUHK.AutoInstantiate_Counters_pre
4875 (
4876 p_api_version => p_api_version
4877 ,p_init_msg_list => p_init_msg_list
4878 ,p_commit => p_commit
4879 ,x_return_status => x_return_status
4880 ,x_msg_count => x_msg_count
4881 ,x_msg_data => x_msg_data
4882 ,p_source_object_id_template => p_source_object_id_template
4883 ,p_source_object_id_instance => p_source_object_id_instance
4884 ,x_ctr_id_template => x_ctr_id_template
4885 ,x_ctr_id_instance => x_ctr_id_instance
4886 ,x_ctr_grp_id_template => x_ctr_grp_id_template
4887 ,x_ctr_grp_id_instance => x_ctr_grp_id_instance
4888 ,p_organization_id => p_organization_id
4889 );
4890
4891 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4892 l_msg_index := 1;
4893 l_msg_count := x_msg_count;
4894 WHILE l_msg_count > 0 LOOP
4895 x_msg_data := FND_MSG_PUB.GET
4896 ( l_msg_index,
4897 FND_API.G_FALSE
4898 );
4899 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.AutoInstantiate_Counters_pre API ');
4900 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4901 l_msg_index := l_msg_index + 1;
4902 l_msg_count := l_msg_count - 1;
4903 END LOOP;
4904 RAISE FND_API.G_EXC_ERROR;
4905 END IF;
4906 END IF;
4907 --
4908 -- Calling Vertical Pre-processing Hook
4909 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
4910 CSI_COUNTER_TEMPLATE_VUHK.AutoInstantiate_Counters_pre
4911 (
4912 p_api_version => p_api_version
4913 ,p_init_msg_list => p_init_msg_list
4914 ,p_commit => p_commit
4915 ,x_return_status => x_return_status
4916 ,x_msg_count => x_msg_count
4917 ,x_msg_data => x_msg_data
4918 ,p_source_object_id_template => p_source_object_id_template
4919 ,p_source_object_id_instance => p_source_object_id_instance
4920 ,x_ctr_id_template => x_ctr_id_template
4921 ,x_ctr_id_instance => x_ctr_id_instance
4922 ,x_ctr_grp_id_template => x_ctr_grp_id_template
4923 ,x_ctr_grp_id_instance => x_ctr_grp_id_instance
4924 ,p_organization_id => p_organization_id
4925 );
4926 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
4927 l_msg_index := 1;
4928 l_msg_count := x_msg_count;
4929 WHILE l_msg_count > 0 LOOP
4930 x_msg_data := FND_MSG_PUB.GET
4931 ( l_msg_index,
4932 FND_API.G_FALSE
4933 );
4934 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.AutoInstantiate_Counters_pre API ');
4935 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
4936 l_msg_index := l_msg_index + 1;
4937 l_msg_count := l_msg_count - 1;
4938 END LOOP;
4939 RAISE FND_API.G_EXC_ERROR;
4940 END IF;
4941 END IF;
4942
4943 -- Validate the source_object_id_template and source_object_id_instance.
4944 BEGIN
4945 SELECT COMMS_NL_TRACKABLE_FLAG,
4946 concatenated_segments
4947 INTO l_COMMS_NL_TRACKABLE_FLAG,
4948 l_item
4949 FROM mtl_system_items_kfv
4950 WHERE inventory_item_id = p_source_object_id_template
4951 AND organization_id = p_organization_id --cs_std.get_item_valdn_orgzn_id
4952 AND (NVL(COMMS_NL_TRACKABLE_FLAG,'N') = 'Y' or NVL(service_item_flag,'N') = 'Y');
4953 EXCEPTION
4954 WHEN NO_DATA_FOUND THEN
4955 csi_ctr_gen_utility_PVT.ExitWithErrMsg('CSI_API_CTR_INVALID_ITEM','ITEM',l_item);
4956 END;
4957
4958 IF l_COMMS_NL_TRACKABLE_FLAG = 'Y' THEN
4959 l_source_object_cd := 'CP';
4960 ELSE
4961 l_source_object_cd := 'CONTRACT_LINE';
4962 END IF;
4963
4964 /* Check if it is an EAM item to get the maint_organization_id */
4965 BEGIN
4966 SELECT eam_item_type
4967 INTO l_eam_item_type
4968 FROM mtl_system_items_b
4969 WHERE inventory_item_id = p_source_object_id_template
4970 AND organization_id = p_organization_id;
4971 EXCEPTION
4972 WHEN NO_DATA_FOUND THEN
4973 l_eam_item_type := 0;
4974 WHEN TOO_MANY_ROWS THEN
4975 l_eam_item_type := 1;
4976 END;
4977
4978 IF l_eam_item_type = 1 or l_eam_item_type = 3 THEN
4979 BEGIN
4980 SELECT maint_organization_id
4981 INTO l_curr_maint_org_id
4982 FROM mtl_parameters
4983 WHERE organization_id = p_organization_id;
4984 EXCEPTION
4985 WHEN OTHERS THEN
4986 NULL;
4987 END;
4988 END IF;
4989 /* End of checking*/
4993 -- For each counter property, counter belonging to the counter group
4990 csi_ctr_gen_utility_pvt.put_line( ' EAM Item Type = '||to_char(l_eam_item_type));
4991 csi_ctr_gen_utility_pvt.put_line( ' Maint organization id = '||to_char(l_curr_maint_org_id));
4992
4994 -- attched to the source_object_id_template, call Create_Ctr_Prop_Instance,
4995 -- Create_Counter_Instance and Create_Ctr_Grp_Instance.
4996
4997 /*
4998 BEGIN
4999 SELECT counter_id
5000 INTO l_counter_id
5001 FROM csi_ctr_item_associations
5002 WHERE inventory_item_id = p_source_object_id_template;
5003 EXCEPTION
5004 WHEN NO_DATA_FOUND THEN
5005 -- This item does not have any counters. Raise a warning message that
5006 -- no counters were instantiated but do not error out. Return control
5007 -- to the caller.
5008 csi_ctr_gen_utility_PVT.ExitWithErrMsg('CSI_API_CTR_ITEM_HAS_NO_CTRS','ITEM',l_item);
5009 END;
5010 */
5011
5012 FOR item_rec in ctr_item_assoc(p_source_object_id_template)
5013 LOOP
5014 csi_counter_template_pvt.instantiate_counters
5015 (p_api_version => p_api_version
5016 ,p_init_msg_list => p_init_msg_list
5017 ,p_commit => fnd_api.g_false
5018 ,x_return_status => x_return_status
5019 ,x_msg_count => x_msg_count
5020 ,x_msg_data => x_msg_data
5021 ,p_counter_id_template => item_rec.counter_id
5022 ,p_source_object_code_instance => l_source_object_cd
5023 ,p_source_object_id_instance => p_source_object_id_instance
5024 ,x_ctr_id_template => l_ctr_id_template
5025 ,x_ctr_id_instance => l_ctr_id_instance
5026 ,p_maint_org_id => l_curr_maint_org_id
5027 ,p_primary_failure_flag => item_rec.primary_failure_flag
5028 );
5029
5030 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5031 l_msg_index := 1;
5032 l_msg_count := x_msg_count;
5033
5034 WHILE l_msg_count > 0 LOOP
5035 x_msg_data := FND_MSG_PUB.GET
5036 (l_msg_index,
5037 FND_API.G_FALSE );
5038 csi_ctr_gen_utility_pvt.put_line( ' Error from Instantiate_Counters');
5039 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5040 l_msg_index := l_msg_index + 1;
5041 l_msg_count := l_msg_count - 1;
5042 END LOOP;
5043 RAISE FND_API.G_EXC_ERROR;
5044 END IF;
5045 -- if success then pass the counter id template, counter id instance to the table of records for out parameters
5046 l_ctr_template_autoinst_count := l_ctr_template_autoinst_count + 1;
5047 l_ctr_template_autoinst_tbl(l_ctr_template_autoinst_count).counter_id := l_ctr_id_template;
5048
5049 l_counter_autoinst_count := l_counter_autoinst_count + 1;
5050 l_counter_autoinstantiate_tbl(l_counter_autoinst_count).counter_id := l_ctr_id_instance;
5051
5052 --instance created successfully, pass the counter group id template and instance
5053 IF item_rec.associated_to_group = 'Y' then
5054 x_ctr_grp_id_template := item_rec.group_id;
5055 x_ctr_grp_id_instance := item_rec.group_id;
5056 END IF;
5057 END LOOP;
5058
5059 FOR grp_rec in ctr_grp_assoc(p_source_object_id_template)
5060 LOOP
5061 csi_counter_template_pvt.instantiate_grp_counters
5062 (p_api_version => p_api_version
5063 ,p_init_msg_list => p_init_msg_list
5064 ,p_commit => fnd_api.g_false
5065 ,x_return_status => x_return_status
5066 ,x_msg_count => x_msg_count
5067 ,x_msg_data => x_msg_data
5068 ,p_group_id_template => grp_rec.group_id
5069 ,p_source_object_code_instance => l_source_object_cd
5070 ,p_source_object_id_instance => p_source_object_id_instance
5071 ,x_ctr_grp_id_instance => x_ctr_grp_id_instance
5072 ,p_maint_org_id => l_curr_maint_org_id
5073 ,p_primary_failure_flag => grp_rec.primary_failure_flag
5074 );
5075
5076 x_ctr_grp_id_template := grp_rec.group_id;
5077
5078 csi_ctr_gen_utility_pvt.put_line('Old Group id template = '||to_char(x_ctr_grp_id_template));
5079 csi_ctr_gen_utility_pvt.put_line('New Group id template = '||to_char(x_ctr_grp_id_instance));
5080
5081 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5082 l_msg_index := 1;
5083 l_msg_count := x_msg_count;
5084
5085 WHILE l_msg_count > 0 LOOP
5086 x_msg_data := FND_MSG_PUB.GET
5087 (l_msg_index,
5088 FND_API.G_FALSE );
5089 csi_ctr_gen_utility_pvt.put_line( ' Error from Instantiate Group Counters');
5090 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5091 l_msg_index := l_msg_index + 1;
5092 l_msg_count := l_msg_count - 1;
5093 END LOOP;
5094 RAISE FND_API.G_EXC_ERROR;
5095 END IF;
5096 --instance created successfully, pass the counter group id template and instance
5097 END LOOP;
5098
5099 -- Calling Post Customer User Hook
5100 BEGIN
5101 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
5105 p_api_version => p_api_version
5102 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.AutoInstantiate_Counters_Post ..');
5103 CSI_COUNTER_TEMPLATE_CUHK.AutoInstantiate_Counters_Post
5104 (
5106 ,p_init_msg_list => p_init_msg_list
5107 ,p_commit => p_commit
5108 ,x_return_status => x_return_status
5109 ,x_msg_count => x_msg_count
5110 ,x_msg_data => x_msg_data
5111 ,p_source_object_id_template => p_source_object_id_template
5112 ,p_source_object_id_instance => p_source_object_id_instance
5113 ,x_ctr_id_template => l_ctr_template_autoinst_tbl
5114 ,x_ctr_id_instance => l_counter_autoinstantiate_tbl
5115 ,x_ctr_grp_id_template => x_ctr_grp_id_template
5116 ,x_ctr_grp_id_instance => x_ctr_grp_id_instance
5117 ,p_organization_id => p_organization_id
5118 );
5119 --
5120 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5121 l_msg_index := 1;
5122 l_msg_count := x_msg_count;
5123 WHILE l_msg_count > 0 LOOP
5124 x_msg_data := FND_MSG_PUB.GET
5125 ( l_msg_index,
5126 FND_API.G_FALSE );
5127 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.AutoInstantiate_Counters_Post API ');
5128 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5129 l_msg_index := l_msg_index + 1;
5130 l_msg_count := l_msg_count - 1;
5131 END LOOP;
5132 RAISE FND_API.G_EXC_ERROR;
5133 END IF;
5134 --
5135 END IF;
5136 EXCEPTION
5137 WHEN OTHERS THEN
5138 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
5139 RAISE FND_API.G_EXC_ERROR;
5140 END;
5141 --
5142 -- Calling Post Vertical User Hook
5143 BEGIN
5144
5145 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
5146 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.AutoInstantiate_Counters_Post ..');
5147 CSI_COUNTER_TEMPLATE_VUHK.AutoInstantiate_Counters_Post
5148 (
5149 p_api_version => p_api_version
5150 ,p_init_msg_list => p_init_msg_list
5151 ,p_commit => p_commit
5152 ,x_return_status => x_return_status
5153 ,x_msg_count => x_msg_count
5154 ,x_msg_data => x_msg_data
5155 ,p_source_object_id_template => p_source_object_id_template
5156 ,p_source_object_id_instance => p_source_object_id_instance
5157 ,x_ctr_id_template => l_ctr_template_autoinst_tbl
5158 ,x_ctr_id_instance => l_counter_autoinstantiate_tbl
5159 ,x_ctr_grp_id_template => x_ctr_grp_id_template
5160 ,x_ctr_grp_id_instance => x_ctr_grp_id_instance
5161 ,p_organization_id => p_organization_id
5162 );
5163 --
5164 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5165 l_msg_index := 1;
5166 l_msg_count := x_msg_count;
5167 WHILE l_msg_count > 0 LOOP
5168 x_msg_data := FND_MSG_PUB.GET
5169 ( l_msg_index,
5170 FND_API.G_FALSE );
5171 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.AutoInstantiate_Counters_Post API ');
5172 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5173 l_msg_index := l_msg_index + 1;
5174 l_msg_count := l_msg_count - 1;
5175 END LOOP;
5176 RAISE FND_API.G_EXC_ERROR;
5177 END IF;
5178 --
5179 END IF;
5180 EXCEPTION
5181 WHEN OTHERS THEN
5182 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
5183 RAISE FND_API.G_EXC_ERROR;
5184 END;
5185 -- End of POST User Hooks
5186 -- End of API body
5187
5188 -- Standard check of p_commit.
5189 IF FND_API.To_Boolean( p_commit ) THEN
5190 COMMIT WORK;
5191 END IF;
5192
5193 EXCEPTION
5194 WHEN FND_API.G_EXC_ERROR THEN
5195 x_return_status := FND_API.G_RET_STS_ERROR ;
5196 ROLLBACK TO autoinstantiate_counters;
5197 FND_MSG_PUB.Count_And_Get
5198 (p_count => x_msg_count,
5199 p_data => x_msg_data
5200 );
5201
5202 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5203 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
5204 ROLLBACK TO autoinstantiate_counters;
5205 FND_MSG_PUB.Count_And_Get
5206 (p_count => x_msg_count,
5207 p_data => x_msg_data
5208 );
5209
5210 WHEN OTHERS THEN
5211 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
5212 ROLLBACK TO autoinstantiate_counters;
5213 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5214 THEN
5215 FND_MSG_PUB.Add_Exc_Msg
5216 (G_PKG_NAME,
5217 l_api_name
5218 );
5219 END IF;
5220 FND_MSG_PUB.Count_And_Get
5224 END AutoInstantiate_Counters;
5221 (p_count => x_msg_count,
5222 p_data => x_msg_data
5223 );
5225
5226 /*#
5227 * This procedure is used to instantiate counter group and counters
5228 * @param p_api_version Current API Version
5229 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
5230 * @param p_commit API commits if set to fnd_api.g_true
5231 * @param x_return_status API Return Status
5232 * @param x_msg_count Message count
5233 * @param x_msg_data Message Data
5234 * @param p_group_id_template Group id which has to be attached
5235 * @param p_source_object_code_instance Source object code, 'CP' or 'CONTRACT_LINE'
5236 * @param p_source_object_id_instance Source object id to be attached to the counter
5237 * @x_ctr_grp_id_instance The counter group that was created
5238 * @p_maint_org_id The maintaince organization id.
5239 * @p_primary_failure_flag Primary Faliure Flag
5240 * @rep:scope public
5241 * @rep:lifecycle active
5242 * @rep:displayname Instantiate Counter Group
5243 */
5244
5245 PROCEDURE Instantiate_Grp_Counters
5246 (
5247 p_api_version IN NUMBER
5248 ,p_init_msg_list IN VARCHAR2
5249 ,p_commit IN VARCHAR2
5250 ,x_return_status OUT NOCOPY VARCHAR2
5251 ,x_msg_count OUT NOCOPY NUMBER
5252 ,x_msg_data OUT NOCOPY VARCHAR2
5253 ,p_group_id_template IN NUMBER
5254 ,p_source_object_code_instance IN VARCHAR2
5255 ,p_source_object_id_instance IN NUMBER
5256 ,x_ctr_grp_id_instance OUT NOCOPY NUMBER
5257 ,p_maint_org_id IN NUMBER
5258 ,p_primary_failure_flag IN VARCHAR2
5259 )IS
5260
5261 BEGIN
5262 --Call the Istantiate_Grp_Counters which takes care of creating and attaching groups.
5263 CSI_COUNTER_TEMPLATE_PVT.Instantiate_Grp_Counters
5264 (
5265 p_api_version =>p_api_version,
5266 p_init_msg_list =>p_init_msg_list,
5267 p_commit =>p_commit,
5268 x_return_status =>x_return_status,
5269 x_msg_count =>x_msg_count,
5270 x_msg_data =>x_msg_data,
5271 p_group_id_template =>p_group_id_template,
5272 p_source_object_code_instance => p_source_object_code_instance,
5273 p_source_object_id_instance => p_source_object_id_instance,
5274 x_ctr_grp_id_instance => x_ctr_grp_id_instance,
5275 p_maint_org_id=>p_maint_org_id,
5276 p_primary_failure_flag=>p_primary_failure_flag
5277 );
5278
5279
5280 END Instantiate_Grp_Counters;
5281
5282 /*#
5283 * This procedure is used to Instantiate Counters
5284 * @param p_api_version Current API version
5285 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
5286 * @param p_commit API commits if set to fnd_api.g_true
5287 * @param x_return_status API Return Status
5288 * @param x_msg_count Message count
5289 * @param x_msg_data Message Data
5290 * @param p_counter_id_template Counter Id
5291 * @param p_source_object_code_instance A CP or a Service Item
5292 * @param p_source_object_id_instance An instance id or a service line
5293 * @param x_ctr_id_template The counter id
5294 * @param x_ctr_id_instance The new item instance id
5295 * @rep:scope public
5296 * @rep:lifecycle active
5297 * @rep:displayname Instantiate Counters
5298 */
5299
5300 PROCEDURE Instantiate_Counters
5301 (
5302 p_api_version IN NUMBER
5303 ,p_init_msg_list IN VARCHAR2
5304 ,p_commit IN VARCHAR2
5305 ,x_return_status OUT NOCOPY VARCHAR2
5306 ,x_msg_count OUT NOCOPY NUMBER
5307 ,x_msg_data OUT NOCOPY VARCHAR2
5308 ,p_counter_id_template IN NUMBER
5309 ,p_source_object_code_instance IN VARCHAR2
5310 ,p_source_object_id_instance IN NUMBER
5311 ,x_ctr_id_template OUT NOCOPY NUMBER
5312 ,x_ctr_id_instance OUT NOCOPY NUMBER
5313 ) IS
5314
5315 l_api_name CONSTANT VARCHAR2(30) := 'INSTANTIATE_COUNTERS';
5316 l_api_version CONSTANT NUMBER := 1.0;
5317 -- l_debug_level NUMBER;
5318 l_flag VARCHAR2(1) := 'N';
5319 l_msg_data VARCHAR2(2000);
5320 l_msg_index NUMBER;
5321 l_msg_count NUMBER;
5322
5323 l_count NUMBER;
5324 l_return_message VARCHAR2(100);
5325 l_validation_level NUMBER;
5326 l_item NUMBER;
5327 l_COMMS_NL_TRACKABLE_FLAG VARCHAR2(1);
5328 l_ctr_grp_id NUMBER;
5329 BEGIN
5330 -- Standard Start of API savepoint
5331 SAVEPOINT instantiate_counters;
5332
5333 -- Check for freeze_flag in csi_install_parameters is set to 'Y'
5334
5335 -- csi_ctr_gen_utility_pvt.check_ib_active;
5336
5337 -- Standard call to check for call compatibility.
5338 IF NOT FND_API.Compatible_API_Call (l_api_version,
5339 p_api_version,
5340 l_api_name ,
5341 G_PKG_NAME )
5342 THEN
5343 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5344 END IF;
5345
5346 -- Initialize message list if p_init_msg_list is set to TRUE.
5347 IF FND_API.to_Boolean( p_init_msg_list ) THEN
5348 FND_MSG_PUB.initialize;
5349 END IF;
5350
5354 -- Read the debug profiles values in to global variable 7197402
5351 -- Initialize API return status to success
5352 x_return_status := FND_API.G_RET_STS_SUCCESS;
5353
5355 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
5356
5357 -- Check the profile option debug_level for debug message reporting
5358 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
5359
5360 -- If debug_level = 1 then dump the procedure name
5361 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
5362 csi_ctr_gen_utility_pvt.put_line( 'autoinstantiate_counters');
5363 END IF;
5364
5365 -- If the debug level = 2 then dump all the parameters values.
5366 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
5367 csi_ctr_gen_utility_pvt.put_line( 'instantiate_counters' ||
5368 p_api_version ||'-'||
5369 p_commit ||'-'||
5370 p_init_msg_list ||'-'||
5371 l_validation_level );
5372 -- csi_ctr_gen_utility_pvt.dump_instantiate_ctr_rec(p_);
5373 END IF;
5374
5375 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
5376 CSI_COUNTER_TEMPLATE_CUHK.instantiate_counters_pre
5377 (
5378 p_api_version => p_api_version
5379 ,p_init_msg_list => p_init_msg_list
5380 ,p_commit => p_commit
5381 ,x_return_status => x_return_status
5382 ,x_msg_count => x_msg_count
5383 ,x_msg_data => x_msg_data
5384 ,p_counter_id_template => p_counter_id_template
5385 ,p_source_object_code_instance => p_source_object_code_instance
5386 ,p_source_object_id_instance => p_source_object_id_instance
5387 ,x_ctr_id_template => x_ctr_id_template
5388 ,x_ctr_id_instance => x_ctr_id_instance
5389 );
5390 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5391 l_msg_index := 1;
5392 l_msg_count := x_msg_count;
5393 WHILE l_msg_count > 0 LOOP
5394 x_msg_data := FND_MSG_PUB.GET
5395 ( l_msg_index,
5396 FND_API.G_FALSE
5397 );
5398 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.instantiate_counters_pre API ');
5399 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5400 l_msg_index := l_msg_index + 1;
5401 l_msg_count := l_msg_count - 1;
5402 END LOOP;
5403 RAISE FND_API.G_EXC_ERROR;
5404 END IF;
5405 END IF;
5406 --
5407 -- Calling Vertical Pre-processing Hook
5408 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
5409 CSI_COUNTER_TEMPLATE_VUHK.instantiate_counters_pre
5410 (
5411 p_api_version => p_api_version
5412 ,p_init_msg_list => p_init_msg_list
5413 ,p_commit => p_commit
5414 ,x_return_status => x_return_status
5415 ,x_msg_count => x_msg_count
5416 ,x_msg_data => x_msg_data
5417 ,p_counter_id_template => p_counter_id_template
5418 ,p_source_object_code_instance => p_source_object_code_instance
5419 ,p_source_object_id_instance => p_source_object_id_instance
5420 ,x_ctr_id_template => x_ctr_id_template
5421 ,x_ctr_id_instance => x_ctr_id_instance
5422 );
5423 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5424 l_msg_index := 1;
5425 l_msg_count := x_msg_count;
5426 WHILE l_msg_count > 0 LOOP
5427 x_msg_data := FND_MSG_PUB.GET
5428 ( l_msg_index,
5429 FND_API.G_FALSE
5430 );
5431 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.instantiate_counters_pre API ');
5432 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5433 l_msg_index := l_msg_index + 1;
5434 l_msg_count := l_msg_count - 1;
5435 END LOOP;
5436 RAISE FND_API.G_EXC_ERROR;
5437 END IF;
5438 END IF;
5439
5440 csi_counter_template_pvt.instantiate_counters
5441 (
5442 p_api_version => p_api_version
5443 ,p_init_msg_list => p_init_msg_list
5444 ,p_commit => p_commit
5445 ,x_return_status => x_return_status
5446 ,x_msg_count => x_msg_count
5447 ,x_msg_data => x_msg_data
5448 ,p_counter_id_template => p_counter_id_template
5449 ,p_source_object_code_instance => p_source_object_code_instance
5450 ,p_source_object_id_instance => p_source_object_id_instance
5451 ,x_ctr_id_template => x_ctr_id_template
5452 ,x_ctr_id_instance => x_ctr_id_instance
5453 ,p_maint_org_id => NULL
5454 ,p_primary_failure_flag => NULL
5455 );
5456
5457 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5458 l_msg_index := 1;
5459 l_msg_count := x_msg_count;
5460
5461 WHILE l_msg_count > 0 LOOP
5462 x_msg_data := FND_MSG_PUB.GET
5463 (l_msg_index,
5464 FND_API.G_FALSE );
5465 csi_ctr_gen_utility_pvt.put_line( ' Error from CSI_COUNTER_TEMPLATE_PVT.INSTANTIATE_COUNTERS');
5466 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5470 RAISE FND_API.G_EXC_ERROR;
5467 l_msg_index := l_msg_index + 1;
5468 l_msg_count := l_msg_count - 1;
5469 END LOOP;
5471 END IF;
5472
5473 -- Calling Post Customer User Hook
5474 BEGIN
5475 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
5476 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.instantiate_counters_Post ..');
5477 CSI_COUNTER_TEMPLATE_CUHK.instantiate_counters_Post
5478 (
5479 p_api_version => p_api_version
5480 ,p_init_msg_list => p_init_msg_list
5481 ,p_commit => p_commit
5482 ,x_return_status => x_return_status
5483 ,x_msg_count => x_msg_count
5484 ,x_msg_data => x_msg_data
5485 ,p_counter_id_template => p_counter_id_template
5486 ,p_source_object_code_instance => p_source_object_code_instance
5487 ,p_source_object_id_instance => p_source_object_id_instance
5488 ,x_ctr_id_template => x_ctr_id_template
5489 ,x_ctr_id_instance => x_ctr_id_instance
5490 );
5491 --
5492 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5493 l_msg_index := 1;
5494 l_msg_count := x_msg_count;
5495 WHILE l_msg_count > 0 LOOP
5496 x_msg_data := FND_MSG_PUB.GET
5497 ( l_msg_index,
5498 FND_API.G_FALSE );
5499 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.instantiate_counters_Post API ');
5500 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5501 l_msg_index := l_msg_index + 1;
5502 l_msg_count := l_msg_count - 1;
5503 END LOOP;
5504 RAISE FND_API.G_EXC_ERROR;
5505 END IF;
5506 --
5507 END IF;
5508 EXCEPTION
5509 WHEN OTHERS THEN
5510 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
5511 RAISE FND_API.G_EXC_ERROR;
5512 END;
5513
5514 --
5515 -- Calling Post Vertical User Hook
5516 BEGIN
5517
5518 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
5519 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.instantiate_counters_Post ..');
5520 CSI_COUNTER_TEMPLATE_VUHK.instantiate_counters_Post
5521 (
5522 p_api_version => p_api_version
5523 ,p_init_msg_list => p_init_msg_list
5524 ,p_commit => p_commit
5525 ,x_return_status => x_return_status
5526 ,x_msg_count => x_msg_count
5527 ,x_msg_data => x_msg_data
5528 ,p_counter_id_template => p_counter_id_template
5529 ,p_source_object_code_instance => p_source_object_code_instance
5530 ,p_source_object_id_instance => p_source_object_id_instance
5531 ,x_ctr_id_template => x_ctr_id_template
5532 ,x_ctr_id_instance => x_ctr_id_instance
5533 );
5534 --
5535 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5536 l_msg_index := 1;
5537 l_msg_count := x_msg_count;
5538 WHILE l_msg_count > 0 LOOP
5539 x_msg_data := FND_MSG_PUB.GET
5540 ( l_msg_index,
5541 FND_API.G_FALSE );
5542 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.instantiate_counters_Post API ');
5543 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5544 l_msg_index := l_msg_index + 1;
5545 l_msg_count := l_msg_count - 1;
5546 END LOOP;
5547 RAISE FND_API.G_EXC_ERROR;
5548 END IF;
5549 --
5550 END IF;
5551 EXCEPTION
5552 WHEN OTHERS THEN
5553 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
5554 RAISE FND_API.G_EXC_ERROR;
5555 END;
5556 -- End of POST User Hooks
5557 -- End of API body
5558
5559 -- Standard check of p_commit.
5560 IF FND_API.To_Boolean( p_commit ) THEN
5561 COMMIT WORK;
5562 END IF;
5563
5564 EXCEPTION
5565 WHEN FND_API.G_EXC_ERROR THEN
5566 x_return_status := FND_API.G_RET_STS_ERROR ;
5567 ROLLBACK TO instantiate_counters;
5568 FND_MSG_PUB.Count_And_Get
5569 (p_count => x_msg_count,
5570 p_data => x_msg_data
5571 );
5572
5573 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5574 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
5575 ROLLBACK TO instantiate_counters;
5576 FND_MSG_PUB.Count_And_Get
5577 (p_count => x_msg_count,
5578 p_data => x_msg_data
5579 );
5580
5581 WHEN OTHERS THEN
5582 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
5583 ROLLBACK TO instantiate_counters;
5584 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5585 THEN
5586 FND_MSG_PUB.Add_Exc_Msg
5587 (G_PKG_NAME,
5588 l_api_name
5589 );
5590 END IF;
5591 FND_MSG_PUB.Count_And_Get
5595 END Instantiate_Counters;
5592 (p_count => x_msg_count,
5593 p_data => x_msg_data
5594 );
5596
5597 --|---------------------------------------------------
5598 --| procedure name: delete_item_association
5599 --| description : procedure used to
5600 --| delete item association to
5601 --| counter group or counters
5602 --|---------------------------------------------------
5603 /*#
5604 * This procedure is used to delete item associations
5605 * @param p_api_version Current API version
5606 * @param p_commit API commits if set to fnd_api.g_true
5607 * @param p_init_msg_list Initializes the message stack if set to fnd_api.g_true
5608 * @param p_validation_level API validation level
5609 * @param p_ctr_association_id Item Associations Unique ID
5610 * @param x_return_status API Return Status
5611 * @param x_msg_count Message count
5612 * @param x_msg_data Message Data
5613 * @rep:scope public
5614 * @rep:lifecycle active
5615 * @rep:displayname Delete Item Association
5616 */
5617
5618 PROCEDURE delete_item_association
5619 (
5620 p_api_version IN NUMBER
5621 ,p_commit IN VARCHAR2
5622 ,p_init_msg_list IN VARCHAR2
5623 ,p_validation_level IN NUMBER
5624 ,p_ctr_associations_id IN NUMBER
5625 ,x_return_status OUT NOCOPY VARCHAR2
5626 ,x_msg_count OUT NOCOPY NUMBER
5627 ,x_msg_data OUT NOCOPY VARCHAR2
5628 )
5629 IS
5630 l_api_name CONSTANT VARCHAR2(30) := 'DELETE_ITEM_ASSOCIATION';
5631 l_api_version CONSTANT NUMBER := 1.0;
5632 -- l_debug_level NUMBER;
5633 l_flag VARCHAR2(1) := 'N';
5634 l_msg_data VARCHAR2(2000);
5635 l_msg_index NUMBER;
5636 l_msg_count NUMBER;
5637
5638 l_count NUMBER;
5639 l_return_message VARCHAR2(100);
5640
5641 BEGIN
5642 -- Standard Start of API savepoint
5643 SAVEPOINT delete_item_association;
5644
5645 -- Standard call to check for call compatibility.
5646 IF NOT FND_API.Compatible_API_Call (l_api_version,
5647 p_api_version,
5648 l_api_name ,
5649 G_PKG_NAME )
5650 THEN
5651 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
5652 END IF;
5653
5654 -- Initialize message list if p_init_msg_list is set to TRUE.
5655 IF FND_API.to_Boolean( p_init_msg_list ) THEN
5656 FND_MSG_PUB.initialize;
5657 END IF;
5658
5659 -- Initialize API return status to success
5660 x_return_status := FND_API.G_RET_STS_SUCCESS;
5661
5662 -- Read the debug profiles values in to global variable 7197402
5663 CSI_CTR_GEN_UTILITY_PVT.read_debug_profiles;
5664
5665 -- Check the profile option debug_level for debug message reporting
5666 -- l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
5667
5668 -- If debug_level = 1 then dump the procedure name
5669 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 0) THEN
5670 csi_ctr_gen_utility_pvt.put_line( 'delete_item_association');
5671 END IF;
5672
5673 -- If the debug level = 2 then dump all the parameters values.
5674 IF (CSI_CTR_GEN_UTILITY_PVT.g_debug_level > 1) THEN
5675 csi_ctr_gen_utility_pvt.put_line('delete_item_association' ||
5676 p_api_version ||'-'||
5677 p_commit ||'-'||
5678 p_init_msg_list ||'-'||
5679 p_validation_level );
5680 END IF;
5681
5682 -- Calling Customer Pre-processing Hook
5683 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'C' )) then
5684 CSI_COUNTER_TEMPLATE_CUHK.DELETE_ITEM_ASSOCIATION_PRE
5685 (
5686 p_api_version => p_api_version
5687 ,p_commit => p_commit
5688 ,p_init_msg_list => p_init_msg_list
5689 ,p_validation_level => p_validation_level
5690 ,p_ctr_associations_id => p_ctr_associations_id
5691 ,x_return_status => x_return_status
5692 ,x_msg_count => x_msg_count
5693 ,x_msg_data => x_msg_data
5694 );
5695 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5696 l_msg_index := 1;
5697 l_msg_count := x_msg_count;
5698 WHILE l_msg_count > 0 LOOP
5699 x_msg_data := FND_MSG_PUB.GET
5700 ( l_msg_index,
5701 FND_API.G_FALSE
5702 );
5703 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.DELETE_ITEM_ASSOCIATION_PRE API ');
5704 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5705 l_msg_index := l_msg_index + 1;
5706 l_msg_count := l_msg_count - 1;
5707 END LOOP;
5708 RAISE FND_API.G_EXC_ERROR;
5709 END IF;
5710 END IF;
5711 --
5712 -- Calling Vertical Pre-processing Hook
5713 IF ( JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'B', 'V' )) then
5714 CSI_COUNTER_TEMPLATE_VUHK.DELETE_ITEM_ASSOCIATION_PRE
5718 ,p_init_msg_list => p_init_msg_list
5715 (
5716 p_api_version => p_api_version
5717 ,p_commit => p_commit
5719 ,p_validation_level => p_validation_level
5720 ,p_ctr_associations_id => p_ctr_associations_id
5721 ,x_return_status => x_return_status
5722 ,x_msg_count => x_msg_count
5723 ,x_msg_data => x_msg_data
5724 );
5725 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5726 l_msg_index := 1;
5727 l_msg_count := x_msg_count;
5728 WHILE l_msg_count > 0 LOOP
5729 x_msg_data := FND_MSG_PUB.GET
5730 ( l_msg_index,
5731 FND_API.G_FALSE
5732 );
5733 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.DELETE_ITEM_ASSOCIATION_PRE API ');
5734 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5735 l_msg_index := l_msg_index + 1;
5736 l_msg_count := l_msg_count - 1;
5737 END LOOP;
5738 RAISE FND_API.G_EXC_ERROR;
5739 END IF;
5740 END IF;
5741
5742 csi_counter_template_pvt.delete_item_association
5743 (
5744 p_api_version => p_api_version
5745 ,p_commit => fnd_api.g_false
5746 ,p_init_msg_list => p_init_msg_list
5747 ,p_validation_level => p_validation_level
5748 ,p_ctr_associations_id => p_ctr_associations_id
5749 ,x_return_status => x_return_status
5750 ,x_msg_count => x_msg_count
5751 ,x_msg_data => x_msg_data
5752 );
5753
5754 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5755 l_msg_index := 1;
5756 l_msg_count := x_msg_count;
5757
5758 WHILE l_msg_count > 0 LOOP
5759 x_msg_data := FND_MSG_PUB.GET
5760 (l_msg_index,
5761 FND_API.G_FALSE );
5762 csi_ctr_gen_utility_pvt.put_line(' Error from CSI_COUNTER_TEMPLATE_PVT.DELETE_ITEM_ASSOCIATION');
5763 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5764 l_msg_index := l_msg_index + 1;
5765 l_msg_count := l_msg_count - 1;
5766 END LOOP;
5767 RAISE FND_API.G_EXC_ERROR;
5768 END IF;
5769
5770 -- Calling Post Customer User Hook
5771 BEGIN
5772 IF JTF_USR_HKS.Ok_to_execute(G_PKG_NAME, l_api_name, 'A', 'C' ) THEN
5773 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_CUHK.DELETE_ITEM_ASSOCIATION_Post ..');
5774 CSI_COUNTER_TEMPLATE_CUHK.DELETE_ITEM_ASSOCIATION_Post
5775 (
5776 p_api_version => 1.0
5777 ,p_commit => fnd_api.g_false
5778 ,p_init_msg_list => fnd_api.g_false
5779 ,p_validation_level => fnd_api.g_valid_level_full
5780 ,p_ctr_associations_id => p_ctr_associations_id
5781 ,x_return_status => x_return_status
5782 ,x_msg_count => x_msg_count
5783 ,x_msg_data => x_msg_data
5784 );
5785 --
5786 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5787 l_msg_index := 1;
5788 l_msg_count := x_msg_count;
5789 WHILE l_msg_count > 0 LOOP
5790 x_msg_data := FND_MSG_PUB.GET
5791 ( l_msg_index,
5792 FND_API.G_FALSE );
5793 csi_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_CUHK.DELETE_ITEM_ASSOCIATION_Post API ');
5794 csi_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5795 l_msg_index := l_msg_index + 1;
5796 l_msg_count := l_msg_count - 1;
5797 END LOOP;
5798 RAISE FND_API.G_EXC_ERROR;
5799 END IF;
5800 --
5801 END IF;
5802 EXCEPTION
5803 WHEN OTHERS THEN
5804 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Customer');
5805 RAISE FND_API.G_EXC_ERROR;
5806 END;
5807 --
5808 -- Calling Post Vertical User Hook
5809 BEGIN
5810
5811 IF JTF_USR_HKS.Ok_to_execute( G_PKG_NAME, l_api_name, 'A', 'V' ) THEN
5812 csi_ctr_gen_utility_pvt.put_line('Calling CSI_COUNTER_TEMPLATE_VUHK.DELTE_ITEM_ASSOCIATION_Post ..');
5813 CSI_COUNTER_TEMPLATE_VUHK.DELETE_ITEM_ASSOCIATION_Post
5814 (
5815 p_api_version => 1.0
5816 ,p_commit => fnd_api.g_false
5817 ,p_init_msg_list => fnd_api.g_false
5818 ,p_validation_level => fnd_api.g_valid_level_full
5819 ,p_ctr_associations_id => p_ctr_associations_id
5820 ,x_return_status => x_return_status
5821 ,x_msg_count => x_msg_count
5822 ,x_msg_data => x_msg_data
5823 );
5824 --
5825 IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
5826 l_msg_index := 1;
5827 l_msg_count := x_msg_count;
5828 WHILE l_msg_count > 0 LOOP
5829 x_msg_data := FND_MSG_PUB.GET
5830 ( l_msg_index,
5831 FND_API.G_FALSE );
5832 csi_ctr_gen_utility_pvt.put_line('ERROR FROM CSI_COUNTER_TEMPLATE_VUHK.DELETE_ITEM_ASSOCIATION_Post API ');
5833 csi_ctr_gen_utility_pvt.put_line('MESSAGE DATA = '||x_msg_data);
5834 l_msg_index := l_msg_index + 1;
5835 l_msg_count := l_msg_count - 1;
5836 END LOOP;
5837 RAISE FND_API.G_EXC_ERROR;
5838 END IF;
5839 --
5840 END IF;
5841 EXCEPTION
5842 WHEN OTHERS THEN
5843 csi_ctr_gen_utility_pvt.put_line('ERROR FROM JTF_USR_HKS.Ok_to_execute API Create Post Vertical');
5844 RAISE FND_API.G_EXC_ERROR;
5845 END;
5846 -- End of POST User Hooks
5847
5848 -- End of API body
5849
5850 -- Standard check of p_commit.
5851 IF FND_API.To_Boolean( p_commit ) THEN
5852 COMMIT WORK;
5853 END IF;
5854
5855 EXCEPTION
5856 WHEN FND_API.G_EXC_ERROR THEN
5857 x_return_status := FND_API.G_RET_STS_ERROR ;
5858 ROLLBACK TO delete_item_association;
5859 FND_MSG_PUB.Count_And_Get
5860 (p_count => x_msg_count,
5861 p_data => x_msg_data
5862 );
5863
5864 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
5865 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
5866 ROLLBACK TO delete_item_association;
5867 FND_MSG_PUB.Count_And_Get
5868 (p_count => x_msg_count,
5869 p_data => x_msg_data
5870 );
5871 WHEN OTHERS THEN
5872 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
5873 ROLLBACK TO delete_item_association;
5874 IF FND_MSG_PUB.Check_Msg_Level (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
5875 THEN
5876 FND_MSG_PUB.Add_Exc_Msg
5877 (G_PKG_NAME,
5878 l_api_name
5879 );
5880 END IF;
5881 FND_MSG_PUB.Count_And_Get
5882 (p_count => x_msg_count,
5883 p_data => x_msg_data
5884 );
5885
5886 END delete_item_association;
5887
5888 END CSI_COUNTER_TEMPLATE_PUB;