46: csi_utility_grp.check_ib_active;
47:
48:
49: -- Standard call to check for call compatibility.
50: IF NOT FND_API.Compatible_API_Call (l_api_version,
51: p_api_version,
52: l_api_name,
53: g_pkg_name)
54: THEN
51: p_api_version,
52: l_api_name,
53: g_pkg_name)
54: THEN
55: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
56: END IF;
57:
58:
59: -- Initialize message list if p_init_msg_list is set to TRUE.
56: END IF;
57:
58:
59: -- Initialize message list if p_init_msg_list is set to TRUE.
60: IF FND_API.to_Boolean( p_init_msg_list ) THEN
61: FND_MSG_PUB.initialize;
62: END IF;
63:
64: -- Initialize API return status to success
61: FND_MSG_PUB.initialize;
62: END IF;
63:
64: -- Initialize API return status to success
65: x_return_status := FND_API.G_RET_STS_SUCCESS;
66:
67: -- Check the profile option debug_level for debug message reporting
68: l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
69:
91:
92:
93: -- Start API body
94: -- Check if at least one query parameters are passed
95: IF ( p_ou_query_rec.instance_ou_id = FND_API.G_MISS_NUM)
96: AND ( p_ou_query_rec.instance_id = FND_API.G_MISS_NUM)
97: AND ( p_ou_query_rec.operating_unit_id = FND_API.G_MISS_NUM)
98: AND ( p_ou_query_rec.relationship_type_code = FND_API.G_MISS_CHAR) THEN
99:
92:
93: -- Start API body
94: -- Check if at least one query parameters are passed
95: IF ( p_ou_query_rec.instance_ou_id = FND_API.G_MISS_NUM)
96: AND ( p_ou_query_rec.instance_id = FND_API.G_MISS_NUM)
97: AND ( p_ou_query_rec.operating_unit_id = FND_API.G_MISS_NUM)
98: AND ( p_ou_query_rec.relationship_type_code = FND_API.G_MISS_CHAR) THEN
99:
100: FND_MESSAGE.Set_Name('CSI', 'CSI_API_INVALID_PARAMETERS');
93: -- Start API body
94: -- Check if at least one query parameters are passed
95: IF ( p_ou_query_rec.instance_ou_id = FND_API.G_MISS_NUM)
96: AND ( p_ou_query_rec.instance_id = FND_API.G_MISS_NUM)
97: AND ( p_ou_query_rec.operating_unit_id = FND_API.G_MISS_NUM)
98: AND ( p_ou_query_rec.relationship_type_code = FND_API.G_MISS_CHAR) THEN
99:
100: FND_MESSAGE.Set_Name('CSI', 'CSI_API_INVALID_PARAMETERS');
101: FND_MSG_PUB.ADD;
94: -- Check if at least one query parameters are passed
95: IF ( p_ou_query_rec.instance_ou_id = FND_API.G_MISS_NUM)
96: AND ( p_ou_query_rec.instance_id = FND_API.G_MISS_NUM)
97: AND ( p_ou_query_rec.operating_unit_id = FND_API.G_MISS_NUM)
98: AND ( p_ou_query_rec.relationship_type_code = FND_API.G_MISS_CHAR) THEN
99:
100: FND_MESSAGE.Set_Name('CSI', 'CSI_API_INVALID_PARAMETERS');
101: FND_MSG_PUB.ADD;
102: RAISE FND_API.G_EXC_ERROR;
98: AND ( p_ou_query_rec.relationship_type_code = FND_API.G_MISS_CHAR) THEN
99:
100: FND_MESSAGE.Set_Name('CSI', 'CSI_API_INVALID_PARAMETERS');
101: FND_MSG_PUB.ADD;
102: RAISE FND_API.G_EXC_ERROR;
103: END IF;
104:
105:
106: -- Generate the where clause
142:
143: -- Close the cursor
144: DBMS_SQL.CLOSE_CURSOR(l_cur_get_ou);
145:
146: IF (p_time_stamp IS NOT NULL) AND (p_time_stamp <> FND_API.G_MISS_DATE) THEN
147: IF p_time_stamp <= sysdate THEN
148: csi_organization_unit_pvt.Construct_ou_From_Hist(x_org_unit_tbl, p_time_stamp);
149: ELSE
150: FND_MESSAGE.Set_Name('CSI', 'CSI_API_INVALID_HIST_PARAMS');
148: csi_organization_unit_pvt.Construct_ou_From_Hist(x_org_unit_tbl, p_time_stamp);
149: ELSE
150: FND_MESSAGE.Set_Name('CSI', 'CSI_API_INVALID_HIST_PARAMS');
151: FND_MSG_PUB.ADD;
152: RAISE FND_API.G_EXC_ERROR;
153: END IF;
154: END IF;
155:
156: -- Resolve the foreign key columns if p_resolve_id_columns is true
153: END IF;
154: END IF;
155:
156: -- Resolve the foreign key columns if p_resolve_id_columns is true
157: IF p_resolve_id_columns = fnd_api.g_true THEN
158: IF x_org_unit_tbl.count > 0 THEN
159: l_org_unit_tbl := x_org_unit_tbl;
160: csi_organization_unit_pvt.Resolve_id_columns(l_org_unit_tbl);
161:
166: -- End of API body
167:
168: -- Standard check of p_commit.
169: /*
170: IF FND_API.To_Boolean( p_commit ) THEN
171: COMMIT WORK;
172: END IF;
173: */
174:
188:
189:
190: EXCEPTION
191:
192: WHEN FND_API.G_EXC_ERROR THEN
193: -- ROLLBACK TO get_organization_unit;
194: x_return_status := FND_API.G_RET_STS_ERROR ;
195: FND_MSG_PUB.Count_And_Get
196: ( p_count => x_msg_count,
190: EXCEPTION
191:
192: WHEN FND_API.G_EXC_ERROR THEN
193: -- ROLLBACK TO get_organization_unit;
194: x_return_status := FND_API.G_RET_STS_ERROR ;
195: FND_MSG_PUB.Count_And_Get
196: ( p_count => x_msg_count,
197: p_data => x_msg_data
198: );
196: ( p_count => x_msg_count,
197: p_data => x_msg_data
198: );
199:
200: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
201: -- ROLLBACK TO get_organization_unit;
202: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
203: FND_MSG_PUB.Count_And_Get
204: ( p_count => x_msg_count,
198: );
199:
200: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
201: -- ROLLBACK TO get_organization_unit;
202: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
203: FND_MSG_PUB.Count_And_Get
204: ( p_count => x_msg_count,
205: p_data => x_msg_data
206: );
209: IF DBMS_SQL.IS_OPEN(l_cur_get_ou) THEN
210: DBMS_SQL.CLOSE_CURSOR(l_cur_get_ou);
211: END IF;
212: -- ROLLBACK TO get_organization_unit;
213: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
214:
215: IF FND_MSG_PUB.Check_Msg_Level
216: (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
217: THEN
271: csi_utility_grp.check_ib_active;
272:
273:
274: -- Standard call to check for call compatibility.
275: IF NOT FND_API.Compatible_API_Call (l_api_version,
276: p_api_version,
277: l_api_name ,
278: g_pkg_name)
279: THEN
276: p_api_version,
277: l_api_name ,
278: g_pkg_name)
279: THEN
280: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
281: END IF;
282:
283:
284: -- Initialize message list if p_init_msg_list is set to TRUE.
281: END IF;
282:
283:
284: -- Initialize message list if p_init_msg_list is set to TRUE.
285: IF FND_API.to_Boolean( p_init_msg_list ) THEN
286: FND_MSG_PUB.initialize;
287: END IF;
288:
289:
287: END IF;
288:
289:
290: -- Initialize API return status to success
291: x_return_status := FND_API.G_RET_STS_SUCCESS;
292:
293:
294: -- Check the profile option debug_level for debug message reporting
295: l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
326: LOOP
327: IF p_org_unit_tbl.EXISTS(tab_row) THEN
328: csi_organization_unit_pvt.create_organization_unit
329: ( p_api_version => p_api_version
330: ,p_commit => fnd_api.g_false
331: ,p_init_msg_list => p_init_msg_list
332: ,p_validation_level => p_validation_level
333: ,p_org_unit_rec => p_org_unit_tbl(tab_row)
334: ,p_txn_rec => p_txn_rec
339: ,p_ou_count_rec => l_ou_count_rec
340: ,p_ou_id_tbl => l_ou_id_tbl
341: );
342:
343: IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
344: l_msg_index := 1;
345: l_msg_count := x_msg_count;
346: WHILE l_msg_count > 0 LOOP
347: x_msg_data := FND_MSG_PUB.GET
345: l_msg_count := x_msg_count;
346: WHILE l_msg_count > 0 LOOP
347: x_msg_data := FND_MSG_PUB.GET
348: ( l_msg_index,
349: FND_API.G_FALSE );
350:
351: csi_gen_utility_pvt.put_line( ' Failed Pub:create_organization_unit..');
352: csi_gen_utility_pvt.put_line('message data = '||x_msg_data);
353: l_msg_index := l_msg_index + 1;
352: csi_gen_utility_pvt.put_line('message data = '||x_msg_data);
353: l_msg_index := l_msg_index + 1;
354: l_msg_count := l_msg_count - 1;
355: END LOOP;
356: RAISE FND_API.G_EXC_ERROR;
357: END IF;
358:
359:
360: END IF;
364: -- End of API body
365:
366:
367: -- Standard check of p_commit.
368: IF FND_API.To_Boolean( p_commit ) THEN
369: COMMIT WORK;
370: END IF;
371:
372: /***** srramakr commented for bug # 3304439
385:
386:
387: EXCEPTION
388:
389: WHEN FND_API.G_EXC_ERROR THEN
390: ROLLBACK TO create_organization_unit;
391: x_return_status := FND_API.G_RET_STS_ERROR ;
392: FND_MSG_PUB.Count_And_Get
393: ( p_count => x_msg_count,
387: EXCEPTION
388:
389: WHEN FND_API.G_EXC_ERROR THEN
390: ROLLBACK TO create_organization_unit;
391: x_return_status := FND_API.G_RET_STS_ERROR ;
392: FND_MSG_PUB.Count_And_Get
393: ( p_count => x_msg_count,
394: p_data => x_msg_data
395: );
393: ( p_count => x_msg_count,
394: p_data => x_msg_data
395: );
396:
397: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
398: ROLLBACK TO create_organization_unit;
399: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
400: FND_MSG_PUB.Count_And_Get
401: ( p_count => x_msg_count,
395: );
396:
397: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
398: ROLLBACK TO create_organization_unit;
399: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
400: FND_MSG_PUB.Count_And_Get
401: ( p_count => x_msg_count,
402: p_data => x_msg_data
403: );
403: );
404:
405: WHEN OTHERS THEN
406: ROLLBACK TO create_organization_unit;
407: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
408:
409: IF FND_MSG_PUB.Check_Msg_Level
410: (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
411: THEN
465: csi_utility_grp.check_ib_active;
466:
467:
468: -- Standard call to check for call compatibility.
469: IF NOT FND_API.Compatible_API_Call (l_api_version,
470: p_api_version,
471: l_api_name ,
472: g_pkg_name)
473: THEN
470: p_api_version,
471: l_api_name ,
472: g_pkg_name)
473: THEN
474: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
475: END IF;
476:
477:
478: -- Initialize message list if p_init_msg_list is set to TRUE.
475: END IF;
476:
477:
478: -- Initialize message list if p_init_msg_list is set to TRUE.
479: IF FND_API.to_Boolean( p_init_msg_list ) THEN
480: FND_MSG_PUB.initialize;
481: END IF;
482:
483:
481: END IF;
482:
483:
484: -- Initialize API return status to success
485: x_return_status := FND_API.G_RET_STS_SUCCESS;
486:
487:
488: -- Check the profile option debug_level for debug message reporting
489: l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
518: LOOP
519: IF p_org_unit_tbl.EXISTS(tab_row) THEN
520: csi_organization_unit_pvt.update_organization_unit
521: ( p_api_version => p_api_version
522: ,p_commit => fnd_api.g_false
523: ,p_init_msg_list => p_init_msg_list
524: ,p_validation_level => p_validation_level
525: ,p_org_unit_rec => p_org_unit_tbl(tab_row)
526: ,p_txn_rec => p_txn_rec
531: ,p_ou_count_rec => l_ou_count_rec
532: ,p_ou_id_tbl => l_ou_id_tbl
533: );
534:
535: IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
536: l_msg_index := 1;
537: l_msg_count := x_msg_count;
538: WHILE l_msg_count > 0 LOOP
539: x_msg_data := FND_MSG_PUB.GET
537: l_msg_count := x_msg_count;
538: WHILE l_msg_count > 0 LOOP
539: x_msg_data := FND_MSG_PUB.GET
540: ( l_msg_index,
541: FND_API.G_FALSE );
542:
543: csi_gen_utility_pvt.put_line( ' Failed Pub:update_organization_unit..');
544: csi_gen_utility_pvt.put_line('message data = '||x_msg_data);
545: l_msg_index := l_msg_index + 1;
544: csi_gen_utility_pvt.put_line('message data = '||x_msg_data);
545: l_msg_index := l_msg_index + 1;
546: l_msg_count := l_msg_count - 1;
547: END LOOP;
548: RAISE FND_API.G_EXC_ERROR;
549: END IF;
550:
551: END IF;
552: END LOOP;
554:
555: -- End of API body
556:
557: -- Standard check of p_commit.
558: IF FND_API.To_Boolean( p_commit ) THEN
559: COMMIT WORK;
560: END IF;
561:
562: /***** srramakr commented for bug # 3304439
575:
576:
577: EXCEPTION
578:
579: WHEN FND_API.G_EXC_ERROR THEN
580: ROLLBACK TO update_organization_unit;
581: x_return_status := FND_API.G_RET_STS_ERROR ;
582: FND_MSG_PUB.Count_And_Get
583: ( p_count => x_msg_count,
577: EXCEPTION
578:
579: WHEN FND_API.G_EXC_ERROR THEN
580: ROLLBACK TO update_organization_unit;
581: x_return_status := FND_API.G_RET_STS_ERROR ;
582: FND_MSG_PUB.Count_And_Get
583: ( p_count => x_msg_count,
584: p_data => x_msg_data
585: );
583: ( p_count => x_msg_count,
584: p_data => x_msg_data
585: );
586:
587: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
588: ROLLBACK TO update_organization_unit;
589: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
590: FND_MSG_PUB.Count_And_Get
591: ( p_count => x_msg_count,
585: );
586:
587: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
588: ROLLBACK TO update_organization_unit;
589: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
590: FND_MSG_PUB.Count_And_Get
591: ( p_count => x_msg_count,
592: p_data => x_msg_data
593: );
593: );
594:
595: WHEN OTHERS THEN
596: ROLLBACK TO update_organization_unit;
597: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
598:
599: IF FND_MSG_PUB.Check_Msg_Level
600: (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
601: THEN
649: csi_utility_grp.check_ib_active;
650:
651:
652: -- Standard call to check for call compatibility.
653: IF NOT FND_API.Compatible_API_Call (l_api_version,
654: p_api_version,
655: l_api_name ,
656: g_pkg_name)
657: THEN
654: p_api_version,
655: l_api_name ,
656: g_pkg_name)
657: THEN
658: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
659: END IF;
660:
661:
662: -- Initialize message list if p_init_msg_list is set to TRUE.
659: END IF;
660:
661:
662: -- Initialize message list if p_init_msg_list is set to TRUE.
663: IF FND_API.to_Boolean( p_init_msg_list ) THEN
664: FND_MSG_PUB.initialize;
665: END IF;
666:
667:
665: END IF;
666:
667:
668: -- Initialize API return status to success
669: x_return_status := FND_API.G_RET_STS_SUCCESS;
670:
671:
672: -- Check the profile option debug_level for debug message reporting
673: l_debug_level:=fnd_profile.value('CSI_DEBUG_LEVEL');
701: LOOP
702: IF p_org_unit_tbl.EXISTS(tab_row) THEN
703: csi_organization_unit_pvt.expire_organization_unit
704: ( p_api_version => p_api_version
705: ,p_commit => fnd_api.g_false
706: ,p_init_msg_list => p_init_msg_list
707: ,p_validation_level => p_validation_level
708: ,p_org_unit_rec => p_org_unit_tbl(tab_row)
709: ,p_txn_rec => p_txn_rec
711: ,x_msg_count => x_msg_count
712: ,x_msg_data => x_msg_data
713: );
714:
715: IF NOT(x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
716: l_msg_index := 1;
717: l_msg_count := x_msg_count;
718: WHILE l_msg_count > 0 LOOP
719: x_msg_data := FND_MSG_PUB.GET
717: l_msg_count := x_msg_count;
718: WHILE l_msg_count > 0 LOOP
719: x_msg_data := FND_MSG_PUB.GET
720: ( l_msg_index,
721: FND_API.G_FALSE );
722:
723: csi_gen_utility_pvt.put_line( ' Failed Pub:expire_organization_unit..');
724: csi_gen_utility_pvt.put_line('message data = '||x_msg_data);
725: l_msg_index := l_msg_index + 1;
724: csi_gen_utility_pvt.put_line('message data = '||x_msg_data);
725: l_msg_index := l_msg_index + 1;
726: l_msg_count := l_msg_count - 1;
727: END LOOP;
728: RAISE FND_API.G_EXC_ERROR;
729: END IF;
730: END IF;
731: END LOOP;
732: END IF;
736:
737:
738:
739: -- Standard check of p_commit.
740: IF FND_API.To_Boolean( p_commit ) THEN
741: COMMIT WORK;
742: END IF;
743:
744: /***** srramakr commented for bug # 3304439
757:
758:
759: EXCEPTION
760:
761: WHEN FND_API.G_EXC_ERROR THEN
762: ROLLBACK TO expire_organization_unit;
763: x_return_status := FND_API.G_RET_STS_ERROR ;
764: FND_MSG_PUB.Count_And_Get
765: ( p_count => x_msg_count,
759: EXCEPTION
760:
761: WHEN FND_API.G_EXC_ERROR THEN
762: ROLLBACK TO expire_organization_unit;
763: x_return_status := FND_API.G_RET_STS_ERROR ;
764: FND_MSG_PUB.Count_And_Get
765: ( p_count => x_msg_count,
766: p_data => x_msg_data
767: );
765: ( p_count => x_msg_count,
766: p_data => x_msg_data
767: );
768:
769: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
770: ROLLBACK TO expire_organization_unit;
771: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
772: FND_MSG_PUB.Count_And_Get
773: ( p_count => x_msg_count,
767: );
768:
769: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
770: ROLLBACK TO expire_organization_unit;
771: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
772: FND_MSG_PUB.Count_And_Get
773: ( p_count => x_msg_count,
774: p_data => x_msg_data
775: );
775: );
776:
777: WHEN OTHERS THEN
778: ROLLBACK TO expire_organization_unit;
779: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
780:
781: IF FND_MSG_PUB.Check_Msg_Level
782: (FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
783: THEN