37: -- standard start of API savepoint
38: SAVEPOINT writeLogMessages_PUB;
39:
40: -- standard call to check for call compatibility
41: if not fnd_api.compatible_api_call (
42: l_api_version,
43: p_api_version,
44: l_api_name,
45: G_PKG_NAME ) then
42: l_api_version,
43: p_api_version,
44: l_api_name,
45: G_PKG_NAME ) then
46: raise fnd_api.g_exc_unexpected_error;
47: end if;
48:
49: -- initialize api return status to success
50: x_return_status := fnd_api.g_ret_sts_success;
46: raise fnd_api.g_exc_unexpected_error;
47: end if;
48:
49: -- initialize api return status to success
50: x_return_status := fnd_api.g_ret_sts_success;
51:
52: -- assign to local variables
53: l_msg_count := p_msg_count;
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: );
63:
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:
71: END LOOP;
72: END IF;
73:
74: EXCEPTION
75: when fnd_api.g_exc_error then
76: x_return_status := fnd_api.g_ret_sts_error;
77: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
78: when fnd_api.g_exc_unexpected_error then
79: x_return_status := fnd_api.g_ret_sts_unexp_error ;
72: END IF;
73:
74: EXCEPTION
75: when fnd_api.g_exc_error then
76: x_return_status := fnd_api.g_ret_sts_error;
77: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
78: when fnd_api.g_exc_unexpected_error then
79: x_return_status := fnd_api.g_ret_sts_unexp_error ;
80: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
74: EXCEPTION
75: when fnd_api.g_exc_error then
76: x_return_status := fnd_api.g_ret_sts_error;
77: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
78: when fnd_api.g_exc_unexpected_error then
79: x_return_status := fnd_api.g_ret_sts_unexp_error ;
80: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
81: when others then
82: x_return_status := fnd_api.g_ret_sts_unexp_error ;
75: when fnd_api.g_exc_error then
76: x_return_status := fnd_api.g_ret_sts_error;
77: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
78: when fnd_api.g_exc_unexpected_error then
79: x_return_status := fnd_api.g_ret_sts_unexp_error ;
80: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
81: when others then
82: x_return_status := fnd_api.g_ret_sts_unexp_error ;
83: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
78: when fnd_api.g_exc_unexpected_error then
79: x_return_status := fnd_api.g_ret_sts_unexp_error ;
80: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
81: when others then
82: x_return_status := fnd_api.g_ret_sts_unexp_error ;
83: fnd_file.put_line(fnd_file.log,'CST_Utility_PUB.writeLogMessages(' || l_stmt_num || '): ' || x_return_status || substr(SQLERRM,1,200));
84:
85: END writeLogMessages;
86:
100: -- 11/03/00 Hemant G Created --
101: ----------------------------------------------------------------------------
102: PROCEDURE getTxnCategoryId (p_api_version IN NUMBER,
103: p_init_msg_list IN VARCHAR2
104: := FND_API.G_FALSE,
105: p_commit IN VARCHAR2
106: := FND_API.G_FALSE,
107: p_validation_level IN NUMBER
108: := FND_API.G_VALID_LEVEL_FULL,
102: PROCEDURE getTxnCategoryId (p_api_version IN NUMBER,
103: p_init_msg_list IN VARCHAR2
104: := FND_API.G_FALSE,
105: p_commit IN VARCHAR2
106: := FND_API.G_FALSE,
107: p_validation_level IN NUMBER
108: := FND_API.G_VALID_LEVEL_FULL,
109:
110:
104: := FND_API.G_FALSE,
105: p_commit IN VARCHAR2
106: := FND_API.G_FALSE,
107: p_validation_level IN NUMBER
108: := FND_API.G_VALID_LEVEL_FULL,
109:
110:
111: p_txn_id IN NUMBER,
112: p_txn_action_id IN NUMBER,
137:
138: -------------------------------------------------------------------------
139: -- standard call to check for call compatibility
140: -------------------------------------------------------------------------
141: IF NOT fnd_api.compatible_api_call (
142: l_api_version,
143: p_api_version,
144: l_api_name,
145: G_PKG_NAME ) then
143: p_api_version,
144: l_api_name,
145: G_PKG_NAME ) then
146:
147: RAISE fnd_api.g_exc_unexpected_error;
148:
149: END IF;
150:
151: -------------------------------------------------------------------------
151: -------------------------------------------------------------------------
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:
159:
160: -------------------------------------------------------------------------
161: -- initialize api return status to success
162: -------------------------------------------------------------------------
163: x_return_status := fnd_api.g_ret_sts_success;
164:
165: -- assign to local variables
166: l_statement := 10;
167: l_item_id := p_item_id;
223: ---------------------------------------------------------------------------
224: -- Standard check of p_commit
225: ---------------------------------------------------------------------------
226:
227: IF FND_API.to_Boolean(p_commit) THEN
228: COMMIT WORK;
229: END IF;
230:
231: ---------------------------------------------------------------------------
239:
240:
241: EXCEPTION
242:
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
240:
241: EXCEPTION
242:
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
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
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: --
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
298: ----------------------------------------------------------------------------
299: PROCEDURE get_Std_CG_Acct_Flag (
300: p_api_version IN NUMBER,
301: p_init_msg_list IN VARCHAR2
302: := FND_API.G_FALSE,
303: p_commit IN VARCHAR2
304: := FND_API.G_FALSE,
305: p_validation_level IN NUMBER
306: := FND_API.G_VALID_LEVEL_FULL,
300: p_api_version IN NUMBER,
301: p_init_msg_list IN VARCHAR2
302: := FND_API.G_FALSE,
303: p_commit IN VARCHAR2
304: := FND_API.G_FALSE,
305: p_validation_level IN NUMBER
306: := FND_API.G_VALID_LEVEL_FULL,
307:
308: p_organization_id IN NUMBER,
302: := FND_API.G_FALSE,
303: p_commit IN VARCHAR2
304: := FND_API.G_FALSE,
305: p_validation_level IN NUMBER
306: := FND_API.G_VALID_LEVEL_FULL,
307:
308: p_organization_id IN NUMBER,
309: p_organization_code IN VARCHAR2,
310:
333: ------------------------------------------------
334: -- Standard call to check for API compatibility
335: ------------------------------------------------
336: l_statement := 10;
337: IF not fnd_api.compatible_api_call (
338: l_api_version,
339: p_api_version,
340: l_api_name,
341: G_PKG_NAME ) then
338: l_api_version,
339: p_api_version,
340: l_api_name,
341: G_PKG_NAME ) then
342: RAISE fnd_api.G_exc_unexpected_error;
343: END IF;
344:
345: ------------------------------------------------------------
346: -- Initialize message list if p_init_msg_list is set to TRUE
345: ------------------------------------------------------------
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: -------------------------------------------------------------
353: -------------------------------------------------------------
354: -- Initialize API return status to Success
355: -------------------------------------------------------------
356: l_statement := 30;
357: x_return_status := fnd_api.g_ret_sts_success;
358:
359:
360: -------------------------------------------------
361: -- Validate input parameters
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:
373: ---------------------------------------------
374: -- Obtain organization parameters
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,
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 );
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
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,
411: ( p_count => x_msg_count,
412: p_data => x_msg_data );
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 );
418: ( p_count => x_msg_count,
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;
518: BEGIN
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:
524: end if;
525: FND_MESSAGE.set_name('BOM', 'CST_API_MESSAGE');
526:
527: -- Standard check for compatibility
528: IF NOT FND_API.Compatible_API_Call (
529: l_api_version,
530: P_API_VERSION,
531: l_api_name,
532: G_PKG_NAME ) -- line 90
530: P_API_VERSION,
531: l_api_name,
532: G_PKG_NAME ) -- line 90
533: THEN
534: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
535: END IF;
536:
537: -- Initialize API return status to success
538: X_RETURN_STATUS := FND_API.G_RET_STS_SUCCESS;
534: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
535: END IF;
536:
537: -- Initialize API return status to success
538: X_RETURN_STATUS := FND_API.G_RET_STS_SUCCESS;
539:
540: -- API body
541:
542: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
548: -- Check that required parameters are not null
549: if (P_ORG_ID is null OR P_TXN_ID is null OR P_USER_ID is null OR P_DBT_CRDT is null
550: OR P_LINE_TYP is null OR P_BS_TXN_VAL is null) then
551: l_api_message := 'Required parameters P_ORG_ID, P_TXN_ID, P_USER_ID, P_DBT_CRDT, P_LINE_TYP, and P_BS_TXN_VAL must not be NULL';
552: RAISE FND_API.G_EXC_ERROR;
553: end if;
554:
555: -- Check P_ACCOUNT
556: l_stmt_num := 10;
565: -- Check P_DBT_CRDT
566: l_stmt_num := 20;
567: if (P_DBT_CRDT <> -1 AND P_DBT_CRDT <> 1) then
568: l_api_message := 'Invalid P_DBT_CRDT: should be 1 or -1';
569: RAISE FND_API.G_EXC_ERROR;
570: end if;
571:
572: -- Check that P_LINE_TYP exists
573: l_stmt_num := 30;
733: if SQL%FOUND then -- insert succeeded
734: l_api_message := 'INSERT succeeded';
735: else
736: l_api_message := 'Insert Failed for txn_id '||to_char(P_TXN_ID)||'. Check that it exists in MMT and that P_ORG_ID is correct.';
737: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
738: end if;
739:
740: if (l_debug = 'Y') then
741: FND_FILE.PUT_LINE (fnd_file.log,l_api_message);
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:
754: -- Standard check of P_COMMIT
751: p_count => X_MSG_COUNT,
752: p_data => X_MSG_DATA );
753:
754: -- Standard check of P_COMMIT
755: IF FND_API.to_Boolean(P_COMMIT) THEN
756: COMMIT WORK;
757: END IF;
758:
759: EXCEPTION
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;
770: when FND_API.G_EXC_UNEXPECTED_ERROR then
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;
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 (
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;
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,
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;
778: when FND_API.G_EXC_ERROR then
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;
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 (
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;
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,
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;
786: when OTHERS then
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;
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;
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;
795:
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;
795:
796: END insert_MTA;
797:
798: FUNCTION get_ret_sts_success return varchar2
797:
798: FUNCTION get_ret_sts_success return varchar2
799: IS
800: BEGIN
801: return fnd_api.g_ret_sts_success;
802: END get_ret_sts_success;
803:
804: FUNCTION get_ret_sts_error return varchar2
805: IS
803:
804: FUNCTION get_ret_sts_error return varchar2
805: IS
806: BEGIN
807: return fnd_api.g_ret_sts_error;
808: END get_ret_sts_error;
809:
810: FUNCTION get_ret_sts_unexp_error return varchar2
811: IS
809:
810: FUNCTION get_ret_sts_unexp_error return varchar2
811: IS
812: BEGIN
813: return fnd_api.g_ret_sts_unexp_error;
814: END get_ret_sts_unexp_error;
815:
816: FUNCTION get_true return varchar2
817: IS
815:
816: FUNCTION get_true return varchar2
817: IS
818: BEGIN
819: return fnd_api.g_true;
820: END get_true;
821:
822: FUNCTION get_false return varchar2
823: IS
821:
822: FUNCTION get_false return varchar2
823: IS
824: BEGIN
825: return fnd_api.g_false;
826: END get_false;
827:
828: FUNCTION get_log return number
829: IS
866: -- 07/01/03 Linda Soo Created --
867: -----------------------------------------------------------------------------
868: PROCEDURE get_ZeroCostIssue_Flag (
869: P_API_VERSION IN NUMBER,
870: P_INIT_MSG_LIST IN VARCHAR2 default FND_API.G_FALSE,
871: X_RETURN_STATUS OUT NOCOPY VARCHAR2,
872: X_MSG_COUNT OUT NOCOPY NUMBER,
873: X_MSG_DATA OUT NOCOPY VARCHAR2,
874: P_TXN_ID IN NUMBER,
912: ------------------------------------------------
913: -- Standard call to check for API compatibility
914: ------------------------------------------------
915: l_statement := 10;
916: IF not fnd_api.compatible_api_call( l_api_version,
917: p_api_version,
918: l_api_name,
919: G_PKG_NAME ) then
920: RAISE fnd_api.G_exc_unexpected_error;
916: IF not fnd_api.compatible_api_call( l_api_version,
917: p_api_version,
918: l_api_name,
919: G_PKG_NAME ) then
920: RAISE fnd_api.G_exc_unexpected_error;
921: END IF;
922:
923: -------------------------------------------------------------
924: -- Initialize message list if p_init_msg_list is set to TRUE
923: -------------------------------------------------------------
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: -------------------------------------------
931: -------------------------------------------
932: -- Initialize API return status to Success
933: -------------------------------------------
934: l_statement := 30;
935: x_return_status := fnd_api.g_ret_sts_success;
936:
937: -----------------------------
938: -- Validate input parameters
939: -----------------------------
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: -----------------------------------
950: -- Obtain data for transaction ID
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: -------------------------------------
978: -- Check transaction source type ID
1060: p_data => x_msg_data );
1061:
1062: EXCEPTION
1063:
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(
1061:
1062: EXCEPTION
1063:
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,
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
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(
1069: p_count => x_msg_count,
1070: p_data => x_msg_data );
1071:
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,
1077: p_count => x_msg_count,
1078: p_data => x_msg_data );
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));
1119:
1120: PROCEDURE get_Direct_Item_Charge_Acct (
1121: p_api_version IN NUMBER,
1122: p_init_msg_list IN VARCHAR2
1123: := FND_API.G_FALSE,
1124: p_commit IN VARCHAR2
1125: := FND_API.G_FALSE,
1126: p_validation_level IN NUMBER
1127: := FND_API.G_VALID_LEVEL_FULL,
1121: p_api_version IN NUMBER,
1122: p_init_msg_list IN VARCHAR2
1123: := FND_API.G_FALSE,
1124: p_commit IN VARCHAR2
1125: := FND_API.G_FALSE,
1126: p_validation_level IN NUMBER
1127: := FND_API.G_VALID_LEVEL_FULL,
1128: p_wip_entity_id IN NUMBER := NULL,
1129: x_material_acct OUT NOCOPY NUMBER,
1123: := FND_API.G_FALSE,
1124: p_commit IN VARCHAR2
1125: := FND_API.G_FALSE,
1126: p_validation_level IN NUMBER
1127: := FND_API.G_VALID_LEVEL_FULL,
1128: p_wip_entity_id IN NUMBER := NULL,
1129: x_material_acct OUT NOCOPY NUMBER,
1130: x_return_status OUT NOCOPY VARCHAR2,
1131: x_msg_count OUT NOCOPY NUMBER,
1151: ------------------------------------------------
1152: -- Standard call to check for API compatibility
1153: ------------------------------------------------
1154: l_statement := 10;
1155: IF not fnd_api.compatible_api_call (
1156: l_api_version,
1157: p_api_version,
1158: l_api_name,
1159: G_PKG_NAME ) then
1156: l_api_version,
1157: p_api_version,
1158: l_api_name,
1159: G_PKG_NAME ) then
1160: RAISE fnd_api.G_exc_unexpected_error;
1161: END IF;
1162:
1163: ------------------------------------------------------------
1164: -- Initialize message list if p_init_msg_list is set to TRUE
1163: ------------------------------------------------------------
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: -------------------------------------------------------------
1171: -------------------------------------------------------------
1172: -- Initialize API return status to Success
1173: -------------------------------------------------------------
1174: l_statement := 30;
1175: x_return_status := fnd_api.g_ret_sts_success;
1176:
1177: -------------------------------------------------
1178: -- Validate input parameters
1179: -------------------------------------------------
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:
1190: ---------------------------------------------
1191: -- Verify if EAM job
1224:
1225: x_material_acct := l_account;
1226:
1227: EXCEPTION
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
1225: x_material_acct := l_account;
1226:
1227: EXCEPTION
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,
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
1237: x_return_status := fnd_api.g_ret_sts_unexp_error;
1238: x_material_acct := -1;
1239:
1240: 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
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,
1241: ( p_count => x_msg_count,
1242: p_data => x_msg_data );
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));
1270: ------------------------------------------------
1271: -- Standard call to check for API compatibility
1272: ------------------------------------------------
1273: l_statement := 10;
1274: IF NOT fnd_api.compatible_api_call (
1275: l_api_version,
1276: p_api_version,
1277: l_api_name,
1278: G_PKG_NAME )
1275: l_api_version,
1276: p_api_version,
1277: l_api_name,
1278: G_PKG_NAME )
1279: THEN RAISE fnd_api.G_exc_unexpected_error;
1280: END IF;
1281:
1282: ------------------------------------------------------------
1283: -- Initialize message list if p_init_msg_list is set to TRUE
1282: ------------------------------------------------------------
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: -------------------------------------------------------------
1290: -------------------------------------------------------------
1291: -- Initialize API return status to Success
1292: -------------------------------------------------------------
1293: l_statement := 30;
1294: x_return_status := fnd_api.g_ret_sts_success;
1295:
1296: SELECT replace(substr(version,1,instr(version,'.',1,2)-1),'.')
1297: INTO l_db_version
1298: FROM v$instance;
1302: ELSE return 1;
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;
1337:
1338: ----------------------------------------------------------
1339: -- Standard call to check for call compatibility
1340: ----------------------------------------------------------
1341: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
1342: p_api_version,
1343: l_api_name,
1344: G_PKG_NAME)
1345: THEN
1342: p_api_version,
1343: l_api_name,
1344: G_PKG_NAME)
1345: THEN
1346: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1347: END IF;
1348:
1349: ----------------------------------------------------------
1350: --Check p_init_msg_list
1348:
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: ---------------------------------------------------------
1355:
1356: ---------------------------------------------------------
1357: --Initialize API return Status to Success
1358: --------------------------------------------------------
1359: x_return_status := FND_API.G_RET_STS_SUCCESS;
1360:
1361: SELECT
1362: ledger_id,
1363: legal_entity,
1370: cst_acct_info_v
1371: WHERE
1372: organization_id = p_org_id;
1373:
1374: IF FND_API.To_Boolean(p_commit) THEN
1375: COMMIT;
1376: END IF;
1377:
1378: FND_MSG_PUB.Count_And_Get
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,
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: );
1388: ( p_count => x_msg_count,
1389: p_data => x_msg_data
1390: );
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,
1390: );
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: );
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,
1444: l_stmt_num NUMBER := 0;
1445:
1446: BEGIN
1447: SAVEPOINT Get_Receipt_Event_Info;
1448: IF NOT FND_API.COMPATIBLE_API_CALL ( l_api_version,
1449: p_api_version,
1450: l_api_name,
1451: G_PKG_NAME ) THEN
1452: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1448: IF NOT FND_API.COMPATIBLE_API_CALL ( l_api_version,
1449: p_api_version,
1450: l_api_name,
1451: G_PKG_NAME ) THEN
1452: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1453: END IF;
1454:
1455: x_return_status := FND_API.G_RET_STS_SUCCESS;
1456: p_entity_code := 'RCV_ACCOUNTING_EVENTS';
1451: G_PKG_NAME ) THEN
1452: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1453: END IF;
1454:
1455: x_return_status := FND_API.G_RET_STS_SUCCESS;
1456: p_entity_code := 'RCV_ACCOUNTING_EVENTS';
1457: p_application_id := 707; /* Application ID for Cost Management */
1458:
1459: IF p_transaction_type IN ( 'RECEIVE', 'MATCH', 'RETURN TO VENDOR' ) THEN
1463: FROM CST_XLA_RCV_EVENT_MAP
1464: WHERE TRANSACTION_TYPE_ID = 1;
1465: ELSE
1466: p_event_class_code := NULL;
1467: x_return_status := fnd_api.g_ret_sts_error;
1468: END IF;
1469: EXCEPTION
1470: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1471: p_event_class_code := NULL;
1466: p_event_class_code := NULL;
1467: x_return_status := fnd_api.g_ret_sts_error;
1468: END IF;
1469: EXCEPTION
1470: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1471: p_event_class_code := NULL;
1472: x_return_status := fnd_api.g_ret_sts_unexp_error;
1473: WHEN OTHERS THEN
1474: p_event_class_code := NULL;
1468: END IF;
1469: EXCEPTION
1470: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1471: p_event_class_code := NULL;
1472: x_return_status := fnd_api.g_ret_sts_unexp_error;
1473: WHEN OTHERS THEN
1474: p_event_class_code := NULL;
1475: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1476: END Get_Receipt_Event_Info;
1471: p_event_class_code := NULL;
1472: x_return_status := fnd_api.g_ret_sts_unexp_error;
1473: WHEN OTHERS THEN
1474: p_event_class_code := NULL;
1475: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1476: END Get_Receipt_Event_Info;
1477:
1478: END CST_Utility_PUB;