51:
52:
53: IF NOT bis_collection_utilities.setup(l_object_name) THEN
54: bis_collection_utilities.log('Object BIM_SGMT_ACT Not Setup Properly');
55: RAISE FND_API.G_EXC_ERROR;
56: END IF;
57:
58: bis_collection_utilities.log('Start of the Segment Activity Facts Program');
59:
57:
58: bis_collection_utilities.log('Start of the Segment Activity Facts Program');
59:
60: -- Standard call to check for call compatibility.
61: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
62: p_api_version_number,
63: l_api_name,
64: g_pkg_name) THEN
65:
62: p_api_version_number,
63: l_api_name,
64: g_pkg_name) THEN
65:
66: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
67:
68: END IF;
69:
70: -- Initialize message list if p_init_msg_list is set to TRUE.
67:
68: END IF;
69:
70: -- Initialize message list if p_init_msg_list is set to TRUE.
71: IF FND_API.to_Boolean( p_init_msg_list )
72: THEN
73: FND_MSG_PUB.initialize;
74: END IF;
75:
76: l_global_date:= bis_common_parameters.get_global_start_date;
77:
78: -- Initialize API return status to SUCCESS
79:
80: x_return_status := FND_API.G_RET_STS_SUCCESS;
81:
82: --Get last Refresh dates of the program
83:
84: bis_collection_utilities.get_last_refresh_dates(l_object_name,
107:
108: IF (p_start_date IS NULL) THEN
109: --i.e the user initiated incremental program request. raise exception and exit
110: bis_collection_utilities.log('Please run the Update Segment Activity Base Summary - Initial Load Concurrent Program before running this');
111: RAISE FND_API.G_EXC_ERROR;
112: END IF;
113:
114: --- Validate Time Dimension Tables
115: fii_time_api.check_missing_date (GREATEST(l_global_date,p_start_date), SYSDATE, l_missing_date);
115: fii_time_api.check_missing_date (GREATEST(l_global_date,p_start_date), SYSDATE, l_missing_date);
116:
117: IF (l_missing_date) THEN
118: bis_collection_utilities.log('Time Dimension has atleast one missing date between ' || greatest(l_global_date,p_start_date) || ' and ' || sysdate);
119: RAISE FND_API.G_EXC_ERROR;
120: END IF;
121:
122: l_load_type := 'FIRST_LOAD';
123:
127:
128: FIRST_LOAD(p_start_date => greatest(l_global_date,p_start_date)
129: ,p_end_date => l_sysdate
130: ,p_api_version_number => l_api_version_number
131: ,p_init_msg_list => FND_API.G_FALSE
132: ,x_msg_count => x_msg_count
133: ,x_msg_data => x_msg_data
134: ,x_return_status => x_return_status
135: );
144:
145: FIRST_LOAD(p_start_date => greatest(l_global_date,p_start_date)
146: ,p_end_date => l_sysdate
147: ,p_api_version_number => l_api_version_number
148: ,p_init_msg_list => FND_API.G_FALSE
149: ,x_msg_count => x_msg_count
150: ,x_msg_data => x_msg_data
151: ,x_return_status => x_return_status
152: );
160: IF (l_missing_date) THEN
161:
162: --Check it from the year start Date of the Year Passed as used in Active Customer Count
163: bis_collection_utilities.log('Time Dimension has atleast one missing date between ' || l_end_date || ' and ' || sysdate);
164: RAISE FND_API.G_EXC_ERROR;
165:
166: END IF;
167:
168: l_load_type := 'SUBSEQUENT_LOAD';
171:
172: INCREMENTAL_LOAD(p_start_date => l_end_date +1/86400 -- add one second
173: ,p_end_date => l_sysdate
174: ,p_api_version_number => l_api_version_number
175: ,p_init_msg_list => FND_API.G_FALSE
176: ,x_msg_count => x_msg_count
177: ,x_msg_data => x_msg_data
178: ,x_return_status => x_return_status
179: );
182: END IF;
183:
184: ---If Incremental/Inital Load Executes Sucessfully, then call the Load_Schedule_Data Procedure
185:
186: IF x_return_status = FND_API.g_ret_sts_error THEN
187:
188: RAISE FND_API.g_exc_error;
189:
190: ELSIF x_return_status = FND_API.g_ret_sts_unexp_error THEN
184: ---If Incremental/Inital Load Executes Sucessfully, then call the Load_Schedule_Data Procedure
185:
186: IF x_return_status = FND_API.g_ret_sts_error THEN
187:
188: RAISE FND_API.g_exc_error;
189:
190: ELSIF x_return_status = FND_API.g_ret_sts_unexp_error THEN
191:
192: RAISE FND_API.g_exc_unexpected_error;
186: IF x_return_status = FND_API.g_ret_sts_error THEN
187:
188: RAISE FND_API.g_exc_error;
189:
190: ELSIF x_return_status = FND_API.g_ret_sts_unexp_error THEN
191:
192: RAISE FND_API.g_exc_unexpected_error;
193:
194: END IF;
188: RAISE FND_API.g_exc_error;
189:
190: ELSIF x_return_status = FND_API.g_ret_sts_unexp_error THEN
191:
192: RAISE FND_API.g_exc_unexpected_error;
193:
194: END IF;
195:
196: --Standard check of commit
194: END IF;
195:
196: --Standard check of commit
197:
198: IF FND_API.To_Boolean ( p_commit ) THEN
199:
200: COMMIT WORK;
201:
202: END IF;
210: );
211:
212: EXCEPTION
213:
214: WHEN FND_API.G_EXC_ERROR THEN
215:
216: x_return_status := FND_API.G_RET_STS_ERROR;
217: -- Standard call to get message count and if count=1, get the message
218: FND_msg_PUB.Count_And_Get (
212: EXCEPTION
213:
214: WHEN FND_API.G_EXC_ERROR THEN
215:
216: x_return_status := FND_API.G_RET_STS_ERROR;
217: -- Standard call to get message count and if count=1, get the message
218: FND_msg_PUB.Count_And_Get (
219: p_count => x_msg_count,
220: p_data => x_msg_data
220: p_data => x_msg_data
221: );
222:
223:
224: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
225:
226: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
227: -- Standard call to get message count and if count=1, get the message
228: FND_msg_PUB.Count_And_Get (
222:
223:
224: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
225:
226: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
227: -- Standard call to get message count and if count=1, get the message
228: FND_msg_PUB.Count_And_Get (
229: p_count => x_msg_count,
230: p_data => x_msg_data
230: p_data => x_msg_data
231: );
232:
233: WHEN OTHERS THEN
234: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
235: IF FND_msg_PUB.Check_msg_Level ( FND_msg_PUB.G_msg_LVL_UNEXP_ERROR)
236: THEN
237: FND_msg_PUB.Add_Exc_msg( g_pkg_name,l_api_name);
238: END IF;
368: bis_collection_utilities.log('Populated source_name column in source_query_safb table');
369:
370:
371: -- Standard call to check for call compatibility.
372: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
373: p_api_version_number,
374: l_api_name,
375: g_pkg_name)
376: THEN
373: p_api_version_number,
374: l_api_name,
375: g_pkg_name)
376: THEN
377: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
378: END IF;
379:
380: -- Initialize message list if p_init_msg_list is set to TRUE.
381: IF fnd_api.to_boolean( p_init_msg_list ) THEN
377: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
378: END IF;
379:
380: -- Initialize message list if p_init_msg_list is set to TRUE.
381: IF fnd_api.to_boolean( p_init_msg_list ) THEN
382:
383: FND_msg_PUB.initialize;
384:
385: END IF;
384:
385: END IF;
386:
387: -- Initialize API return status to SUCCESS
388: x_return_status := FND_API.G_RET_STS_SUCCESS;
389:
390: bis_collection_utilities.log('Running Initial Load of Segment Activity Facts');
391:
392: l_return := fnd_installation.get_app_info('BIM', l_status, l_industry, l_schema);
477: /***************************************************************/
478:
479: EXCEPTION
480:
481: WHEN FND_API.G_EXC_ERROR THEN
482: x_return_status := FND_API.G_RET_STS_ERROR;
483: Execute Immediate 'DROP TABLE source_query_safb';
484: -- Standard call to get message count and if count=1, get the message
485: FND_msg_PUB.Count_And_Get (
478:
479: EXCEPTION
480:
481: WHEN FND_API.G_EXC_ERROR THEN
482: x_return_status := FND_API.G_RET_STS_ERROR;
483: Execute Immediate 'DROP TABLE source_query_safb';
484: -- Standard call to get message count and if count=1, get the message
485: FND_msg_PUB.Count_And_Get (
486: -- p_encoded => FND_API.G_FALSE,
482: x_return_status := FND_API.G_RET_STS_ERROR;
483: Execute Immediate 'DROP TABLE source_query_safb';
484: -- Standard call to get message count and if count=1, get the message
485: FND_msg_PUB.Count_And_Get (
486: -- p_encoded => FND_API.G_FALSE,
487: p_count => x_msg_count,
488: p_data => x_msg_data
489: );
490:
489: );
490:
491: bis_collection_utilities.log('BIM_I_SGMT_ACT_FACTS_PKG : FIRST_LOAD:IN EXPECTED EXCEPTION '||sqlerrm(sqlcode));
492:
493: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
494:
495: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
496: Execute Immediate 'DROP TABLE source_query_safb';
497:
491: bis_collection_utilities.log('BIM_I_SGMT_ACT_FACTS_PKG : FIRST_LOAD:IN EXPECTED EXCEPTION '||sqlerrm(sqlcode));
492:
493: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
494:
495: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
496: Execute Immediate 'DROP TABLE source_query_safb';
497:
498: -- Standard call to get message count and if count=1, get the message
499: FND_msg_PUB.Count_And_Get (
496: Execute Immediate 'DROP TABLE source_query_safb';
497:
498: -- Standard call to get message count and if count=1, get the message
499: FND_msg_PUB.Count_And_Get (
500: --p_encoded => FND_API.G_FALSE,
501: p_count => x_msg_count,
502: p_data => x_msg_data
503: );
504:
505: bis_collection_utilities.log('BIM_I_SGMT_ACT_FACTS_PKG : FIRST_LOAD:IN UNEXPECTED EXCEPTION '||sqlerrm(sqlcode));
506:
507: WHEN OTHERS THEN
508:
509: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
510: Execute Immediate 'DROP TABLE source_query_safb';
511:
512: IF FND_msg_PUB.Check_msg_Level (FND_msg_PUB.G_msg_LVL_UNEXP_ERROR)
513: THEN
515: END IF;
516:
517: -- Standard call to get message count and if count=1, get the message
518: FND_msg_PUB.Count_And_Get (
519: -- p_encoded => FND_API.G_FALSE,
520: p_count => x_msg_count,
521: p_data => x_msg_data
522: );
523:
649:
650: bis_collection_utilities.log('Populated source_name column in source_query_safb table');
651:
652: -- Standard call to check for call compatibility.
653: IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
654: p_api_version_number,
655: l_api_name,
656: g_pkg_name)
657: THEN
654: p_api_version_number,
655: l_api_name,
656: g_pkg_name)
657: THEN
658: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
659: END IF;
660:
661: -- Initialize message list if p_init_msg_list is set to TRUE.
662: IF FND_API.to_Boolean( p_init_msg_list ) THEN
658: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
659: END IF;
660:
661: -- Initialize message list if p_init_msg_list is set to TRUE.
662: IF FND_API.to_Boolean( p_init_msg_list ) THEN
663:
664: FND_msg_PUB.initialize;
665:
666: END IF;
665:
666: END IF;
667:
668: -- Initialize API return status to SUCCESS
669: x_return_status := FND_API.G_RET_STS_SUCCESS;
670:
671: bis_collection_utilities.log('Running Incremental Load of Segment Activity Facts');
672:
673: bis_collection_utilities.log('Inserting Segment Activity Details');
749:
750:
751: EXCEPTION
752:
753: WHEN FND_API.G_EXC_ERROR THEN
754: x_return_status := FND_API.G_RET_STS_ERROR;
755: Execute Immediate 'DROP TABLE source_query_safb';
756: -- Standard call to get message count and if count=1, get the message
757: FND_msg_PUB.Count_And_Get (
750:
751: EXCEPTION
752:
753: WHEN FND_API.G_EXC_ERROR THEN
754: x_return_status := FND_API.G_RET_STS_ERROR;
755: Execute Immediate 'DROP TABLE source_query_safb';
756: -- Standard call to get message count and if count=1, get the message
757: FND_msg_PUB.Count_And_Get (
758: -- p_encoded => FND_API.G_FALSE,
754: x_return_status := FND_API.G_RET_STS_ERROR;
755: Execute Immediate 'DROP TABLE source_query_safb';
756: -- Standard call to get message count and if count=1, get the message
757: FND_msg_PUB.Count_And_Get (
758: -- p_encoded => FND_API.G_FALSE,
759: p_count => x_msg_count,
760: p_data => x_msg_data
761: );
762:
761: );
762:
763: bis_collection_utilities.log('BIM_I_SGMT_ACT_FACTS_PKG:INCREMENTAL_LOAD:IN EXPECTED EXCEPTION '||sqlerrm(sqlcode));
764:
765: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
766:
767: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
768: Execute Immediate 'DROP TABLE source_query_safb';
769:
763: bis_collection_utilities.log('BIM_I_SGMT_ACT_FACTS_PKG:INCREMENTAL_LOAD:IN EXPECTED EXCEPTION '||sqlerrm(sqlcode));
764:
765: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
766:
767: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
768: Execute Immediate 'DROP TABLE source_query_safb';
769:
770: -- Standard call to get message count and if count=1, get the message
771: FND_msg_PUB.Count_And_Get (
768: Execute Immediate 'DROP TABLE source_query_safb';
769:
770: -- Standard call to get message count and if count=1, get the message
771: FND_msg_PUB.Count_And_Get (
772: --p_encoded => FND_API.G_FALSE,
773: p_count => x_msg_count,
774: p_data => x_msg_data
775: );
776:
777: bis_collection_utilities.log('BIM_I_SGMT_ACT_FACTS_PKG:INCREMENTAL_LOAD:IN UNEXPECTED EXCEPTION '||sqlerrm(sqlcode));
778:
779: WHEN OTHERS THEN
780:
781: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
782: Execute Immediate 'DROP TABLE source_query_safb';
783:
784: IF FND_msg_PUB.Check_msg_Level (FND_msg_PUB.G_msg_LVL_UNEXP_ERROR)
785: THEN
787: END IF;
788:
789: -- Standard call to get message count and if count=1, get the message
790: FND_msg_PUB.Count_And_Get (
791: -- p_encoded => FND_API.G_FALSE,
792: p_count => x_msg_count,
793: p_data => x_msg_data
794: );
795: