45:
46: PROCEDURE process_checkinout_txn(
47:
48: p_api_version IN number := 1.0,
49: p_init_msg_list IN varchar2 := fnd_api.g_false,
50: p_commit IN varchar2 := fnd_api.g_false,
51: p_validation_level IN number := fnd_api.g_valid_level_full,
52: p_txn_date IN date := sysdate,
53: p_txn_type IN number,
46: PROCEDURE process_checkinout_txn(
47:
48: p_api_version IN number := 1.0,
49: p_init_msg_list IN varchar2 := fnd_api.g_false,
50: p_commit IN varchar2 := fnd_api.g_false,
51: p_validation_level IN number := fnd_api.g_valid_level_full,
52: p_txn_date IN date := sysdate,
53: p_txn_type IN number,
54: p_instance_id IN number,
47:
48: p_api_version IN number := 1.0,
49: p_init_msg_list IN varchar2 := fnd_api.g_false,
50: p_commit IN varchar2 := fnd_api.g_false,
51: p_validation_level IN number := fnd_api.g_valid_level_full,
52: p_txn_date IN date := sysdate,
53: p_txn_type IN number,
54: p_instance_id IN number,
55: p_comments IN varchar2 := NULL,
93: -- Standard Start of API savepoint
94: SAVEPOINT EAM_ASSET_OPERATION_TXN_PVT;
95:
96: -- Standard call to check for call compatibility.
97: IF NOT fnd_api.compatible_api_call(
98: l_api_version
99: ,p_api_version
100: ,l_api_name
101: ,g_pkg_name) THEN
98: l_api_version
99: ,p_api_version
100: ,l_api_name
101: ,g_pkg_name) THEN
102: RAISE fnd_api.g_exc_unexpected_error;
103: END IF;
104:
105: IF fnd_api.to_boolean(p_init_msg_list) THEN
106: fnd_msg_pub.initialize;
101: ,g_pkg_name) THEN
102: RAISE fnd_api.g_exc_unexpected_error;
103: END IF;
104:
105: IF fnd_api.to_boolean(p_init_msg_list) THEN
106: fnd_msg_pub.initialize;
107: END IF;
108:
109: x_return_status := fnd_api.g_ret_sts_success;
105: IF fnd_api.to_boolean(p_init_msg_list) THEN
106: fnd_msg_pub.initialize;
107: END IF;
108:
109: x_return_status := fnd_api.g_ret_sts_success;
110:
111: EAM_ASSET_OPERATION_TXN_PVT.insert_txn(
112: p_txn_date => p_txn_date,
113: p_txn_type => p_txn_type,
139: x_msg_count => x_msg_count,
140: x_msg_data => x_msg_data
141: );
142:
143: IF x_return_status <> fnd_api.g_ret_sts_success THEN
144: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT;
145: RETURN;
146: END IF;
147:
145: RETURN;
146: END IF;
147:
148: -- Standard check of p_commit.
149: IF fnd_api.to_boolean(p_commit) THEN
150: COMMIT WORK;
151: END IF;
152: fnd_msg_pub.count_and_get(
153: p_count => x_msg_count
152: fnd_msg_pub.count_and_get(
153: p_count => x_msg_count
154: ,p_data => x_msg_data);
155: EXCEPTION
156: WHEN fnd_api.g_exc_error THEN
157: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT;
158: x_return_status := fnd_api.g_ret_sts_error;
159: fnd_msg_pub.count_and_get(
160: p_count => x_msg_count
154: ,p_data => x_msg_data);
155: EXCEPTION
156: WHEN fnd_api.g_exc_error THEN
157: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT;
158: x_return_status := fnd_api.g_ret_sts_error;
159: fnd_msg_pub.count_and_get(
160: p_count => x_msg_count
161: ,p_data => x_msg_data);
162: WHEN fnd_api.g_exc_unexpected_error THEN
158: x_return_status := fnd_api.g_ret_sts_error;
159: fnd_msg_pub.count_and_get(
160: p_count => x_msg_count
161: ,p_data => x_msg_data);
162: WHEN fnd_api.g_exc_unexpected_error THEN
163: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT;
164: x_return_status := fnd_api.g_ret_sts_unexp_error;
165: fnd_msg_pub.count_and_get(
166: p_count => x_msg_count
160: p_count => x_msg_count
161: ,p_data => x_msg_data);
162: WHEN fnd_api.g_exc_unexpected_error THEN
163: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT;
164: x_return_status := fnd_api.g_ret_sts_unexp_error;
165: fnd_msg_pub.count_and_get(
166: p_count => x_msg_count
167: ,p_data => x_msg_data);
168: WHEN OTHERS THEN
166: p_count => x_msg_count
167: ,p_data => x_msg_data);
168: WHEN OTHERS THEN
169: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT;
170: x_return_status := fnd_api.g_ret_sts_unexp_error;
171:
172: IF fnd_msg_pub.check_msg_level(
173: fnd_msg_pub.g_msg_lvl_unexp_error) THEN
174: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
298:
299:
300: qa_results_pub.insert_row(
301: p_api_version => 1.0,
302: p_init_msg_list => fnd_api.g_true,
303: p_org_id => l_org_id,
304: p_plan_id => l_header_plan_id_tbl(plan_id),
305: p_spec_id => null,
306: p_transaction_number =>p_eam_ops_quality_tbl(0).transaction_number ,
305: p_spec_id => null,
306: p_transaction_number =>p_eam_ops_quality_tbl(0).transaction_number ,
307: p_transaction_id => null,
308: p_enabled_flag => 1,
309: p_commit => fnd_api.g_false,
310: x_collection_id => l_collection_id,
311: x_occurrence => l_temp_occurence,
312: x_row_elements => l_elements,
313: x_msg_count => x_msg_count,
318: x_action_result => l_action_result
319: );
320:
321: IF
322: x_return_status <> fnd_api.g_ret_sts_success
323: THEN
324: raise eaot_api_call_error;
325: END IF;
326:
335:
336:
337: EAM_ASSET_LOG_PVT.INSERT_ROW(
338: p_api_version => 1.0,
339: p_init_msg_list => fnd_api.g_true,
340: p_commit => fnd_api.g_false,
341: p_event_date => p_txn_date,
342: p_event_type => 'EAM_SYSTEM_EVENTS',
343: p_event_id => 12,
336:
337: EAM_ASSET_LOG_PVT.INSERT_ROW(
338: p_api_version => 1.0,
339: p_init_msg_list => fnd_api.g_true,
340: p_commit => fnd_api.g_false,
341: p_event_date => p_txn_date,
342: p_event_type => 'EAM_SYSTEM_EVENTS',
343: p_event_id => 12,
344: p_instance_id => p_instance_id,
357: null;
358: END;
359:
360: IF
361: x_return_status <> fnd_api.g_ret_sts_success
362: THEN
363: raise eaot_api_call_error;
364: END IF;
365:
427: , name => 'EAM_WC_QA_REMAIN'
428: );
429:
430: fnd_msg_pub.add;
431: x_return_status:= fnd_api.g_ret_sts_error;
432:
433: fnd_msg_pub.count_and_get(
434: p_count => x_msg_count
435: ,p_data => x_msg_data
437: raise eaot_api_call_error;
438: END IF;
439:
440: IF
441: x_return_status <> fnd_api.g_ret_sts_success
442: THEN
443: raise eaot_api_call_error;
444: END IF;
445:
581: END IF;
582: END LOOP;
583:
584: IF
585: x_return_status <> fnd_api.g_ret_sts_success
586: THEN
587: raise eaot_api_call_error;
588: END IF;
589: EXCEPTION
596:
597: PROCEDURE validate_txn(
598:
599: p_api_version IN number := 1.0,
600: p_init_msg_list IN varchar2 := fnd_api.g_false,
601: p_validation_level IN number := fnd_api.g_valid_level_full,
602: p_txn_date IN date := sysdate,
603: p_txn_type IN number,
604: p_instance_id IN number,
597: PROCEDURE validate_txn(
598:
599: p_api_version IN number := 1.0,
600: p_init_msg_list IN varchar2 := fnd_api.g_false,
601: p_validation_level IN number := fnd_api.g_valid_level_full,
602: p_txn_date IN date := sysdate,
603: p_txn_type IN number,
604: p_instance_id IN number,
605: p_operable_flag IN number,
626: -- Standard Start of API savepoint
627: SAVEPOINT EAM_ASSET_OPERATION_TXN_PVT_SV;
628: -- Standard call to check for call compatibility.
629:
630: IF NOT fnd_api.compatible_api_call(
631: l_api_version
632: ,p_api_version
633: ,l_api_name
634: ,g_pkg_name) THEN
632: ,p_api_version
633: ,l_api_name
634: ,g_pkg_name) THEN
635:
636: RAISE fnd_api.g_exc_unexpected_error;
637:
638: END IF;
639:
640: IF fnd_api.to_boolean(p_init_msg_list) THEN
636: RAISE fnd_api.g_exc_unexpected_error;
637:
638: END IF;
639:
640: IF fnd_api.to_boolean(p_init_msg_list) THEN
641: fnd_msg_pub.initialize;
642: END IF;
643:
644: -- Initialize API return status to success
642: END IF;
643:
644: -- Initialize API return status to success
645:
646: x_return_status := fnd_api.g_ret_sts_success;
647:
648:
649: -- API body
650:
663: , name => 'EAM_EVENT_DATE_INVALID'
664: );
665:
666: fnd_msg_pub.add;
667: x_return_status:= fnd_api.g_ret_sts_error;
668:
669: fnd_msg_pub.count_and_get(
670: p_count => x_msg_count
671: ,p_data => x_msg_data
692: , name => 'EAM_INSTANCE_ID_INVALID'
693: );
694:
695: fnd_msg_pub.add;
696: x_return_status:= fnd_api.g_ret_sts_error;
697:
698: fnd_msg_pub.count_and_get(
699: p_count => x_msg_count
700: ,p_data => x_msg_data
719: , name => 'EAM_USER_INVALID'
720: );
721:
722: fnd_msg_pub.add;
723: x_return_status:= fnd_api.g_ret_sts_error;
724:
725: fnd_msg_pub.count_and_get(
726: p_count => x_msg_count
727: ,p_data => x_msg_data
748: , name => 'EAM_TXNTYPE_INVALID'
749: );
750:
751: fnd_msg_pub.add;
752: x_return_status:= fnd_api.g_ret_sts_error;
753:
754: fnd_msg_pub.count_and_get(
755: p_count => x_msg_count
756: ,p_data => x_msg_data
766: , name => 'EAM_TXNTYPE_INVALID'
767: );
768:
769: fnd_msg_pub.add;
770: x_return_status:= fnd_api.g_ret_sts_error;
771:
772: fnd_msg_pub.count_and_get(
773: p_count => x_msg_count
774: ,p_data => x_msg_data
798: , name => 'EAM_OPERABLE_INVALID'
799: );
800:
801: fnd_msg_pub.add;
802: x_return_status:= fnd_api.g_ret_sts_error;
803:
804: fnd_msg_pub.count_and_get(
805: p_count => x_msg_count
806: ,p_data => x_msg_data
818: ,p_data => x_msg_data);
819:
820: EXCEPTION
821:
822: WHEN fnd_api.g_exc_error THEN
823: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT_SV;
824: x_return_status := fnd_api.g_ret_sts_error;
825: fnd_msg_pub.count_and_get(
826: p_count => x_msg_count
820: EXCEPTION
821:
822: WHEN fnd_api.g_exc_error THEN
823: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT_SV;
824: x_return_status := fnd_api.g_ret_sts_error;
825: fnd_msg_pub.count_and_get(
826: p_count => x_msg_count
827: ,p_data => x_msg_data);
828:
825: fnd_msg_pub.count_and_get(
826: p_count => x_msg_count
827: ,p_data => x_msg_data);
828:
829: WHEN fnd_api.g_exc_unexpected_error THEN
830: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT_SV;
831: x_return_status := fnd_api.g_ret_sts_unexp_error;
832: fnd_msg_pub.count_and_get(
833: p_count => x_msg_count
827: ,p_data => x_msg_data);
828:
829: WHEN fnd_api.g_exc_unexpected_error THEN
830: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT_SV;
831: x_return_status := fnd_api.g_ret_sts_unexp_error;
832: fnd_msg_pub.count_and_get(
833: p_count => x_msg_count
834: ,p_data => x_msg_data);
835:
835:
836: WHEN OTHERS THEN
837:
838: ROLLBACK TO EAM_ASSET_OPERATION_TXN_PVT_SV;
839: x_return_status := fnd_api.g_ret_sts_unexp_error;
840: IF fnd_msg_pub.check_msg_level(
841: fnd_msg_pub.g_msg_lvl_unexp_error) THEN
842: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
843: END IF;
851:
852: PROCEDURE insert_txn(
853:
854: p_api_version IN number := 1.0,
855: p_init_msg_list IN varchar2 := fnd_api.g_false,
856: p_commit IN varchar2 := fnd_api.g_false,
857: p_validation_level IN number := fnd_api.g_valid_level_full,
858: p_txn_date IN date := sysdate,
859: p_txn_type IN number,
852: PROCEDURE insert_txn(
853:
854: p_api_version IN number := 1.0,
855: p_init_msg_list IN varchar2 := fnd_api.g_false,
856: p_commit IN varchar2 := fnd_api.g_false,
857: p_validation_level IN number := fnd_api.g_valid_level_full,
858: p_txn_date IN date := sysdate,
859: p_txn_type IN number,
860: p_instance_id IN number,
853:
854: p_api_version IN number := 1.0,
855: p_init_msg_list IN varchar2 := fnd_api.g_false,
856: p_commit IN varchar2 := fnd_api.g_false,
857: p_validation_level IN number := fnd_api.g_valid_level_full,
858: p_txn_date IN date := sysdate,
859: p_txn_type IN number,
860: p_instance_id IN number,
861: p_comments IN varchar2 := NULL,
952: -- Standard Start of API savepoint
953: SAVEPOINT EAOT_INSERT_TXN;
954:
955: -- Standard call to check for call compatibility.
956: IF NOT fnd_api.compatible_api_call(
957: l_api_version
958: ,p_api_version
959: ,l_api_name
960: ,g_pkg_name) THEN
957: l_api_version
958: ,p_api_version
959: ,l_api_name
960: ,g_pkg_name) THEN
961: RAISE fnd_api.g_exc_unexpected_error;
962: END IF;
963:
964: IF fnd_api.to_boolean(p_init_msg_list) THEN
965: fnd_msg_pub.initialize;
960: ,g_pkg_name) THEN
961: RAISE fnd_api.g_exc_unexpected_error;
962: END IF;
963:
964: IF fnd_api.to_boolean(p_init_msg_list) THEN
965: fnd_msg_pub.initialize;
966: END IF;
967:
968: x_return_status := fnd_api.g_ret_sts_success;
964: IF fnd_api.to_boolean(p_init_msg_list) THEN
965: fnd_msg_pub.initialize;
966: END IF;
967:
968: x_return_status := fnd_api.g_ret_sts_success;
969:
970: --api body
971: --generate txnid from sequence
972: SELECT
1028:
1029:
1030:
1031: IF
1032: x_return_status <> fnd_api.g_ret_sts_success
1033:
1034: THEN
1035: raise eaot_api_call_error;
1036: END IF;
1056: ,x_msg_count => x_msg_count
1057: ,x_msg_data => x_msg_data
1058:
1059: );
1060: IF x_return_status <> fnd_api.g_ret_sts_success
1061: THEN
1062: raise eaot_api_call_error;
1063: END IF;
1064: END IF;
1063: END IF;
1064: END IF;
1065:
1066:
1067: IF p_meter_reading_rec_tbl.COUNT>0 AND x_return_status = fnd_api.g_ret_sts_success THEN
1068:
1069: insert_meter_readings(
1070: p_eam_meter_reading_tbl => p_meter_reading_rec_tbl
1071: ,p_counter_properties_tbl => p_counter_properties_tbl
1075: ,x_msg_count => x_msg_count
1076: ,x_msg_data => x_msg_data
1077: );
1078:
1079: IF x_return_status <> fnd_api.g_ret_sts_success
1080: THEN
1081: raise eaot_api_call_error;
1082: END IF;
1083: END IF;
1253: , name => 'EAM_WC_QA_REMAIN'
1254: );
1255:
1256: fnd_msg_pub.add;
1257: x_return_status:= fnd_api.g_ret_sts_error;
1258:
1259: fnd_msg_pub.count_and_get(
1260: p_count => x_msg_count
1261: ,p_data => x_msg_data
1324: END IF;
1325:
1326:
1327:
1328: IF x_return_status <> fnd_api.g_ret_sts_success
1329: THEN
1330: raise eaot_api_call_error;
1331: END IF;
1332: --call the assetlog api to log the checkin/out event
1351: x_return_status => l_assetops_return_status,
1352: x_msg_count => x_msg_count,
1353: x_msg_data => x_msg_data
1354: );
1355: IF x_return_status <> fnd_api.g_ret_sts_success
1356: THEN
1357: raise eaot_api_call_error;
1358: END IF;
1359: -- call csi update api to update checkin_status flag of the current instance
1418: l_txn_rec.split_reason_code := '';
1419:
1420:
1421: -- call csi update api
1422: IF x_return_status <> fnd_api.g_ret_sts_success
1423: THEN
1424: raise eaot_api_call_error;
1425: END IF;
1426:
1426:
1427: csi_item_instance_pub.update_item_instance
1428: (
1429: p_api_version => 1.0
1430: ,p_commit => fnd_api.g_false
1431: ,p_init_msg_list => fnd_api.g_false
1432: ,p_validation_level => fnd_api.g_valid_level_full
1433: ,p_instance_rec => l_instance_rec
1434: ,p_ext_attrib_values_tbl => l_ext_attrib_values_tbl
1427: csi_item_instance_pub.update_item_instance
1428: (
1429: p_api_version => 1.0
1430: ,p_commit => fnd_api.g_false
1431: ,p_init_msg_list => fnd_api.g_false
1432: ,p_validation_level => fnd_api.g_valid_level_full
1433: ,p_instance_rec => l_instance_rec
1434: ,p_ext_attrib_values_tbl => l_ext_attrib_values_tbl
1435: ,p_party_tbl => l_party_tbl
1428: (
1429: p_api_version => 1.0
1430: ,p_commit => fnd_api.g_false
1431: ,p_init_msg_list => fnd_api.g_false
1432: ,p_validation_level => fnd_api.g_valid_level_full
1433: ,p_instance_rec => l_instance_rec
1434: ,p_ext_attrib_values_tbl => l_ext_attrib_values_tbl
1435: ,p_party_tbl => l_party_tbl
1436: ,p_account_tbl => l_account_tbl
1444: ,x_msg_data => x_msg_data
1445: );
1446:
1447:
1448: IF x_return_status <> fnd_api.g_ret_sts_success
1449: THEN
1450: raise eaot_api_call_error;
1451: END IF;
1452: -- End of API body.
1450: raise eaot_api_call_error;
1451: END IF;
1452: -- End of API body.
1453: -- Standard check of p_commit.
1454: IF fnd_api.to_boolean(p_commit) THEN
1455: COMMIT WORK;
1456: END IF;
1457: fnd_msg_pub.count_and_get(
1458: p_count => x_msg_count
1457: fnd_msg_pub.count_and_get(
1458: p_count => x_msg_count
1459: ,p_data => x_msg_data);
1460: EXCEPTION
1461: WHEN fnd_api.g_exc_error THEN
1462: ROLLBACK TO EAOT_INSERT_TXN;
1463: x_return_status := fnd_api.g_ret_sts_error;
1464: fnd_msg_pub.count_and_get(
1465: p_count => x_msg_count
1459: ,p_data => x_msg_data);
1460: EXCEPTION
1461: WHEN fnd_api.g_exc_error THEN
1462: ROLLBACK TO EAOT_INSERT_TXN;
1463: x_return_status := fnd_api.g_ret_sts_error;
1464: fnd_msg_pub.count_and_get(
1465: p_count => x_msg_count
1466: ,p_data => x_msg_data);
1467: WHEN fnd_api.g_exc_unexpected_error THEN
1463: x_return_status := fnd_api.g_ret_sts_error;
1464: fnd_msg_pub.count_and_get(
1465: p_count => x_msg_count
1466: ,p_data => x_msg_data);
1467: WHEN fnd_api.g_exc_unexpected_error THEN
1468: ROLLBACK TO EAOT_INSERT_TXN;
1469: x_return_status := fnd_api.g_ret_sts_unexp_error;
1470: fnd_msg_pub.count_and_get(
1471: p_count => x_msg_count
1465: p_count => x_msg_count
1466: ,p_data => x_msg_data);
1467: WHEN fnd_api.g_exc_unexpected_error THEN
1468: ROLLBACK TO EAOT_INSERT_TXN;
1469: x_return_status := fnd_api.g_ret_sts_unexp_error;
1470: fnd_msg_pub.count_and_get(
1471: p_count => x_msg_count
1472: ,p_data => x_msg_data);
1473: WHEN eaot_api_call_error THEN
1473: WHEN eaot_api_call_error THEN
1474: ROLLBACK TO EAOT_INSERT_TXN;
1475: WHEN eaot_api_desc_error THEN
1476: ROLLBACK TO EAOT_INSERT_TXN;
1477: x_return_status := fnd_api.g_ret_sts_error;
1478: WHEN OTHERS THEN
1479: ROLLBACK TO EAOT_INSERT_TXN;
1480: x_return_status := fnd_api.g_ret_sts_unexp_error;
1481:
1476: ROLLBACK TO EAOT_INSERT_TXN;
1477: x_return_status := fnd_api.g_ret_sts_error;
1478: WHEN OTHERS THEN
1479: ROLLBACK TO EAOT_INSERT_TXN;
1480: x_return_status := fnd_api.g_ret_sts_unexp_error;
1481:
1482: IF fnd_msg_pub.check_msg_level(
1483: fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1484: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);