54: l_msg_data := p_msg_data;
55:
56: /* obtain messages from the message list */
57: l_stmt_num := 20;
58: FND_MSG_PUB.count_and_get(
59: p_encoded => FND_API.g_false,
60: p_count => l_msg_count,
61: p_data => l_msg_data
62: );
65: l_stmt_num := 20;
66: IF(l_msg_count > 0) THEN
67: FOR i in 1 ..l_msg_count
68: LOOP
69: l_msg_data := FND_MSG_PUB.get(i, FND_API.g_false);
70: FND_FILE.PUT_LINE(FND_FILE.LOG, i ||'-'||l_msg_data);
71: END LOOP;
72: END IF;
73:
152: -- Initialize message list if p_init_msg_list is set to TRUE
153: -------------------------------------------------------------------------
154:
155: IF FND_API.to_Boolean(p_init_msg_list) THEN
156: FND_MSG_PUB.initialize;
157: END IF;
158:
159:
160: -------------------------------------------------------------------------
231: ---------------------------------------------------------------------------
232: -- Standard Call to get message count and if count = 1, get message info
233: ---------------------------------------------------------------------------
234:
235: FND_MSG_PUB.Count_And_Get (
236: p_count => x_msg_count,
237: p_data => x_msg_data );
238:
239:
243: WHEN fnd_api.g_exc_error THEN
244: x_return_status := fnd_api.g_ret_sts_error;
245:
246: -- Get message count and data
247: fnd_msg_pub.count_and_get
248: ( p_count => x_msg_count
249: , p_data => x_msg_data
250: );
251: --
252: WHEN fnd_api.g_exc_unexpected_error THEN
253: x_return_status := fnd_api.g_ret_sts_unexp_error ;
254:
255: -- Get message count and data
256: fnd_msg_pub.count_and_get
257: ( p_count => x_msg_count
258: , p_data => x_msg_data
259: );
260: --
260: --
261: WHEN OTHERS THEN
262: x_return_status := fnd_api.g_ret_sts_unexp_error ;
263: --
264: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
265: THEN
266: fnd_msg_pub.add_exc_msg
267: ( 'CST_Utility_Pub'
268: , 'getTxnCategoryId : Statement - '||to_char(l_statement)
262: x_return_status := fnd_api.g_ret_sts_unexp_error ;
263: --
264: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
265: THEN
266: fnd_msg_pub.add_exc_msg
267: ( 'CST_Utility_Pub'
268: , 'getTxnCategoryId : Statement - '||to_char(l_statement)
269: );
270:
270:
271: END IF;
272:
273: -- Get message count and data
274: fnd_msg_pub.count_and_get
275: ( p_count => x_msg_count
276: , p_data => x_msg_data
277: );
278:
346: -- Initialize message list if p_init_msg_list is set to TRUE
347: -------------------------------------------------------------
348: l_statement := 20;
349: IF fnd_api.to_Boolean(p_init_msg_list) then
350: fnd_msg_pub.initialize;
351: end if;
352:
353: -------------------------------------------------------------
354: -- Initialize API return status to Success
364: if ((p_organization_id is null) and (p_organization_code is null)) then
365: l_api_message := 'Please specify an organization';
366: FND_MESSAGE.set_name('BOM','CST_API_MESSAGE');
367: FND_MESSAGE.set_token('TEXT', l_api_message);
368: FND_MSG_PUB.add;
369:
370: RAISE fnd_api.g_exc_error;
371: end if;
372:
397: l_statement := 80;
398: l_api_message := 'This function is not valid for non-standard costing organizations';
399: FND_MESSAGE.set_name('BOM','CST_API_MESSAGE');
400: FND_MESSAGE.set_token('TEXT', l_api_message);
401: FND_MSG_PUB.add;
402:
403: x_cg_acct_flag := 0;
404: end if;
405:
406: EXCEPTION
407: WHEN fnd_api.g_exc_error then
408: x_return_status := fnd_api.g_ret_sts_error;
409:
410: fnd_msg_pub.count_and_get
411: ( p_count => x_msg_count,
412: p_data => x_msg_data );
413:
414: WHEN fnd_api.g_exc_unexpected_error then
413:
414: WHEN fnd_api.g_exc_unexpected_error then
415: x_return_status := fnd_api.g_ret_sts_unexp_error;
416:
417: fnd_msg_pub.count_and_get
418: ( p_count => x_msg_count,
419: p_data => x_msg_data );
420:
421: WHEN OTHERS THEN
419: p_data => x_msg_data );
420:
421: WHEN OTHERS THEN
422: x_return_status := fnd_api.g_ret_sts_unexp_error ;
423: If fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) then
424: fnd_msg_pub.add_exc_msg
425: ( 'CST_Utility_PUB','get_Std_CG_Acct_Flag : Statement - ' || to_char(l_statement));
426: end if;
427:
420:
421: WHEN OTHERS THEN
422: x_return_status := fnd_api.g_ret_sts_unexp_error ;
423: If fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) then
424: fnd_msg_pub.add_exc_msg
425: ( 'CST_Utility_PUB','get_Std_CG_Acct_Flag : Statement - ' || to_char(l_statement));
426: end if;
427:
428: fnd_msg_pub.count_and_get( p_count => x_msg_count,
424: fnd_msg_pub.add_exc_msg
425: ( 'CST_Utility_PUB','get_Std_CG_Acct_Flag : Statement - ' || to_char(l_statement));
426: end if;
427:
428: fnd_msg_pub.count_and_get( p_count => x_msg_count,
429: p_data => x_msg_data );
430: END get_Std_CG_Acct_Flag;
431:
432:
519:
520: SAVEPOINT Insert_MTA_PUB;
521: -- Initialize message list if p_init_msg_list is set to TRUE
522: if FND_API.to_Boolean(P_INIT_MSG_LIST) then
523: FND_MSG_PUB.initialize;
524: end if;
525: FND_MESSAGE.set_name('BOM', 'CST_API_MESSAGE');
526:
527: -- Standard check for compatibility
741: FND_FILE.PUT_LINE (fnd_file.log,l_api_message);
742: end if;
743:
744: FND_MESSAGE.set_token('TEXT', l_api_message);
745: FND_MSG_PUB.ADD;
746:
747: -- End of API body
748:
749: FND_MSG_PUB.Count_And_Get (
745: FND_MSG_PUB.ADD;
746:
747: -- End of API body
748:
749: FND_MSG_PUB.Count_And_Get (
750: p_encoded => FND_API.G_FALSE,
751: p_count => X_MSG_COUNT,
752: p_data => X_MSG_DATA );
753:
760:
761: when NO_DATA_FOUND then
762: l_api_message := 'Error at statement '||to_char(l_stmt_num)||'. Invalid '||l_api_message;
763: FND_MESSAGE.set_token('TEXT', l_api_message);
764: FND_MSG_PUB.ADD;
765: FND_MSG_PUB.Count_And_Get (
766: p_encoded => FND_API.G_FALSE,
767: p_count => X_MSG_COUNT,
768: p_data => X_MSG_DATA );
761: when NO_DATA_FOUND then
762: l_api_message := 'Error at statement '||to_char(l_stmt_num)||'. Invalid '||l_api_message;
763: FND_MESSAGE.set_token('TEXT', l_api_message);
764: FND_MSG_PUB.ADD;
765: FND_MSG_PUB.Count_And_Get (
766: p_encoded => FND_API.G_FALSE,
767: p_count => X_MSG_COUNT,
768: p_data => X_MSG_DATA );
769: X_RETURN_STATUS := fnd_api.g_ret_sts_error;
768: p_data => X_MSG_DATA );
769: X_RETURN_STATUS := fnd_api.g_ret_sts_error;
770: when FND_API.G_EXC_UNEXPECTED_ERROR then
771: FND_MESSAGE.set_token('TEXT', l_api_message);
772: FND_MSG_PUB.ADD;
773: FND_MSG_PUB.Count_And_Get (
774: p_encoded => FND_API.G_FALSE,
775: p_count => X_MSG_COUNT,
776: p_data => X_MSG_DATA );
769: X_RETURN_STATUS := fnd_api.g_ret_sts_error;
770: when FND_API.G_EXC_UNEXPECTED_ERROR then
771: FND_MESSAGE.set_token('TEXT', l_api_message);
772: FND_MSG_PUB.ADD;
773: FND_MSG_PUB.Count_And_Get (
774: p_encoded => FND_API.G_FALSE,
775: p_count => X_MSG_COUNT,
776: p_data => X_MSG_DATA );
777: X_RETURN_STATUS := fnd_api.g_ret_sts_unexp_error;
776: p_data => X_MSG_DATA );
777: X_RETURN_STATUS := fnd_api.g_ret_sts_unexp_error;
778: when FND_API.G_EXC_ERROR then
779: FND_MESSAGE.set_token('TEXT', l_api_message);
780: FND_MSG_PUB.ADD;
781: FND_MSG_PUB.Count_And_Get (
782: p_encoded => FND_API.G_FALSE,
783: p_count => X_MSG_COUNT,
784: p_data => X_MSG_DATA );
777: X_RETURN_STATUS := fnd_api.g_ret_sts_unexp_error;
778: when FND_API.G_EXC_ERROR then
779: FND_MESSAGE.set_token('TEXT', l_api_message);
780: FND_MSG_PUB.ADD;
781: FND_MSG_PUB.Count_And_Get (
782: p_encoded => FND_API.G_FALSE,
783: p_count => X_MSG_COUNT,
784: p_data => X_MSG_DATA );
785: X_RETURN_STATUS := fnd_api.g_ret_sts_error;
785: X_RETURN_STATUS := fnd_api.g_ret_sts_error;
786: when OTHERS then
787: l_api_message := 'Error after statement '||to_char(l_stmt_num)||'. SQLCODE '||to_char(SQLCODE)||': '|| substrb(SQLERRM,1,100);
788: FND_MESSAGE.set_token('TEXT', l_api_message);
789: FND_MSG_PUB.ADD;
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 );
786: when OTHERS then
787: l_api_message := 'Error after statement '||to_char(l_stmt_num)||'. SQLCODE '||to_char(SQLCODE)||': '|| substrb(SQLERRM,1,100);
788: FND_MESSAGE.set_token('TEXT', l_api_message);
789: FND_MSG_PUB.ADD;
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: X_RETURN_STATUS := fnd_api.g_ret_sts_unexp_error;
924: -- Initialize message list if p_init_msg_list is set to TRUE
925: -------------------------------------------------------------
926: l_statement := 20;
927: IF fnd_api.to_Boolean(p_init_msg_list) then
928: fnd_msg_pub.initialize;
929: end if;
930:
931: -------------------------------------------
932: -- Initialize API return status to Success
941: if (p_txn_id is null) then
942: l_api_message := 'p_txn_id is null';
943: FND_MESSAGE.set_name('BOM','CST_API_MESSAGE');
944: FND_MESSAGE.set_token('TEXT', l_api_message);
945: FND_MSG_PUB.add;
946: RAISE fnd_api.g_exc_error;
947: end if;
948:
949: -----------------------------------
969: when no_data_found then
970: l_api_message := 'Transaction ID does not exist in MTL_MATERIAL_TRANSACTIONS table. ';
971: FND_MESSAGE.set_name('BOM','CST_API_MESSAGE');
972: FND_MESSAGE.set_token('TEXT', l_api_message);
973: FND_MSG_PUB.add;
974: RAISE fnd_api.g_exc_error;
975: end;
976:
977: -------------------------------------
1054:
1055: x_zero_cost_flag := l_zero_cost_flag;
1056:
1057: -- Standard Call to get message count and if count = 1, get message info
1058: FND_MSG_PUB.Count_And_Get (
1059: p_count => x_msg_count,
1060: p_data => x_msg_data );
1061:
1062: EXCEPTION
1064: WHEN fnd_api.g_exc_error then
1065: x_return_status := fnd_api.g_ret_sts_error;
1066: x_zero_cost_flag:= -1;
1067:
1068: fnd_msg_pub.count_and_get(
1069: p_count => x_msg_count,
1070: p_data => x_msg_data );
1071:
1072: WHEN fnd_api.g_exc_unexpected_error then
1072: WHEN fnd_api.g_exc_unexpected_error then
1073: x_return_status := fnd_api.g_ret_sts_unexp_error;
1074: x_zero_cost_flag:= -1;
1075:
1076: fnd_msg_pub.count_and_get(
1077: p_count => x_msg_count,
1078: p_data => x_msg_data );
1079:
1080: WHEN OTHERS THEN
1079:
1080: WHEN OTHERS THEN
1081: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1082: x_zero_cost_flag:= -1;
1083: if fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) then
1084: fnd_msg_pub.add_exc_msg ( 'CST_Utility_PUB',
1085: ' get_ZeroCostIssue_Flag: Statement - ' || to_char(l_statement));
1086: end if;
1087:
1080: WHEN OTHERS THEN
1081: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1082: x_zero_cost_flag:= -1;
1083: if fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) then
1084: fnd_msg_pub.add_exc_msg ( 'CST_Utility_PUB',
1085: ' get_ZeroCostIssue_Flag: Statement - ' || to_char(l_statement));
1086: end if;
1087:
1088: fnd_msg_pub.count_and_get(
1084: fnd_msg_pub.add_exc_msg ( 'CST_Utility_PUB',
1085: ' get_ZeroCostIssue_Flag: Statement - ' || to_char(l_statement));
1086: end if;
1087:
1088: fnd_msg_pub.count_and_get(
1089: p_count => x_msg_count,
1090: p_data => x_msg_data );
1091:
1092: END get_ZeroCostIssue_Flag;
1164: -- Initialize message list if p_init_msg_list is set to TRUE
1165: -------------------------------------------------------------
1166: l_statement := 20;
1167: IF fnd_api.to_Boolean(p_init_msg_list) then
1168: fnd_msg_pub.initialize;
1169: end if;
1170:
1171: -------------------------------------------------------------
1172: -- Initialize API return status to Success
1181: if (p_wip_entity_id is null) then
1182: l_api_message := 'Please specify a wip entity id';
1183: FND_MESSAGE.set_name('BOM','CST_API_MESSAGE');
1184: FND_MESSAGE.set_token('TEXT', l_api_message);
1185: FND_MSG_PUB.add;
1186:
1187: RAISE fnd_api.g_exc_error;
1188: end if;
1189:
1228: WHEN fnd_api.g_exc_error then
1229: x_return_status := fnd_api.g_ret_sts_error;
1230: x_material_acct := -1;
1231:
1232: fnd_msg_pub.count_and_get
1233: ( p_count => x_msg_count,
1234: p_data => x_msg_data );
1235:
1236: WHEN fnd_api.g_exc_unexpected_error then
1236: WHEN fnd_api.g_exc_unexpected_error then
1237: x_return_status := fnd_api.g_ret_sts_unexp_error;
1238: x_material_acct := -1;
1239:
1240: fnd_msg_pub.count_and_get
1241: ( p_count => x_msg_count,
1242: p_data => x_msg_data );
1243:
1244: WHEN OTHERS THEN
1243:
1244: WHEN OTHERS THEN
1245: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1246: x_material_acct := -1;
1247: If fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) then
1248: fnd_msg_pub.add_exc_msg
1249: ( 'CST_Utility_PUB',' get_Direct_Item_Charge_Acct : Statement - ' || to_char(l_statement));
1250: end if;
1251:
1244: WHEN OTHERS THEN
1245: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1246: x_material_acct := -1;
1247: If fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) then
1248: fnd_msg_pub.add_exc_msg
1249: ( 'CST_Utility_PUB',' get_Direct_Item_Charge_Acct : Statement - ' || to_char(l_statement));
1250: end if;
1251:
1252: fnd_msg_pub.count_and_get( p_count => x_msg_count,
1248: fnd_msg_pub.add_exc_msg
1249: ( 'CST_Utility_PUB',' get_Direct_Item_Charge_Acct : Statement - ' || to_char(l_statement));
1250: end if;
1251:
1252: fnd_msg_pub.count_and_get( p_count => x_msg_count,
1253: p_data => x_msg_data );
1254: END get_Direct_Item_Charge_Acct;
1255:
1256: FUNCTION check_Db_Version
1283: -- Initialize message list if p_init_msg_list is set to TRUE
1284: -------------------------------------------------------------
1285: l_statement := 20;
1286: IF fnd_api.to_Boolean(p_init_msg_list)
1287: THEN fnd_msg_pub.initialize;
1288: END IF;
1289:
1290: -------------------------------------------------------------
1291: -- Initialize API return status to Success
1303: END IF;
1304: EXCEPTION
1305: WHEN OTHERS THEN
1306: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1307: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1308: THEN fnd_msg_pub.add_exc_msg
1309: ( 'CST_Utility_PUB',' check_Db_Version : Statement - ' || to_char(l_statement));
1310: END IF;
1311: fnd_msg_pub.count_and_get( p_count => x_msg_count,
1304: EXCEPTION
1305: WHEN OTHERS THEN
1306: x_return_status := fnd_api.g_ret_sts_unexp_error ;
1307: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1308: THEN fnd_msg_pub.add_exc_msg
1309: ( 'CST_Utility_PUB',' check_Db_Version : Statement - ' || to_char(l_statement));
1310: END IF;
1311: fnd_msg_pub.count_and_get( p_count => x_msg_count,
1312: p_data => x_msg_data );
1307: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1308: THEN fnd_msg_pub.add_exc_msg
1309: ( 'CST_Utility_PUB',' check_Db_Version : Statement - ' || to_char(l_statement));
1310: END IF;
1311: fnd_msg_pub.count_and_get( p_count => x_msg_count,
1312: p_data => x_msg_data );
1313: END check_Db_Version;
1314:
1315: Procedure Get_Context_Value (
1349: ----------------------------------------------------------
1350: --Check p_init_msg_list
1351: ----------------------------------------------------------
1352: IF FND_API.to_Boolean(p_init_msg_list) THEN
1353: FND_MSG_PUB.initialize;
1354: END IF;
1355:
1356: ---------------------------------------------------------
1357: --Initialize API return Status to Success
1374: IF FND_API.To_Boolean(p_commit) THEN
1375: COMMIT;
1376: END IF;
1377:
1378: FND_MSG_PUB.Count_And_Get
1379: ( p_count => x_msg_count,
1380: p_data => x_msg_data
1381: );
1382:
1383: EXCEPTION
1384: WHEN FND_API.G_EXC_ERROR THEN
1385: ROLLBACK TO GET_CONTEXT_PUB;
1386: x_return_status := FND_API.G_RET_STS_ERROR;
1387: FND_MSG_PUB.Count_And_Get
1388: ( p_count => x_msg_count,
1389: p_data => x_msg_data
1390: );
1391:
1391:
1392: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1393: ROLLBACK TO GET_CONTEXT_PUB;
1394: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1395: FND_MSG_PUB.Count_And_Get
1396: ( p_count => x_msg_count,
1397: p_data => x_msg_data
1398: );
1399:
1400: WHEN OTHERS THEN
1401: ROLLBACK TO GET_CONTEXT_PUB;
1402: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1403:
1404: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1405: FND_MSG_PUB.Add_Exc_Msg
1406: ( G_PKG_NAME,
1407: l_api_name
1408: );
1401: ROLLBACK TO GET_CONTEXT_PUB;
1402: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1403:
1404: IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1405: FND_MSG_PUB.Add_Exc_Msg
1406: ( G_PKG_NAME,
1407: l_api_name
1408: );
1409: END IF;
1406: ( G_PKG_NAME,
1407: l_api_name
1408: );
1409: END IF;
1410: FND_MSG_PUB.Count_And_Get
1411: ( p_count => x_msg_count,
1412: p_data => x_msg_data
1413: );
1414: