140: p_resource_id IN NUMBER DEFAULT NULL
141: )
142: IS
143:
144: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
145: l_msg_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
146: l_msg_count NUMBER := 0;
147: l_msg_data VARCHAR2(8000) := '';
148:
141: )
142: IS
143:
144: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
145: l_msg_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
146: l_msg_count NUMBER := 0;
147: l_msg_data VARCHAR2(8000) := '';
148:
149: l_err_num NUMBER := 0;
261: p_simulation_set => p_simulation_set
262: );
263: END IF;
264:
265: IF l_return_status <> FND_API.g_ret_sts_success THEN
266: WriteLog(
267: p_api_version => 1.0,
268: p_msg_count => l_msg_count,
269: p_msg_data => l_msg_data,
976: -- standard start of API savepoint
977: SAVEPOINT WriteLog_PUB;
978:
979: -- standard call to check for call compatibility
980: IF NOT FND_API.compatible_api_call (
981: l_api_version,
982: p_api_version,
983: l_api_name,
984: G_PKG_NAME ) then
981: l_api_version,
982: p_api_version,
983: l_api_name,
984: G_PKG_NAME ) then
985: RAISE FND_API.g_exc_unexpected_error;
986: END IF;
987:
988: -- initialize api return status to success
989: x_return_status := FND_API.g_ret_sts_success;
985: RAISE FND_API.g_exc_unexpected_error;
986: END IF;
987:
988: -- initialize api return status to success
989: x_return_status := FND_API.g_ret_sts_success;
990:
991: -- assign to local variables
992: l_msg_count := p_msg_count;
993: l_msg_data := p_msg_data;
994:
995: /* obtain messages from the message list */
996: l_stmt_num := 5;
997: FND_MSG_PUB.count_and_get(
998: p_encoded => FND_API.g_false,
999: p_count => l_msg_count,
1000: p_data => l_msg_data
1001: );
1002:
1004: l_stmt_num := 10;
1005: IF(l_msg_count > 0) THEN
1006: FOR i in 1 ..l_msg_count
1007: LOOP
1008: l_msg_data := FND_MSG_PUB.get(i, FND_API.g_false);
1009: FND_FILE.put_line(FND_FILE.log, i ||'-'||l_msg_data);
1010: END LOOP;
1011: END IF;
1012:
1010: END LOOP;
1011: END IF;
1012:
1013: EXCEPTION
1014: WHEN FND_API.g_exc_error THEN
1015: x_return_status := FND_API.g_ret_sts_error;
1016: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.WriteLog('
1017: || l_stmt_num
1018: || '): '
1011: END IF;
1012:
1013: EXCEPTION
1014: WHEN FND_API.g_exc_error THEN
1015: x_return_status := FND_API.g_ret_sts_error;
1016: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.WriteLog('
1017: || l_stmt_num
1018: || '): '
1019: || x_return_status
1017: || l_stmt_num
1018: || '): '
1019: || x_return_status
1020: || substr(SQLERRM,1,200));
1021: WHEN FND_API.g_exc_unexpected_error THEN
1022: x_return_status := FND_API.g_ret_sts_unexp_error;
1023: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.WriteLog('
1024: || l_stmt_num
1025: || '): '
1018: || '): '
1019: || x_return_status
1020: || substr(SQLERRM,1,200));
1021: WHEN FND_API.g_exc_unexpected_error THEN
1022: x_return_status := FND_API.g_ret_sts_unexp_error;
1023: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.WriteLog('
1024: || l_stmt_num
1025: || '): '
1026: || x_return_status
1025: || '): '
1026: || x_return_status
1027: || substr(SQLERRM,1,200));
1028: WHEN others THEN
1029: x_return_status := FND_API.g_ret_sts_unexp_error;
1030: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.WriteLog('
1031: || l_stmt_num
1032: || '): '
1033: || x_return_status
1073: -- standard start of API savepoint
1074: SAVEPOINT LoadDowntime_PUB;
1075:
1076: -- standard call to check for call compatibility
1077: IF NOT FND_API.compatible_api_call (
1078: l_api_version,
1079: p_api_version,
1080: l_api_name,
1081: G_PKG_NAME ) then
1078: l_api_version,
1079: p_api_version,
1080: l_api_name,
1081: G_PKG_NAME ) then
1082: RAISE FND_API.g_exc_unexpected_error;
1083: END IF;
1084:
1085: -- initialize api return status to success
1086: x_return_status := FND_API.g_ret_sts_success;
1082: RAISE FND_API.g_exc_unexpected_error;
1083: END IF;
1084:
1085: -- initialize api return status to success
1086: x_return_status := FND_API.g_ret_sts_success;
1087:
1088: --API Body
1089: --Delete BRIC rows
1090: delete from bom_res_instance_changes
1253: ACTION_TYPE,
1254: SIMULATION_SET;
1255: commit;
1256: EXCEPTION
1257: WHEN FND_API.g_exc_error THEN
1258: x_return_status := FND_API.g_ret_sts_error;
1259: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.LoadDowntime('
1260: || l_stmt_num
1261: || '): '
1254: SIMULATION_SET;
1255: commit;
1256: EXCEPTION
1257: WHEN FND_API.g_exc_error THEN
1258: x_return_status := FND_API.g_ret_sts_error;
1259: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.LoadDowntime('
1260: || l_stmt_num
1261: || '): '
1262: || x_return_status
1260: || l_stmt_num
1261: || '): '
1262: || x_return_status
1263: || substr(SQLERRM,1,200));
1264: WHEN FND_API.g_exc_unexpected_error THEN
1265: Rollback to LoadDowntime_PUB; -- roll back data when unexpected errors happens
1266: x_return_status := FND_API.g_ret_sts_unexp_error;
1267: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.LoadDowntime('
1268: || l_stmt_num
1262: || x_return_status
1263: || substr(SQLERRM,1,200));
1264: WHEN FND_API.g_exc_unexpected_error THEN
1265: Rollback to LoadDowntime_PUB; -- roll back data when unexpected errors happens
1266: x_return_status := FND_API.g_ret_sts_unexp_error;
1267: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.LoadDowntime('
1268: || l_stmt_num
1269: || '): '
1270: || x_return_status
1270: || x_return_status
1271: || substr(SQLERRM,1,200));
1272: WHEN others THEN
1273: Rollback to LoadDowntime_PUB; -- roll back data when unexpected errors happens
1274: x_return_status := FND_API.g_ret_sts_unexp_error;
1275: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.LoadDowntime('
1276: -- dbms_output.put_line('EAM_Downtime_PUB.LoadDowntime('
1277: || l_stmt_num
1278: || '): '
1308: -- standard start of API savepoint
1309: SAVEPOINT PurgeDowntime_PUB;
1310:
1311: -- standard call to check for call compatibility
1312: IF NOT FND_API.compatible_api_call (
1313: l_api_version,
1314: p_api_version,
1315: l_api_name,
1316: G_PKG_NAME ) then
1313: l_api_version,
1314: p_api_version,
1315: l_api_name,
1316: G_PKG_NAME ) then
1317: RAISE FND_API.g_exc_unexpected_error;
1318: END IF;
1319:
1320: -- initialize api return status to success
1321: x_return_status := FND_API.g_ret_sts_success;
1317: RAISE FND_API.g_exc_unexpected_error;
1318: END IF;
1319:
1320: -- initialize api return status to success
1321: x_return_status := FND_API.g_ret_sts_success;
1322:
1323: --API Body
1324: --Delete all previous equipment downtime rows in BRIC and BRC
1325: delete from bom_res_instance_changes
1343:
1344:
1345: commit;
1346: EXCEPTION
1347: WHEN FND_API.g_exc_error THEN
1348: ROLLBACK to purgedowntime_pub;
1349: x_return_status := FND_API.g_ret_sts_error;
1350: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.PurgeDowntime('
1351: || l_stmt_num
1345: commit;
1346: EXCEPTION
1347: WHEN FND_API.g_exc_error THEN
1348: ROLLBACK to purgedowntime_pub;
1349: x_return_status := FND_API.g_ret_sts_error;
1350: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.PurgeDowntime('
1351: || l_stmt_num
1352: || '): '
1353: || x_return_status
1351: || l_stmt_num
1352: || '): '
1353: || x_return_status
1354: || substr(SQLERRM,1,200));
1355: WHEN FND_API.g_exc_unexpected_error THEN
1356: ROLLBACK to purgedowntime_pub;
1357: x_return_status := FND_API.g_ret_sts_unexp_error;
1358: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.PurgeDowntime('
1359: || l_stmt_num
1353: || x_return_status
1354: || substr(SQLERRM,1,200));
1355: WHEN FND_API.g_exc_unexpected_error THEN
1356: ROLLBACK to purgedowntime_pub;
1357: x_return_status := FND_API.g_ret_sts_unexp_error;
1358: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.PurgeDowntime('
1359: || l_stmt_num
1360: || '): '
1361: || x_return_status
1361: || x_return_status
1362: || substr(SQLERRM,1,200));
1363: WHEN others THEN
1364: ROLLBACK to purgedowntime_pub;
1365: x_return_status := FND_API.g_ret_sts_unexp_error;
1366: FND_FILE.put_line(FND_FILE.log,'EAM_Downtime_PUB.PurgeDowntime('
1367: || l_stmt_num
1368: || '): '
1369: || x_return_status