94: PROCEDURE log_messages(log_msg_flag IN VARCHAR2 DEFAULT '',
95: p_transaction_number IN VARCHAR2 DEFAULT '',
96: p_contract_number IN VARCHAR2 DEFAULT '',
97: p_asset_number IN VARCHAR2 DEFAULT '',
98: p_date_effective IN DATE DEFAULT OKC_API.G_MISS_DATE,
99: p_quote_type IN VARCHAR2 DEFAULT '',
100: p_quote_reason IN VARCHAR2 DEFAULT '',
101: p_quote_number IN NUMBER DEFAULT OKC_API.G_MISS_NUM,
102: msg_tbl IN msg_tbl_type
97: p_asset_number IN VARCHAR2 DEFAULT '',
98: p_date_effective IN DATE DEFAULT OKC_API.G_MISS_DATE,
99: p_quote_type IN VARCHAR2 DEFAULT '',
100: p_quote_reason IN VARCHAR2 DEFAULT '',
101: p_quote_number IN NUMBER DEFAULT OKC_API.G_MISS_NUM,
102: msg_tbl IN msg_tbl_type
103: ) IS
104: val_count NUMBER := 0;
105: err_count NUMBER := 0;
461: END IF;
462: EXCEPTION
463: WHEN OTHERS THEN
464: -- store SQL error message on message stack for caller
465: OKC_API.set_message(p_app_name => g_app_name,
466: p_msg_name => g_unexpected_error,
467: p_token1 => g_sqlcode_token,
468: p_token1_value => sqlcode,
469: p_token2 => g_sqlerrm_token,
516: l_code NUMBER := 0;
517: lp_tif_tbl tif_tbl_type;
518: l_msg_tbl msg_tbl_type;
519: BEGIN
520: x_return_status := OKC_API.G_RET_STS_SUCCESS;
521: lp_tif_tbl := p_tif_tbl;
522: IF(lp_tif_tbl.COUNT>0) THEN
523: --loops through the interface table records to populate WHO_columns
524: FOR record_number IN lp_tif_tbl.FIRST..lp_tif_tbl.LAST
545: LOOP
546: IF(lp_tif_tbl(record_number).quote_type_code = l_quote_type) THEN
547: -- quote type entered is invalid
548: lp_tif_tbl(record_number).status := 'ERROR';
549: OKC_API.set_message(p_app_name => g_app_name,
550: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
551: p_token1 => 'COL_NAME',
552: p_token1_value => 'QUOTE_TYPE_CODE');
553: l_msg_tbl(0).msg_text := 'quote type: '||l_quote_type||' entered for transaction number: '||lp_tif_tbl(record_number).transaction_number ||' is not valid ';
569: LOOP
570: IF(lp_tif_tbl(record_number).quote_type_code LIKE 'TER_MAN%') THEN
571: --manual quotes are not allowed
572: lp_tif_tbl(record_number).status := 'ERROR';
573: OKC_API.set_message(p_app_name => g_app_name,
574: p_msg_name => 'OKL_AM_MAN_QUOTE_TYPE',
575: p_token1 => 'TRANSACTION NUMBER',
576: p_token1_value => lp_tif_tbl(record_number).transaction_number);
577: l_msg_tbl(0).msg_text := 'manual quotes not allowed for transaction number '||lp_tif_tbl(record_number).transaction_number;
587: ELSIF(lp_tif_tbl(record_number).quote_type_code = 'TER_RELASE_WO_PURCHASE')
588: THEN
589: -- Release quotes are not allowed
590: lp_tif_tbl(record_number).status := 'ERROR';
591: OKC_API.set_message(p_app_name => g_app_name,
592: p_msg_name => 'OKL_AM_TER_INTF_RELEASE_QTE');
593: l_msg_tbl(0).msg_text := 'Creation of Release quote is not allowed for termination interface';
594: log_messages(log_msg_flag => 'V',
595: p_transaction_number => lp_tif_tbl(record_number).transaction_number,
624: LOOP
625: IF(lp_tif_tbl(record_number).quote_reason_code = l_quote_reason) THEN
626: -- quote reason entered is invalid
627: lp_tif_tbl(record_number).status := 'ERROR';
628: OKC_API.set_message(p_app_name => g_app_name,
629: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
630: p_token1 => 'COL_NAME',
631: p_token1_value => 'QUOTE_REASON_CODE');
632: l_msg_tbl(0).msg_text := 'quote reason '||l_quote_reason||' entered for transaction number '||lp_tif_tbl(record_number).transaction_number ||' is not valid ';
646: x_tif_tbl := lp_tif_tbl;
647: EXCEPTION
648: WHEN OTHERS THEN
649: -- store SQL error message on message stack for caller
650: OKC_API.set_message(p_app_name => g_app_name,
651: p_msg_name => g_unexpected_error,
652: p_token1 => g_sqlcode_token,
653: p_token1_value => sqlcode,
654: p_token2 => g_sqlerrm_token,
652: p_token1 => g_sqlcode_token,
653: p_token1_value => sqlcode,
654: p_token2 => g_sqlerrm_token,
655: p_token2_value => sqlerrm);
656: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
657: l_msg_tbl(0).msg_text := 'validate_quote_type_and_reason: ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
658: log_messages(log_msg_flag => 'V',
659: msg_tbl => l_msg_tbl );
660: END validate_quote_type_and_reason;
684: message VARCHAR2(200);
685: l_msg_tbl msg_tbl_type;
686: BEGIN
687: x_tif_rec := p_tif_rec;
688: x_return_status := OKC_API.G_RET_STS_SUCCESS;
689: --checks whether asset id or asset number entered or not
690: IF((p_tif_rec.asset_id IS NULL) OR (p_tif_rec.asset_id = OKC_API.G_MISS_NUM)) THEN
691: IF((p_tif_rec.asset_number IS NULL) OR (p_tif_rec.asset_number = OKC_API.G_MISS_CHAR)) THEN
692: x_tif_rec.status := 'ERROR';
686: BEGIN
687: x_tif_rec := p_tif_rec;
688: x_return_status := OKC_API.G_RET_STS_SUCCESS;
689: --checks whether asset id or asset number entered or not
690: IF((p_tif_rec.asset_id IS NULL) OR (p_tif_rec.asset_id = OKC_API.G_MISS_NUM)) THEN
691: IF((p_tif_rec.asset_number IS NULL) OR (p_tif_rec.asset_number = OKC_API.G_MISS_CHAR)) THEN
692: x_tif_rec.status := 'ERROR';
693: OKC_API.set_message(p_app_name => g_app_name,
694: p_msg_name => 'OKC_AM_ASSET_REQUIRED',
687: x_tif_rec := p_tif_rec;
688: x_return_status := OKC_API.G_RET_STS_SUCCESS;
689: --checks whether asset id or asset number entered or not
690: IF((p_tif_rec.asset_id IS NULL) OR (p_tif_rec.asset_id = OKC_API.G_MISS_NUM)) THEN
691: IF((p_tif_rec.asset_number IS NULL) OR (p_tif_rec.asset_number = OKC_API.G_MISS_CHAR)) THEN
692: x_tif_rec.status := 'ERROR';
693: OKC_API.set_message(p_app_name => g_app_name,
694: p_msg_name => 'OKC_AM_ASSET_REQUIRED',
695: p_token1 => 'CONTRACT_NUMBER',
689: --checks whether asset id or asset number entered or not
690: IF((p_tif_rec.asset_id IS NULL) OR (p_tif_rec.asset_id = OKC_API.G_MISS_NUM)) THEN
691: IF((p_tif_rec.asset_number IS NULL) OR (p_tif_rec.asset_number = OKC_API.G_MISS_CHAR)) THEN
692: x_tif_rec.status := 'ERROR';
693: OKC_API.set_message(p_app_name => g_app_name,
694: p_msg_name => 'OKC_AM_ASSET_REQUIRED',
695: p_token1 => 'CONTRACT_NUMBER',
696: p_token1_value => p_tif_rec.contract_number);
697: message :='asset number and id not entered for contract_number '||p_tif_rec.contract_number;
699: END IF;
700: IF(x_tif_rec.status <> 'ERROR') THEN
701: /*checks whether asset is serialized or not and if serialized checks whether quantity is one or null
702: for non serialized assets checks whether quantity entered is greater than zero or not*/
703: IF((p_tif_rec.serial_number IS NOT NULL) AND (p_tif_rec.serial_number <> OKC_API.G_MISS_CHAR)) THEN
704: IF((p_tif_rec.units_to_terminate IS NOT NULL) AND (p_tif_rec.units_to_terminate <> OKC_API.G_MISS_NUM) AND (p_tif_rec.units_to_terminate <> 1)) THEN
705: x_tif_rec.status := 'ERROR';
706: OKC_API.set_message(p_app_name => g_app_name,
707: p_msg_name => 'OKL_AM_SER_ASSET_QTY',
700: IF(x_tif_rec.status <> 'ERROR') THEN
701: /*checks whether asset is serialized or not and if serialized checks whether quantity is one or null
702: for non serialized assets checks whether quantity entered is greater than zero or not*/
703: IF((p_tif_rec.serial_number IS NOT NULL) AND (p_tif_rec.serial_number <> OKC_API.G_MISS_CHAR)) THEN
704: IF((p_tif_rec.units_to_terminate IS NOT NULL) AND (p_tif_rec.units_to_terminate <> OKC_API.G_MISS_NUM) AND (p_tif_rec.units_to_terminate <> 1)) THEN
705: x_tif_rec.status := 'ERROR';
706: OKC_API.set_message(p_app_name => g_app_name,
707: p_msg_name => 'OKL_AM_SER_ASSET_QTY',
708: p_token1 => 'ASSET_NUMBER',
702: for non serialized assets checks whether quantity entered is greater than zero or not*/
703: IF((p_tif_rec.serial_number IS NOT NULL) AND (p_tif_rec.serial_number <> OKC_API.G_MISS_CHAR)) THEN
704: IF((p_tif_rec.units_to_terminate IS NOT NULL) AND (p_tif_rec.units_to_terminate <> OKC_API.G_MISS_NUM) AND (p_tif_rec.units_to_terminate <> 1)) THEN
705: x_tif_rec.status := 'ERROR';
706: OKC_API.set_message(p_app_name => g_app_name,
707: p_msg_name => 'OKL_AM_SER_ASSET_QTY',
708: p_token1 => 'ASSET_NUMBER',
709: p_token1_value => p_tif_rec.asset_number,
710: p_token2 => 'SERIAL_NUMBER',
714: ELSE
715: -- if asset quantity is less than 1
716: IF(p_tif_rec.units_to_terminate < 1) THEN
717: x_tif_rec.status := 'ERROR';
718: OKC_API.set_message(p_app_name => g_app_name,
719: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
720: p_token1 => 'COL_NAME',
721: p_token1_value => 'UNITS_TO_TERMINATE');
722: message :='asset '||p_tif_rec.asset_number||' '||p_tif_rec.asset_id||' can not have quantity less than one';
725: END IF;
726:
727: -- defaults date_effective_from to Sysdate if null and error out if past date entered.
728: IF(x_tif_rec.status <> 'ERROR') THEN
729: IF((p_tif_rec.date_effective_from IS NULL) OR (p_tif_rec.date_effective_from = OKC_API.G_MISS_DATE)) THEN
730: x_tif_rec.date_effective_from := p_sys_date;
731: --Bug 4136202 : Commented check for past date as this is now allowed (Effective dated termination impact)
732: /*ELSIF(p_tif_rec.date_effective_from < p_sys_date) THEN
733: x_tif_rec.status := 'ERROR';
730: x_tif_rec.date_effective_from := p_sys_date;
731: --Bug 4136202 : Commented check for past date as this is now allowed (Effective dated termination impact)
732: /*ELSIF(p_tif_rec.date_effective_from < p_sys_date) THEN
733: x_tif_rec.status := 'ERROR';
734: OKC_API.set_message(p_app_name => g_app_name,
735: p_msg_name => 'OKL_AM_DATE_EFF_FROM_PAST',
736: p_token1 => 'COL_NAME',
737: p_token1_value => 'DATE_EFFECTIVE_FROM');
738: message :='date_effective_from '||p_tif_rec.contract_number||' should not be a past date';*/
739: END IF;
740: END IF;
741: /* defaults the auto_accept_yn to 'N' */
742: IF(x_tif_rec.status <> 'ERROR')THEN
743: IF(x_tif_rec.auto_accept_yn IS NULL OR x_tif_rec.auto_accept_yn = OKC_API.G_MISS_CHAR)THEN
744: x_tif_rec.auto_accept_yn := 'N';
745: -- if some wrong charcter entered default it to 'N'
746: ELSIF(x_tif_rec.auto_accept_yn NOT IN ('Y','N')) THEN
747: x_tif_rec.auto_accept_yn := 'N';
766:
767: EXCEPTION
768: WHEN OTHERS THEN
769: -- store SQL error message on message stack for caller
770: OKC_API.set_message(p_app_name => g_app_name,
771: p_msg_name => g_unexpected_error,
772: p_token1 => g_sqlcode_token,
773: p_token1_value => sqlcode,
774: p_token2 => g_sqlerrm_token,
772: p_token1 => g_sqlcode_token,
773: p_token1_value => sqlcode,
774: p_token2 => g_sqlerrm_token,
775: p_token2_value => sqlerrm);
776: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
777: l_msg_tbl(0).msg_text := 'validate_required:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
778: log_messages(log_msg_flag => 'V',
779: msg_tbl => l_msg_tbl );
780: END validate_required;
865:
866: BEGIN
867: x_tif_rec := p_tif_rec;
868: x_tif_rec.status := 'WORKING';
869: x_return_status := OKC_API.G_RET_STS_SUCCESS;
870: -- fetching the contract_id,status using the cursor
871: FOR l_chr_dtl_csr IN get_chr_dtls_csr(p_chr_no => x_tif_rec.contract_number)
872: LOOP
873: l_contract_id := l_chr_dtl_csr.id;
874: l_contract_status := l_chr_dtl_csr.sts_code;
875: l_org_id := l_chr_dtl_csr.authoring_org_id;
876: END LOOP;
877: -- contract number entered not exists
878: IF(l_contract_id IS NULL OR l_contract_id = OKC_API.G_MISS_NUM) THEN
879: x_tif_rec.status := 'ERROR';
880: OKC_API.set_message(p_app_name => g_app_name,
881: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
882: p_token1 => 'COL_NAME',
876: END LOOP;
877: -- contract number entered not exists
878: IF(l_contract_id IS NULL OR l_contract_id = OKC_API.G_MISS_NUM) THEN
879: x_tif_rec.status := 'ERROR';
880: OKC_API.set_message(p_app_name => g_app_name,
881: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
882: p_token1 => 'COL_NAME',
883: p_token1_value => 'CONTRACT_NUMBER');
884: message :='contract_number '||x_tif_rec.contract_number||' entered not exists';
881: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
882: p_token1 => 'COL_NAME',
883: p_token1_value => 'CONTRACT_NUMBER');
884: message :='contract_number '||x_tif_rec.contract_number||' entered not exists';
885: ELSIF(x_tif_rec.contract_id IS NULL OR x_tif_rec.contract_id = OKC_API.G_MISS_NUM) THEN
886: x_tif_rec.contract_id := l_contract_id;
887: ELSIF(x_tif_rec.contract_id <> l_contract_id) THEN
888: x_tif_rec.status := 'ERROR';
889: -- contract_id and contract_number entered not matches
886: x_tif_rec.contract_id := l_contract_id;
887: ELSIF(x_tif_rec.contract_id <> l_contract_id) THEN
888: x_tif_rec.status := 'ERROR';
889: -- contract_id and contract_number entered not matches
890: OKC_API.set_message(p_app_name => g_app_name,
891: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
892: p_token1 => 'COL_NAME',
893: p_token1_value => 'CONTRACT_NUMBER');
894: message :='contract_number '||x_tif_rec.contract_number||' and contract_id '||x_tif_rec.contract_id ||' entered not matches';
896: IF(x_tif_rec.status <> 'ERROR' AND l_contract_status NOT IN('BOOKED','EVERGREEN')) THEN
897: x_tif_rec.status := 'ERROR';
898: -- contract status is not in BOOKED or EVERGREEN
899: -- this message is striked off in the DLD
900: OKC_API.set_message(p_app_name => g_app_name,
901: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
902: p_token1 => 'COL_NAME',
903: p_token1_value => 'CONTRACT_NUMBER');
904: message :='contract_number '||x_tif_rec.contract_number||' is not in booked state or in evergreen state';
919:
920: IF(l_count_asset >1) THEN
921: x_tif_rec.status := 'ERROR';
922: -- asset number and asset id not matches
923: OKC_API.set_message(p_app_name => g_app_name,
924: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
925: p_token1 => 'COL_NAME',
926: p_token1_value => 'ASSET_NUMBER');
927: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
924: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
925: p_token1 => 'COL_NAME',
926: p_token1_value => 'ASSET_NUMBER');
927: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
928: ELSIF(l_asset_id IS NULL OR l_asset_id = OKC_API.G_MISS_NUM) THEN
929: x_tif_rec.status := 'ERROR';
930: -- asset is not associated to contract
931: OKC_API.set_message(p_app_name => g_app_name,
932: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
927: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
928: ELSIF(l_asset_id IS NULL OR l_asset_id = OKC_API.G_MISS_NUM) THEN
929: x_tif_rec.status := 'ERROR';
930: -- asset is not associated to contract
931: OKC_API.set_message(p_app_name => g_app_name,
932: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
933: p_token1 => 'COL_NAME',
934: p_token1_value => 'ASSET_NUMBER');
935: message :='asset is not associated to the contract_number '||x_tif_rec.contract_number||' entered';
932: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
933: p_token1 => 'COL_NAME',
934: p_token1_value => 'ASSET_NUMBER');
935: message :='asset is not associated to the contract_number '||x_tif_rec.contract_number||' entered';
936: ELSIF(l_asset_number IS NULL OR l_asset_number = OKC_API.G_MISS_CHAR) THEN
937: x_tif_rec.status := 'ERROR';
938: -- asset is not associated to contract
939: OKC_API.set_message(p_app_name => g_app_name,
940: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
935: message :='asset is not associated to the contract_number '||x_tif_rec.contract_number||' entered';
936: ELSIF(l_asset_number IS NULL OR l_asset_number = OKC_API.G_MISS_CHAR) THEN
937: x_tif_rec.status := 'ERROR';
938: -- asset is not associated to contract
939: OKC_API.set_message(p_app_name => g_app_name,
940: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
941: p_token1 => 'COL_NAME',
942: p_token1_value => 'ASSET_NUMBER');
943: message :='asset is not associated to the contract_number '||x_tif_rec.contract_number||' entered';
940: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
941: p_token1 => 'COL_NAME',
942: p_token1_value => 'ASSET_NUMBER');
943: message :='asset is not associated to the contract_number '||x_tif_rec.contract_number||' entered';
944: ELSIF(p_tif_rec.asset_number IS NOT NULL AND p_tif_rec.asset_number <> OKC_API.G_MISS_CHAR) THEN
945: IF(p_tif_rec.asset_number <> l_asset_number) THEN
946: x_tif_rec.status := 'ERROR';
947: -- asset id and asset number entered not matches
948: OKC_API.set_message(p_app_name => g_app_name,
944: ELSIF(p_tif_rec.asset_number IS NOT NULL AND p_tif_rec.asset_number <> OKC_API.G_MISS_CHAR) THEN
945: IF(p_tif_rec.asset_number <> l_asset_number) THEN
946: x_tif_rec.status := 'ERROR';
947: -- asset id and asset number entered not matches
948: OKC_API.set_message(p_app_name => g_app_name,
949: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
950: p_token1 => 'COL_NAME',
951: p_token1_value => 'ASSET_NUMBER');
952: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
949: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
950: p_token1 => 'COL_NAME',
951: p_token1_value => 'ASSET_NUMBER');
952: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
953: ELSIF(p_tif_rec.asset_id IS NOT NULL AND p_tif_rec.asset_id <> OKC_API.G_MISS_NUM) THEN
954: IF(p_tif_rec.asset_id <> l_asset_id) THEN
955: x_tif_rec.status := 'ERROR';
956: -- asset id and asset number entered not matches
957: OKC_API.set_message(p_app_name => g_app_name,
953: ELSIF(p_tif_rec.asset_id IS NOT NULL AND p_tif_rec.asset_id <> OKC_API.G_MISS_NUM) THEN
954: IF(p_tif_rec.asset_id <> l_asset_id) THEN
955: x_tif_rec.status := 'ERROR';
956: -- asset id and asset number entered not matches
957: OKC_API.set_message(p_app_name => g_app_name,
958: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
959: p_token1 => 'COL_NAME',
960: p_token1_value => 'ASSET_NUMBER');
961: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
962: END IF;
963: ELSE
964: x_tif_rec.asset_id := l_asset_id;
965: END IF;
966: ELSIF(p_tif_rec.asset_id IS NOT NULL AND p_tif_rec.asset_id <> OKC_API.G_MISS_NUM) THEN
967: IF(p_tif_rec.asset_id <> l_asset_id) THEN
968: x_tif_rec.status := 'ERROR';
969: -- asset id and asset number entered not matches
970: OKC_API.set_message(p_app_name => g_app_name,
966: ELSIF(p_tif_rec.asset_id IS NOT NULL AND p_tif_rec.asset_id <> OKC_API.G_MISS_NUM) THEN
967: IF(p_tif_rec.asset_id <> l_asset_id) THEN
968: x_tif_rec.status := 'ERROR';
969: -- asset id and asset number entered not matches
970: OKC_API.set_message(p_app_name => g_app_name,
971: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
972: p_token1 => 'COL_NAME',
973: p_token1_value => 'ASSET_NUMBER');
974: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
971: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
972: p_token1 => 'COL_NAME',
973: p_token1_value => 'ASSET_NUMBER');
974: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
975: ELSIF(p_tif_rec.asset_number IS NOT NULL AND p_tif_rec.asset_number <> OKC_API.G_MISS_CHAR) THEN
976: IF(p_tif_rec.asset_number <> l_asset_number) THEN
977: x_tif_rec.status := 'ERROR';
978: -- asset id and asset number entered not matches
979: OKC_API.set_message(p_app_name => g_app_name,
975: ELSIF(p_tif_rec.asset_number IS NOT NULL AND p_tif_rec.asset_number <> OKC_API.G_MISS_CHAR) THEN
976: IF(p_tif_rec.asset_number <> l_asset_number) THEN
977: x_tif_rec.status := 'ERROR';
978: -- asset id and asset number entered not matches
979: OKC_API.set_message(p_app_name => g_app_name,
980: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
981: p_token1 => 'COL_NAME',
982: p_token1_value => 'ASSET_NUMBER');
983: message :='asset_number '||x_tif_rec.asset_number||' and asset_id '||x_tif_rec.asset_id ||' entered not matches';
987: END IF;
988: ELSIF(l_asset_status NOT IN('BOOKED','EVERGREEN')) THEN
989: x_tif_rec.status := 'ERROR';
990: -- asset status is not in BOOKED or EVERGREEN
991: OKC_API.set_message(p_app_name => g_app_name,
992: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
993: p_token1 => 'COL_NAME',
994: p_token1_value => 'ASSET_NUMBER');
995: message :='asset_number '||x_tif_rec.asset_number||' is not in booked state or in evergreen state';
994: p_token1_value => 'ASSET_NUMBER');
995: message :='asset_number '||x_tif_rec.asset_number||' is not in booked state or in evergreen state';
996: END IF;
997: IF(x_tif_rec.status <> 'ERROR') THEN
998: IF(x_tif_rec.serial_number IS NOT NULL AND x_tif_rec.serial_number <> OKC_API.G_MISS_CHAR) THEN
999: x_tif_rec.status := 'ENTERED';
1000: --fetching instance_id using cursor
1001: FOR l_instance_id_csr IN get_instance_id_csr(p_ast_id => x_tif_rec.asset_id)
1002: LOOP
1000: --fetching instance_id using cursor
1001: FOR l_instance_id_csr IN get_instance_id_csr(p_ast_id => x_tif_rec.asset_id)
1002: LOOP
1003: l_instance_id := l_instance_id_csr.id;
1004: IF(l_instance_id IS NULL OR l_instance_id = OKC_API.G_MISS_NUM) THEN
1005: x_tif_rec.status := 'ERROR';
1006: -- instance line not present for the asset
1007: OKC_API.set_message(p_app_name => g_app_name,
1008: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
1003: l_instance_id := l_instance_id_csr.id;
1004: IF(l_instance_id IS NULL OR l_instance_id = OKC_API.G_MISS_NUM) THEN
1005: x_tif_rec.status := 'ERROR';
1006: -- instance line not present for the asset
1007: OKC_API.set_message(p_app_name => g_app_name,
1008: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
1009: p_token1 => 'COL_NAME',
1010: p_token1_value => 'SERIAL_NUMBER');
1011: message :='instance line is not present for the asset '||x_tif_rec.asset_number;
1014: FOR l_installbase_id_csr IN get_installbase_id_csr(p_instance_id => l_instance_id)
1015: LOOP
1016: l_installbase_id := l_installbase_id_csr.id;
1017: END LOOP;
1018: IF(l_installbase_id IS NULL OR l_installbase_id = OKC_API.G_MISS_NUM) THEN
1019: x_tif_rec.status := 'ERROR';
1020: -- installbase has no entries for the instance
1021: OKC_API.set_message(p_app_name => g_app_name,
1022: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
1017: END LOOP;
1018: IF(l_installbase_id IS NULL OR l_installbase_id = OKC_API.G_MISS_NUM) THEN
1019: x_tif_rec.status := 'ERROR';
1020: -- installbase has no entries for the instance
1021: OKC_API.set_message(p_app_name => g_app_name,
1022: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
1023: p_token1 => 'COL_NAME',
1024: p_token1_value => 'SERIAL_NUMBER');
1025: message :='installbase line is not present for the asset '||x_tif_rec.asset_number;
1033: IF(l_serial_number = x_tif_rec.serial_number) THEN
1034: x_tif_rec.status := 'WORKING';
1035: x_tif_rec.units_to_terminate := 1;
1036: EXIT;
1037: ELSIF(l_serial_number IS NULL OR l_serial_number = OKC_API.G_MISS_CHAR) THEN
1038: x_tif_rec.status := 'ERROR';
1039: -- asset is not serialized
1040: OKC_API.set_message(p_app_name => g_app_name,
1041: p_msg_name => 'OKC_AM_NO_SERIALIZED_ASSET',
1036: EXIT;
1037: ELSIF(l_serial_number IS NULL OR l_serial_number = OKC_API.G_MISS_CHAR) THEN
1038: x_tif_rec.status := 'ERROR';
1039: -- asset is not serialized
1040: OKC_API.set_message(p_app_name => g_app_name,
1041: p_msg_name => 'OKC_AM_NO_SERIALIZED_ASSET',
1042: p_token1 => 'COL_NAME',
1043: p_token1_value => 'ASSET_NUMBER');
1044: message :='asset is not serialized '||x_tif_rec.asset_number;
1049: END LOOP;
1050: IF(x_tif_rec.status = 'ENTERED') THEN
1051: x_tif_rec.status := 'ERROR';
1052: -- enter serial number associated for this asset
1053: OKC_API.set_message(p_app_name => g_app_name,
1054: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
1055: p_token1 => 'COL_NAME',
1056: p_token1_value => 'SERIAL_NUMBER');
1057: message :='Enter serial number associated for this asset '||x_tif_rec.asset_number;
1064: END LOOP;
1065: IF(l_quantity < x_tif_rec.units_to_terminate) THEN
1066: x_tif_rec.status := 'ERROR';
1067: -- quantity entered is more than asset quantity
1068: OKC_API.set_message(p_app_name => g_app_name,
1069: p_msg_name => 'OKL_AM_INVALID_ASSET_QTY',
1070: p_token1 => 'ASSET_NUMBER',
1071: p_token1_value => x_tif_rec.asset_number);
1072: message :='no.of units entered to terminate is more than the quantity associated with asset '||x_tif_rec.asset_number;
1075: END IF; -- instance line
1076: END IF; -- asset if
1077: IF(x_tif_rec.status <> 'ERROR') THEN
1078: -- validate the session ORG_ID with the contract authoring_org_id, if org_id null then assign authoring_org_id
1079: IF((p_tif_rec.org_id IS NULL) OR (p_tif_rec.org_id = OKC_API.G_MISS_NUM)) THEN
1080: x_tif_rec.org_id := l_org_id;
1081: END IF;
1082: IF(x_tif_rec.org_id <> l_session_org_id) THEN
1083: x_tif_rec.status := 'ENTERED';
1081: END IF;
1082: IF(x_tif_rec.org_id <> l_session_org_id) THEN
1083: x_tif_rec.status := 'ENTERED';
1084: -- org_id not matches with session org_id so not processing it, but status remains in ENTERED
1085: OKC_API.set_message(p_app_name => g_app_name,
1086: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
1087: p_token1 => 'COL_NAME',
1088: p_token1_value => 'ORG_ID');
1089: message :='org id is not for this session, not errored out';
1103: IF p_tif_rec.quote_type_code LIKE 'TER_ROLL%'
1104: AND p_tif_rec.auto_accept_yn = 'Y'
1105: THEN
1106: x_tif_rec.status := 'ERROR';
1107: OKC_API.set_message(p_app_name => g_app_name,
1108: p_msg_name => 'OKL_NO_ACPT_ROLL_QTE');
1109: message := 'Rollover quotes can only be accepted from booking process of a rolled over contract';
1110: END IF;
1111: END IF;
1127: x_return_status => x_return_status);
1128: EXCEPTION
1129: WHEN OTHERS THEN
1130: -- store SQL error message on message stack for caller
1131: OKC_API.set_message(p_app_name => g_app_name,
1132: p_msg_name => g_unexpected_error,
1133: p_token1 => g_sqlcode_token,
1134: p_token1_value => sqlcode,
1135: p_token2 => g_sqlerrm_token,
1133: p_token1 => g_sqlcode_token,
1134: p_token1_value => sqlcode,
1135: p_token2 => g_sqlerrm_token,
1136: p_token2_value => sqlerrm);
1137: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1138: l_msg_tbl(0).msg_text := 'validate_data: ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
1139: log_messages(log_msg_flag => 'V',
1140: msg_tbl => l_msg_tbl );
1141: END validate_data;
1165: ) IS
1166: l_tif_rec tif_rec_type;
1167: l_msg_tbl msg_tbl_type;
1168: BEGIN
1169: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1170: -- this procedure checks whether required fields are entered or not
1171: validate_required(p_api_version => p_api_version,
1172: p_init_msg_list => OKC_API.G_FALSE,
1173: x_msg_count => x_msg_count,
1168: BEGIN
1169: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1170: -- this procedure checks whether required fields are entered or not
1171: validate_required(p_api_version => p_api_version,
1172: p_init_msg_list => OKC_API.G_FALSE,
1173: x_msg_count => x_msg_count,
1174: x_msg_data => x_msg_data,
1175: x_return_status => x_return_status,
1176: p_sys_date => p_sys_date,
1182: l_tif_rec := x_tif_rec;
1183: /*this procedure validates the data against the database and also
1184: populates the remaining columns */
1185: validate_data(p_api_version => p_api_version,
1186: p_init_msg_list => OKC_API.G_FALSE,
1187: x_msg_count => x_msg_count,
1188: x_msg_data => x_msg_data,
1189: x_return_status => x_return_status,
1190: p_tif_rec => l_tif_rec,
1193: END IF;
1194: EXCEPTION
1195: WHEN OTHERS THEN
1196: -- store SQL error message on message stack for caller
1197: OKC_API.set_message(p_app_name => g_app_name,
1198: p_msg_name => g_unexpected_error,
1199: p_token1 => g_sqlcode_token,
1200: p_token1_value => sqlcode,
1201: p_token2 => g_sqlerrm_token,
1199: p_token1 => g_sqlcode_token,
1200: p_token1_value => sqlcode,
1201: p_token2 => g_sqlerrm_token,
1202: p_token2_value => sqlerrm);
1203: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1204: l_msg_tbl(0).msg_text := 'validate_record: ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
1205: log_messages(log_msg_flag => 'V',
1206: msg_tbl => l_msg_tbl );
1207: END validate_record;
1233: record_number NUMBER;
1234: l_msg_tbl msg_tbl_type;
1235: BEGIN
1236: record_number:=0;
1237: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1238: IF (p_tif_tbl.COUNT > 0) THEN
1239: record_number := p_tif_tbl.FIRST;
1240: LOOP
1241: IF(p_tif_tbl(record_number).status <> 'ERROR') THEN
1240: LOOP
1241: IF(p_tif_tbl(record_number).status <> 'ERROR') THEN
1242: -- this procedure validates the record
1243: validate_record(p_api_version => p_api_version,
1244: p_init_msg_list => OKC_API.G_FALSE,
1245: x_msg_count => x_msg_count,
1246: x_msg_data => x_msg_data,
1247: x_return_status => x_return_status,
1248: p_sys_date => p_sys_date,
1257: END IF;
1258: EXCEPTION
1259: WHEN OTHERS THEN
1260: -- store SQL error message on message stack for caller
1261: OKC_API.set_message(p_app_name => g_app_name,
1262: p_msg_name => g_unexpected_error,
1263: p_token1 => g_sqlcode_token,
1264: p_token1_value => sqlcode,
1265: p_token2 => g_sqlerrm_token,
1263: p_token1 => g_sqlcode_token,
1264: p_token1_value => sqlcode,
1265: p_token2 => g_sqlerrm_token,
1266: p_token2_value => sqlerrm);
1267: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1268: l_msg_tbl(0).msg_text := 'validate_transaction:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
1269: log_messages(log_msg_flag => 'V',
1270: msg_tbl => l_msg_tbl );
1271: END validate_transaction;
1290: x_return_status OUT NOCOPY VARCHAR2,
1291: p_tif_rec IN tif_rec_type) IS
1292: l_api_version CONSTANT NUMBER := p_api_version;
1293: l_api_name CONSTANT VARCHAR2(30) := 'terminate_interface';
1294: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1295: l_msg_tbl msg_tbl_type;
1296: BEGIN
1297: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1298: --Check API version, initialize message list and create savepoint.
1293: l_api_name CONSTANT VARCHAR2(30) := 'terminate_interface';
1294: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1295: l_msg_tbl msg_tbl_type;
1296: BEGIN
1297: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1298: --Check API version, initialize message list and create savepoint.
1299: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1300: G_PKG_NAME,
1301: p_init_msg_list,
1295: l_msg_tbl msg_tbl_type;
1296: BEGIN
1297: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1298: --Check API version, initialize message list and create savepoint.
1299: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1300: G_PKG_NAME,
1301: p_init_msg_list,
1302: l_api_version,
1303: p_api_version,
1302: l_api_version,
1303: p_api_version,
1304: '_PVT',
1305: x_return_status);
1306: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1307: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1308: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1309: RAISE OKC_API.G_EXCEPTION_ERROR;
1310: END IF;
1303: p_api_version,
1304: '_PVT',
1305: x_return_status);
1306: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1307: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1308: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1309: RAISE OKC_API.G_EXCEPTION_ERROR;
1310: END IF;
1311:
1304: '_PVT',
1305: x_return_status);
1306: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1307: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1308: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1309: RAISE OKC_API.G_EXCEPTION_ERROR;
1310: END IF;
1311:
1312: UPDATE OKL_TERMNT_INTERFACE
1305: x_return_status);
1306: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1307: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1308: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1309: RAISE OKC_API.G_EXCEPTION_ERROR;
1310: END IF;
1311:
1312: UPDATE OKL_TERMNT_INTERFACE
1313: SET
1360: ,OKL_TERMNT_INTERFACE.LAST_UPDATE_LOGIN = FND_GLOBAL.LOGIN_ID
1361: ,OKL_TERMNT_INTERFACE.GROUP_NUMBER = p_tif_rec.group_number
1362: WHERE
1363: OKL_TERMNT_INTERFACE.ROWID =p_tif_rec.row_id;
1364: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1365:
1366: OKL_AM_UTIL_PVT.process_messages(p_trx_source_table => 'OKL_TERMNT_INTERFACE',
1367: p_trx_id => p_tif_rec.transaction_number,
1368: x_return_status => l_return_status);
1367: p_trx_id => p_tif_rec.transaction_number,
1368: x_return_status => l_return_status);
1369: x_return_status := l_return_status;
1370: EXCEPTION
1371: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1372: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
1373: G_PKG_NAME,
1374: 'OKC_API.G_RET_STS_ERROR',
1375: x_msg_count,
1368: x_return_status => l_return_status);
1369: x_return_status := l_return_status;
1370: EXCEPTION
1371: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1372: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
1373: G_PKG_NAME,
1374: 'OKC_API.G_RET_STS_ERROR',
1375: x_msg_count,
1376: x_msg_data,
1370: EXCEPTION
1371: WHEN OKC_API.G_EXCEPTION_ERROR THEN
1372: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
1373: G_PKG_NAME,
1374: 'OKC_API.G_RET_STS_ERROR',
1375: x_msg_count,
1376: x_msg_data,
1377: '_PVT');
1378: --unexpected error
1375: x_msg_count,
1376: x_msg_data,
1377: '_PVT');
1378: --unexpected error
1379: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1380: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
1381: G_PKG_NAME,
1382: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1383: x_msg_count,
1376: x_msg_data,
1377: '_PVT');
1378: --unexpected error
1379: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1380: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
1381: G_PKG_NAME,
1382: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1383: x_msg_count,
1384: x_msg_data,
1378: --unexpected error
1379: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1380: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
1381: G_PKG_NAME,
1382: 'OKC_API.G_RET_STS_UNEXP_ERROR',
1383: x_msg_count,
1384: x_msg_data,
1385: '_PVT');
1386: WHEN OTHERS THEN
1384: x_msg_data,
1385: '_PVT');
1386: WHEN OTHERS THEN
1387: -- store SQL error message on message stack for caller
1388: OKC_API.set_message(p_app_name => g_app_name,
1389: p_msg_name => g_unexpected_error,
1390: p_token1 => g_sqlcode_token,
1391: p_token1_value => sqlcode,
1392: p_token2 => g_sqlerrm_token,
1390: p_token1 => g_sqlcode_token,
1391: p_token1_value => sqlcode,
1392: p_token2 => g_sqlerrm_token,
1393: p_token2_value => sqlerrm);
1394: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1395: l_msg_tbl(0).msg_text := 'update_row:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
1396: log_messages(log_msg_flag => 'V',
1397: msg_tbl => l_msg_tbl );
1398: END update_row;
1476: WHERE status = p_status
1477: ORDER BY CONTRACT_NUMBER,QUOTE_TYPE_CODE,DATE_EFFECTIVE_FROM,QUOTE_REASON_CODE,ASSET_ID;
1478: BEGIN
1479: record_number:=0;
1480: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1481: IF (p_tif_tbl.COUNT > 0) THEN
1482: record_number := p_tif_tbl.FIRST;
1483: -- loops through the table of records to update the values
1484: LOOP
1482: record_number := p_tif_tbl.FIRST;
1483: -- loops through the table of records to update the values
1484: LOOP
1485: update_row(p_api_version => p_api_version
1486: ,p_init_msg_list => OKC_API.G_FALSE
1487: ,x_msg_data => x_msg_data
1488: ,x_msg_count => x_msg_count
1489: ,x_return_status => x_return_status
1490: ,p_tif_rec => p_tif_tbl(record_number));
1551:
1552: EXCEPTION
1553: WHEN OTHERS THEN
1554: -- store SQL error message on message stack for caller
1555: OKC_API.set_message(p_app_name => g_app_name,
1556: p_msg_name => g_unexpected_error,
1557: p_token1 => g_sqlcode_token,
1558: p_token1_value => sqlcode,
1559: p_token2 => g_sqlerrm_token,
1560: p_token2_value => sqlerrm);
1561: l_msg_tbl(0).msg_text := 'change_status:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
1562: log_messages(log_msg_flag => 'V',
1563: msg_tbl => l_msg_tbl );
1564: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1565: END change_status;
1566:
1567:
1568: -- Start of comments
1601: SELECT current_units quantity
1602: FROM OKX_ASSETS_V
1603: WHERE asset_number = p_asset_number;
1604: BEGIN
1605: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1606: IF(p_tif_tbl.COUNT>0)THEN
1607: -- updates the values in the tbl to database and retrives the data with status='WORKING'
1608: change_status(p_api_version => p_api_version,
1609: p_init_msg_list => OKC_API.G_FALSE,
1605: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1606: IF(p_tif_tbl.COUNT>0)THEN
1607: -- updates the values in the tbl to database and retrives the data with status='WORKING'
1608: change_status(p_api_version => p_api_version,
1609: p_init_msg_list => OKC_API.G_FALSE,
1610: x_msg_count => x_msg_count,
1611: x_msg_data => x_msg_data,
1612: x_return_status => x_return_status,
1613: p_tif_tbl => p_tif_tbl,
1612: x_return_status => x_return_status,
1613: p_tif_tbl => p_tif_tbl,
1614: x_tif_tbl => lp_tif_tbl);
1615: END IF;
1616: l_contract_id := OKC_API.G_MISS_NUM;
1617: IF(lp_tif_tbl.COUNT>0 AND x_return_status = FND_API.G_RET_STS_SUCCESS)THEN
1618: -- loops through the interface records
1619: FOR term_rec IN lp_tif_tbl.FIRST..lp_tif_tbl.LAST
1620: LOOP
1622: (lp_tif_tbl(term_rec).asset_id = l_asset_id) AND
1623: (lp_tif_tbl(term_rec).date_effective_from = l_date_effective_from) AND
1624: (lp_tif_tbl(term_rec).quote_type_code = l_quote_type) AND
1625: (lp_tif_tbl(term_rec).quote_reason_code = l_reason_type) )THEN
1626: IF(lp_tif_tbl(term_rec).serial_number IS NULL OR lp_tif_tbl(term_rec).serial_number = OKC_API.G_MISS_CHAR) THEN
1627: IF(l_asset_qty
1629: -- while grouping if quantity exceeds asset quantity those entries will be ERROR out
1630: OKC_API.set_message(p_app_name => g_app_name,
1626: IF(lp_tif_tbl(term_rec).serial_number IS NULL OR lp_tif_tbl(term_rec).serial_number = OKC_API.G_MISS_CHAR) THEN
1627: IF(l_asset_qty
1629: -- while grouping if quantity exceeds asset quantity those entries will be ERROR out
1630: OKC_API.set_message(p_app_name => g_app_name,
1631: p_msg_name => 'OKL_AM_INVALID_ASSET_QTY',
1632: p_token1 => 'COL_NAME',
1633: p_token1_value => 'ASSET_NUMBER');
1634: message :='quote quantity exceeds asset quantity for asset '||lp_tif_tbl(term_rec).asset_number||' for transaction_number '||lp_tif_tbl(term_rec).transaction_number;
1638: ELSIF(l_serial_number IS NOT NULL) THEN
1639: IF(l_serial_number = lp_tif_tbl(term_rec).serial_number)THEN
1640: lp_tif_tbl(term_rec).status := 'ERROR';
1641: -- if same serial_number is repeated in a group tthen ERROR out
1642: OKC_API.set_message(p_app_name => g_app_name,
1643: p_msg_name => 'OKL_AM_DUP_LINE',
1644: p_token1 => 'SERIAL_NUMBER',
1645: p_token1_value => lp_tif_tbl(term_rec).serial_number);
1646: message :='duplicate record for serialized asset '||lp_tif_tbl(term_rec).asset_number||' for transaction_number '||lp_tif_tbl(term_rec).transaction_number;
1646: message :='duplicate record for serialized asset '||lp_tif_tbl(term_rec).asset_number||' for transaction_number '||lp_tif_tbl(term_rec).transaction_number;
1647: ELSIF(l_asset_qty
1649: -- while grouping if quantity exceeds asset quantity those entries will be ERROR out
1650: OKC_API.set_message(p_app_name => g_app_name,
1651: p_msg_name => 'OKL_AM_INVALID_ASSET_QTY',
1652: p_token1 => 'COL_NAME',
1653: p_token1_value => 'ASSET_NUMBER');
1654: message :='quote quantity exceeds asset quantity for asset '||lp_tif_tbl(term_rec).asset_number||' for transaction_number '||lp_tif_tbl(term_rec).transaction_number;
1683: END IF;
1684: END LOOP;
1685: -- updates the values in database and gets records with status='WORKING'
1686: change_status(p_api_version => p_api_version,
1687: p_init_msg_list => OKC_API.G_FALSE,
1688: x_msg_count => x_msg_count,
1689: x_msg_data => x_msg_data,
1690: x_return_status => x_return_status,
1691: p_tif_tbl => lp_tif_tbl,
1694: END IF;
1695: EXCEPTION
1696: WHEN OTHERS THEN
1697: -- store SQL error message on message stack for caller
1698: OKC_API.set_message(p_app_name => g_app_name,
1699: p_msg_name => g_unexpected_error,
1700: p_token1 => g_sqlcode_token,
1701: p_token1_value => sqlcode,
1702: p_token2 => g_sqlerrm_token,
1700: p_token1 => g_sqlcode_token,
1701: p_token1_value => sqlcode,
1702: p_token2 => g_sqlerrm_token,
1703: p_token2_value => sqlerrm);
1704: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1705: l_msg_tbl(0).msg_text := 'remove_duplicates:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
1706: log_messages(log_msg_flag => 'V',
1707: msg_tbl => l_msg_tbl );
1708: END remove_duplicates;
1780: FROM okc_k_items_v okiv,okx_install_items_v oiiv
1781: WHERE okiv.cle_id = p_installbase_id
1782: AND okiv.object1_id1=oiiv.instance_id;
1783: BEGIN
1784: x_return_status := OKC_API.G_RET_STS_SUCCESS;
1785: x_tif_tbl := p_tif_tbl;
1786: lp_quot_rec := p_quot_rec;
1787: lp_assn_tbl := p_assn_tbl;
1788: lp_qpyv_tbl := p_qpyv_tbl;
1791: /* sysdate for date processed */
1792: SELECT trunc(SYSDATE) INTO l_sys_date FROM DUAL;
1793: /* calls the create_termination_quote API and retrives the quote_id */
1794: OKL_AM_CREATE_QUOTE_PUB.create_terminate_quote(p_api_version => p_api_version
1795: ,p_init_msg_list => OKC_API.G_FALSE
1796: ,x_msg_data => x_msg_data
1797: ,x_msg_count => x_msg_count
1798: ,x_return_status => l_return_status
1799: ,p_quot_rec => lp_quot_rec
1875: IF(batch_offset = p_record_number) THEN
1876: IF(lp_qld_tbl.COUNT>0) THEN
1877: -- calls the quote_line_dtls API to create quote line details for the serialized assets
1878: OKL_AM_TERMNT_QUOTE_PUB.quote_line_dtls(p_api_version => p_api_version,
1879: p_init_msg_list => OKC_API.G_FALSE,
1880: x_return_status => l_return_status,
1881: x_msg_count => x_msg_count,
1882: x_msg_data => x_msg_data,
1883: p_qld_tbl => lp_qld_tbl);
2028: END IF;
2029: EXCEPTION
2030: WHEN OTHERS THEN
2031: -- store SQL error message on message stack for caller
2032: OKC_API.set_message(p_app_name => g_app_name,
2033: p_msg_name => g_unexpected_error,
2034: p_token1 => g_sqlcode_token,
2035: p_token1_value => sqlcode,
2036: p_token2 => g_sqlerrm_token,
2034: p_token1 => g_sqlcode_token,
2035: p_token1_value => sqlcode,
2036: p_token2 => g_sqlerrm_token,
2037: p_token2_value => sqlerrm);
2038: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2039: l_msg_tbl(0).msg_text := 'create_quote:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
2040: log_messages(log_msg_flag => 'V',
2041: msg_tbl => l_msg_tbl );
2042: END create_quote;
2096: batch_offset := 0;
2097: group_number := p_group_number;
2098: lp_tif_tbl := p_tif_tbl;
2099: lx_tif_tbl := p_tif_tbl;
2100: l_contract_number := OKC_API.G_MISS_CHAR;
2101: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2102: IF(p_tif_tbl.COUNT>0) THEN
2103: FOR record_number IN p_tif_tbl.FIRST..p_tif_tbl.LAST LOOP
2104: -- checking the condition to separate the batches for quote creation
2097: group_number := p_group_number;
2098: lp_tif_tbl := p_tif_tbl;
2099: lx_tif_tbl := p_tif_tbl;
2100: l_contract_number := OKC_API.G_MISS_CHAR;
2101: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2102: IF(p_tif_tbl.COUNT>0) THEN
2103: FOR record_number IN p_tif_tbl.FIRST..p_tif_tbl.LAST LOOP
2104: -- checking the condition to separate the batches for quote creation
2105: IF(((l_contract_number <> p_tif_tbl(record_number).contract_number) OR
2114: lp_quot_rec.qtp_code := p_tif_tbl(record_number-1).quote_type_code;
2115: lp_quot_rec.qrs_code := p_tif_tbl(record_number-1).quote_reason_code;
2116: create_quote(
2117: p_api_version => p_api_version
2118: ,p_init_msg_list => OKC_API.G_FALSE
2119: ,x_msg_count => x_msg_count
2120: ,x_msg_data => x_msg_data
2121: ,x_return_status => x_return_status
2122: ,p_tif_tbl => lp_tif_tbl
2165: lp_quot_rec.org_id := p_tif_tbl(record_number).org_id;
2166: lp_quot_rec.qtp_code := p_tif_tbl(record_number).quote_type_code;
2167: lp_quot_rec.qrs_code := p_tif_tbl(record_number).quote_reason_code;
2168: create_quote(p_api_version => p_api_version
2169: ,p_init_msg_list => OKC_API.G_FALSE
2170: ,x_msg_count => x_msg_count
2171: ,x_msg_data => x_msg_data
2172: ,x_return_status => x_return_status
2173: ,p_tif_tbl => lp_tif_tbl
2187: IF (x_tif_tbl.COUNT>0) THEN
2188: -- updates the INTERFACE table
2189: FOR record_number IN x_tif_tbl.FIRST..x_tif_tbl.LAST LOOP
2190: update_row(p_api_version => p_api_version
2191: ,p_init_msg_list => OKC_API.G_FALSE
2192: ,x_msg_data => x_msg_data
2193: ,x_msg_count => x_msg_count
2194: ,x_return_status => x_return_status
2195: ,p_tif_rec => x_tif_tbl(record_number));
2202: END IF;--p_tif_tbl.COUNT>0 END IF; -- To check if table contains any record.
2203: EXCEPTION
2204: WHEN OTHERS THEN
2205: -- store SQL error message on message stack for caller
2206: OKC_API.set_message(p_app_name => g_app_name,
2207: p_msg_name => g_unexpected_error,
2208: p_token1 => g_sqlcode_token,
2209: p_token1_value => sqlcode,
2210: p_token2 => g_sqlerrm_token,
2211: p_token2_value => sqlerrm);
2212: l_msg_tbl(0).msg_text := 'populate_quote:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
2213: log_messages(log_msg_flag => 'V',
2214: msg_tbl => l_msg_tbl );
2215: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2216: END populate_quote;
2217:
2218: /* RABHUPAT added party logic for termination interface logic, only recipient role can be overwritten not others
2219: and creates quote for each party record defaults the quote_role_code to 'RECIPIENT'*/
2285: BEGIN
2286: x_tif_tbl := p_tif_tbl;
2287: lp_tip_tbl := p_tip_tbl;
2288: lx_tip_tbl := p_tip_tbl;
2289: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2290: l_count := 0;
2291: IF(lp_tip_tbl.COUNT>0) THEN
2292: -- sets the session variables
2293: FOR record_number IN lp_tip_tbl.FIRST..lp_tip_tbl.LAST LOOP
2299: lx_tip_tbl(record_number).status := 'ERROR';
2300: l_dup_flag := 'Y';
2301: --transaction_number repeated, ERROR out only the party record not the INTERFACE record
2302: -- striked off in the DLD
2303: OKC_API.set_message(p_app_name => g_app_name,
2304: p_msg_name => 'OKL_AM_DUP_TRAN_NUM',
2305: p_token1 => 'TRANSACTION_NUMBER',
2306: p_token1_value => lx_tip_tbl(record_number).transaction_number);
2307: message :='transaction_number '||lx_tip_tbl(record_number).transaction_number||' repeated in party table';
2307: message :='transaction_number '||lx_tip_tbl(record_number).transaction_number||' repeated in party table';
2308: ELSIF(lp_tip_tbl(record_number).contract_party_role IS NULL) THEN
2309: lx_tip_tbl(record_number).status := 'ERROR';
2310: -- contract_party_role should be entered
2311: OKC_API.set_message(p_app_name => g_app_name,
2312: p_msg_name => 'OKC_CONTRACTS_REQUIRED_VALUE',
2313: p_token1 => 'COL_NAME',
2314: p_token1_value => 'CONTRACT PARTY ROLE');
2315: message :='contract party role should be entered for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2324: IF(interface_dtls.status <> 'WORKING') THEN
2325: lx_tip_tbl(record_number).status := 'ERROR';
2326: -- corresponding transaction_number in INTERFACE table is ERRORED out
2327: -- striked off in the DLD
2328: OKC_API.set_message(p_app_name => g_app_name,
2329: p_msg_name => 'OKL_AM_ERR_INTERFACE',
2330: p_token1 => 'TRANSACTION_NUMBER',
2331: p_token1_value => lx_tip_tbl(record_number).transaction_number);
2332: message :='transaction_number in OKL_TERMNT_INTERFACE is ERROR for transaction number '||lx_tip_tbl(record_number).transaction_number;
2333: ELSE
2334: l_chr_id := interface_dtls.contract_id;
2335: END IF;
2336: END LOOP;
2337: IF(l_chr_id IS NULL OR l_chr_id = OKC_API.G_MISS_NUM)THEN
2338: lx_tip_tbl(record_number).status := 'ERROR';
2339: -- wrong transaction number
2340: OKC_API.set_message(p_app_name => g_app_name,
2341: p_msg_name => 'OKL_AM_JOIN_MIS_MATCH',
2336: END LOOP;
2337: IF(l_chr_id IS NULL OR l_chr_id = OKC_API.G_MISS_NUM)THEN
2338: lx_tip_tbl(record_number).status := 'ERROR';
2339: -- wrong transaction number
2340: OKC_API.set_message(p_app_name => g_app_name,
2341: p_msg_name => 'OKL_AM_JOIN_MIS_MATCH',
2342: p_token1 => 'TRANSACTION_NUMBER',
2343: p_token1_value => lx_tip_tbl(record_number).transaction_number);
2344: message :='wrong transaction number '||lx_tip_tbl(record_number).transaction_number;
2345: END IF;
2346: END IF;
2347: -- if no role specified default it to RECIPIENT
2348: IF(lx_tip_tbl(record_number).status <> 'ERROR') THEN
2349: IF(lx_tip_tbl(record_number).quote_role_code IS NULL OR lx_tip_tbl(record_number).quote_role_code = OKC_API.G_MISS_CHAR) THEN
2350: lx_tip_tbl(record_number).quote_role_code := 'RECIPIENT';
2351: END IF;
2352: IF(lx_tip_tbl(record_number).quote_role_code = 'RECIPIENT') THEN
2353: -- retrive the quote_party information
2427: END LOOP;
2428: IF(l_count = 0) THEN
2429: lx_tip_tbl(record_number). status := 'ERROR';
2430: -- neither lessee nor vendor
2431: OKC_API.set_message(p_app_name => g_app_name,
2432: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
2433: p_token1 => 'COL_NAME',
2434: p_token1_value => 'CONTRACT PARTY ROLE');
2435: message :='quote party should be a lessee or vendor for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2433: p_token1 => 'COL_NAME',
2434: p_token1_value => 'CONTRACT PARTY ROLE');
2435: message :='quote party should be a lessee or vendor for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2436: ELSIF(l_count>1) THEN
2437: IF((lp_tip_tbl(record_number).contract_party_id IS NULL OR lp_tip_tbl(record_number).contract_party_id = OKC_API.G_MISS_NUM) AND
2438: (lp_tip_tbl(record_number).contract_party_number IS NULL OR lp_tip_tbl(record_number).contract_party_number = OKC_API.G_MISS_CHAR)) THEN
2439: lx_tip_tbl(record_number). status := 'ERROR';
2440: -- neither contract_party_number nor contract_party_id are entered
2441: OKC_API.set_message(p_app_name => g_app_name,
2434: p_token1_value => 'CONTRACT PARTY ROLE');
2435: message :='quote party should be a lessee or vendor for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2436: ELSIF(l_count>1) THEN
2437: IF((lp_tip_tbl(record_number).contract_party_id IS NULL OR lp_tip_tbl(record_number).contract_party_id = OKC_API.G_MISS_NUM) AND
2438: (lp_tip_tbl(record_number).contract_party_number IS NULL OR lp_tip_tbl(record_number).contract_party_number = OKC_API.G_MISS_CHAR)) THEN
2439: lx_tip_tbl(record_number). status := 'ERROR';
2440: -- neither contract_party_number nor contract_party_id are entered
2441: OKC_API.set_message(p_app_name => g_app_name,
2442: p_msg_name => 'OKC_CONTRACTS_REQUIRED_VALUE',
2437: IF((lp_tip_tbl(record_number).contract_party_id IS NULL OR lp_tip_tbl(record_number).contract_party_id = OKC_API.G_MISS_NUM) AND
2438: (lp_tip_tbl(record_number).contract_party_number IS NULL OR lp_tip_tbl(record_number).contract_party_number = OKC_API.G_MISS_CHAR)) THEN
2439: lx_tip_tbl(record_number). status := 'ERROR';
2440: -- neither contract_party_number nor contract_party_id are entered
2441: OKC_API.set_message(p_app_name => g_app_name,
2442: p_msg_name => 'OKC_CONTRACTS_REQUIRED_VALUE',
2443: p_token1 => 'COL_NAME',
2444: p_token1_value => 'CONTRACT_PARTY_NAME OR PARTY_ID');
2445: message :='contract_party_number or contract_party_id should be entered for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2446: ELSIF(lp_tip_tbl(record_number).contract_party_number IS NOT NULL) THEN
2447: IF(l_contract_party_number <> lp_tip_tbl(record_number).contract_party_number) THEN
2448: lx_tip_tbl(record_number). status := 'ERROR';
2449: -- contract party number entered is not valid
2450: OKC_API.set_message(p_app_name => g_app_name,
2451: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
2452: p_token1 => 'COL_NAME',
2453: p_token1_value => 'CONTRACT_PARTY_NUMBER');
2454: message :='contract party number entered not exists for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2456: ELSIF(lp_tip_tbl(record_number).contract_party_id IS NOT NULL) THEN
2457: IF(l_contract_party_id <> lp_tip_tbl(record_number).contract_party_id) THEN
2458: lx_tip_tbl(record_number). status := 'ERROR';
2459: -- contract party id entered is not valid
2460: OKC_API.set_message(p_app_name => g_app_name,
2461: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
2462: p_token1 => 'COL_NAME',
2463: p_token1_value => 'CONTRACT_PARTY_NUMBER');
2464: message :='contract party id entered not exists for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2465: END IF;
2466: END IF;
2467: ELSIF(l_count = 1) THEN
2468: -- if only one party is associated then assign those parties even the user not entered
2469: IF((lp_tip_tbl(record_number).contract_party_id IS NULL OR lp_tip_tbl(record_number).contract_party_id = OKC_API.G_MISS_NUM) AND
2470: (lp_tip_tbl(record_number).contract_party_number IS NULL OR lp_tip_tbl(record_number).contract_party_number = OKC_API.G_MISS_CHAR)) THEN
2471: lx_tip_tbl(record_number).qpy_id := l_qpy_id;
2472: lx_tip_tbl(record_number).contract_party_number := l_contract_party_number;
2473: lx_tip_tbl(record_number).contract_party_id := l_contract_party_id;
2466: END IF;
2467: ELSIF(l_count = 1) THEN
2468: -- if only one party is associated then assign those parties even the user not entered
2469: IF((lp_tip_tbl(record_number).contract_party_id IS NULL OR lp_tip_tbl(record_number).contract_party_id = OKC_API.G_MISS_NUM) AND
2470: (lp_tip_tbl(record_number).contract_party_number IS NULL OR lp_tip_tbl(record_number).contract_party_number = OKC_API.G_MISS_CHAR)) THEN
2471: lx_tip_tbl(record_number).qpy_id := l_qpy_id;
2472: lx_tip_tbl(record_number).contract_party_number := l_contract_party_number;
2473: lx_tip_tbl(record_number).contract_party_id := l_contract_party_id;
2474: lx_tip_tbl(record_number).contract_party_name := l_contract_party_name;
2479: ELSIF(lp_tip_tbl(record_number).contract_party_number IS NOT NULL) THEN
2480: IF(l_contract_party_number <> lp_tip_tbl(record_number).contract_party_number) THEN
2481: lx_tip_tbl(record_number). status := 'ERROR';
2482: -- contract party number entered is not valid
2483: OKC_API.set_message(p_app_name => g_app_name,
2484: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
2485: p_token1 => 'COL_NAME',
2486: p_token1_value => 'CONTRACT_PARTY_NUMBER');
2487: message :='contract party number entered not exists for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2489: ELSIF(lp_tip_tbl(record_number).contract_party_id IS NOT NULL) THEN
2490: IF(l_contract_party_id <> lp_tip_tbl(record_number).contract_party_id) THEN
2491: lx_tip_tbl(record_number). status := 'ERROR';
2492: -- contract party id entered is not valid
2493: OKC_API.set_message(p_app_name => g_app_name,
2494: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
2495: p_token1 => 'COL_NAME',
2496: p_token1_value => 'CONTRACT_PARTY_NUMBER');
2497: message :='contract party id entered not exists for transaction_number '||lx_tip_tbl(record_number).transaction_number;
2500: END IF;
2501: ELSE
2502: lx_tip_tbl(record_number).status := 'ERROR';
2503: -- not recipient
2504: OKC_API.set_message(p_app_name => g_app_name,
2505: p_msg_name => 'OKC_CONTRACTS_INVALID_VALUE',
2506: p_token1 => 'COL_NAME',
2507: p_token1_value => 'QUOTE_ROLE_CODE');
2508: message :='quote party type allowed is only RECIPIENT for transaction_number'||lx_tip_tbl(record_number).transaction_number;
2535: x_tip_tbl := lx_tip_tbl;
2536: EXCEPTION
2537: WHEN OTHERS THEN
2538: -- store SQL error message on message stack for caller
2539: OKC_API.set_message(p_app_name => g_app_name,
2540: p_msg_name => g_unexpected_error,
2541: p_token1 => g_sqlcode_token,
2542: p_token1_value => sqlcode,
2543: p_token2 => g_sqlerrm_token,
2541: p_token1 => g_sqlcode_token,
2542: p_token1_value => sqlcode,
2543: p_token2 => g_sqlerrm_token,
2544: p_token2_value => sqlerrm);
2545: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2546: l_msg_tbl(0).msg_text := 'validate_party:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
2547: log_messages(log_msg_flag => 'V',
2548: msg_tbl => l_msg_tbl );
2549: END validate_party;
2565: x_return_status OUT NOCOPY VARCHAR2,
2566: p_tip_rec IN tip_rec_type) IS
2567: l_api_version CONSTANT NUMBER := p_api_version;
2568: l_api_name CONSTANT VARCHAR2(30) := 'terminate_interface';
2569: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2570: l_msg_tbl msg_tbl_type;
2571: BEGIN
2572: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2573: --Check API version, initialize message list and create savepoint.
2568: l_api_name CONSTANT VARCHAR2(30) := 'terminate_interface';
2569: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2570: l_msg_tbl msg_tbl_type;
2571: BEGIN
2572: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2573: --Check API version, initialize message list and create savepoint.
2574: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2575: G_PKG_NAME,
2576: p_init_msg_list,
2570: l_msg_tbl msg_tbl_type;
2571: BEGIN
2572: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2573: --Check API version, initialize message list and create savepoint.
2574: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2575: G_PKG_NAME,
2576: p_init_msg_list,
2577: l_api_version,
2578: p_api_version,
2577: l_api_version,
2578: p_api_version,
2579: '_PVT',
2580: x_return_status);
2581: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2582: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2583: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2584: RAISE OKC_API.G_EXCEPTION_ERROR;
2585: END IF;
2578: p_api_version,
2579: '_PVT',
2580: x_return_status);
2581: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2582: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2583: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2584: RAISE OKC_API.G_EXCEPTION_ERROR;
2585: END IF;
2586: -- updates the party table
2579: '_PVT',
2580: x_return_status);
2581: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2582: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2583: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2584: RAISE OKC_API.G_EXCEPTION_ERROR;
2585: END IF;
2586: -- updates the party table
2587: UPDATE OKL_TERMNT_INTF_PTY
2580: x_return_status);
2581: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2582: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2583: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2584: RAISE OKC_API.G_EXCEPTION_ERROR;
2585: END IF;
2586: -- updates the party table
2587: UPDATE OKL_TERMNT_INTF_PTY
2588: SET
2627: OKL_TERMNT_INTF_PTY.QUOTE_ROLE_CODE = p_tip_rec.quote_role_code
2628: WHERE
2629: OKL_TERMNT_INTF_PTY.ROWID =p_tip_rec.row_id;
2630:
2631: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2632: x_return_status := l_return_status;
2633: EXCEPTION
2634: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2635: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
2630:
2631: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2632: x_return_status := l_return_status;
2633: EXCEPTION
2634: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2635: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
2636: G_PKG_NAME,
2637: 'OKC_API.G_RET_STS_ERROR',
2638: x_msg_count,
2631: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2632: x_return_status := l_return_status;
2633: EXCEPTION
2634: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2635: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
2636: G_PKG_NAME,
2637: 'OKC_API.G_RET_STS_ERROR',
2638: x_msg_count,
2639: x_msg_data,
2633: EXCEPTION
2634: WHEN OKC_API.G_EXCEPTION_ERROR THEN
2635: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
2636: G_PKG_NAME,
2637: 'OKC_API.G_RET_STS_ERROR',
2638: x_msg_count,
2639: x_msg_data,
2640: '_PVT');
2641: -- for unexpected error
2638: x_msg_count,
2639: x_msg_data,
2640: '_PVT');
2641: -- for unexpected error
2642: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2643: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
2644: G_PKG_NAME,
2645: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2646: x_msg_count,
2639: x_msg_data,
2640: '_PVT');
2641: -- for unexpected error
2642: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2643: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
2644: G_PKG_NAME,
2645: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2646: x_msg_count,
2647: x_msg_data,
2641: -- for unexpected error
2642: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2643: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
2644: G_PKG_NAME,
2645: 'OKC_API.G_RET_STS_UNEXP_ERROR',
2646: x_msg_count,
2647: x_msg_data,
2648: '_PVT');
2649: WHEN OTHERS THEN
2647: x_msg_data,
2648: '_PVT');
2649: WHEN OTHERS THEN
2650: -- store SQL error message on message stack for caller
2651: OKC_API.set_message(p_app_name => g_app_name,
2652: p_msg_name => g_unexpected_error,
2653: p_token1 => g_sqlcode_token,
2654: p_token1_value => sqlcode,
2655: p_token2 => g_sqlerrm_token,
2653: p_token1 => g_sqlcode_token,
2654: p_token1_value => sqlcode,
2655: p_token2 => g_sqlerrm_token,
2656: p_token2_value => sqlerrm);
2657: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2658: l_msg_tbl(0).msg_text := 'update_party:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
2659: log_messages(log_msg_flag => 'V',
2660: msg_tbl => l_msg_tbl );
2661: END update_party;
2732: ORDER BY TRANSACTION_NUMBER;
2733:
2734: BEGIN
2735: record_number:=0;
2736: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2737: IF (p_tip_tbl.COUNT > 0) THEN
2738: record_number := p_tip_tbl.FIRST;
2739: -- loops throught the table of records to update the values
2740: LOOP
2738: record_number := p_tip_tbl.FIRST;
2739: -- loops throught the table of records to update the values
2740: LOOP
2741: update_party(p_api_version => p_api_version
2742: ,p_init_msg_list => OKC_API.G_FALSE
2743: ,x_msg_data => x_msg_data
2744: ,x_msg_count => x_msg_count
2745: ,x_return_status => x_return_status
2746: ,p_tip_rec => p_tip_tbl(record_number));
2796: END LOOP;
2797: EXCEPTION
2798: WHEN OTHERS THEN
2799: -- store SQL error message on message stack for caller
2800: OKC_API.set_message(p_app_name => g_app_name,
2801: p_msg_name => g_unexpected_error,
2802: p_token1 => g_sqlcode_token,
2803: p_token1_value => sqlcode,
2804: p_token2 => g_sqlerrm_token,
2805: p_token2_value => sqlerrm);
2806: l_msg_tbl(0).msg_text := 'select_party_info:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
2807: log_messages(log_msg_flag => 'V',
2808: msg_tbl => l_msg_tbl );
2809: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2810: END select_party_info;
2811:
2812: -- Start of comments
2813: --
2844: x_record_count NUMBER;
2845: BEGIN
2846: lp_tif_tbl := p_tif_tbl;
2847: x_group_number := 0;
2848: x_return_status := OKC_API.G_RET_STS_SUCCESS;
2849: IF(p_tip_tbl.COUNT>0) THEN
2850: -- populating the values required to create_quote
2851: FOR party_rec IN p_tip_tbl.FIRST..p_tip_tbl.LAST
2852: LOOP
2870: lp_assn_tbl(0).p_asset_number := lp_tif_tbl(term_rec).asset_number;
2871: lp_assn_tbl(0).p_quote_qty := lp_tif_tbl(term_rec).units_to_terminate;
2872: -- populate all the five default options and override the RECIPIENT
2873: OKL_AM_PARTIES_PVT.fetch_rule_quote_parties (p_api_version => p_api_version,
2874: p_init_msg_list => OKC_API.G_FALSE,
2875: x_msg_count => x_msg_count,
2876: x_msg_data => x_msg_data,
2877: x_return_status => x_return_status,
2878: p_qtev_rec => lp_quot_rec,
2897: p_qpyv_tbl => lp_qpyv_tbl,
2898: p_validate_only => TRUE,
2899: x_qpyv_tbl => lx_qpyv_tbl,
2900: x_return_status => x_return_status);
2901: IF(x_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2902: lx_tif_tbl.DELETE;
2903: -- create quote and quote_details
2904: create_quote(p_api_version => p_api_version
2905: ,p_init_msg_list => OKC_API.G_FALSE
2901: IF(x_return_status = OKC_API.G_RET_STS_SUCCESS) THEN
2902: lx_tif_tbl.DELETE;
2903: -- create quote and quote_details
2904: create_quote(p_api_version => p_api_version
2905: ,p_init_msg_list => OKC_API.G_FALSE
2906: ,x_msg_count => x_msg_count
2907: ,x_msg_data => x_msg_data
2908: ,x_return_status => x_return_status
2909: ,p_tif_tbl => lp_tif_tbl
2925: -- quote not created for transaction_number
2926: END IF;
2927: --updates the party table
2928: update_party(p_api_version => p_api_version
2929: ,p_init_msg_list => OKC_API.G_FALSE
2930: ,x_msg_data => x_msg_data
2931: ,x_msg_count => x_msg_count
2932: ,x_return_status => x_return_status
2933: ,p_tip_rec => l_tip_rec);
2940: x_tif_tbl := lp_tif_tbl;
2941: EXCEPTION
2942: WHEN OTHERS THEN
2943: -- store SQL error message on message stack for caller
2944: OKC_API.set_message(p_app_name => g_app_name,
2945: p_msg_name => g_unexpected_error,
2946: p_token1 => g_sqlcode_token,
2947: p_token1_value => sqlcode,
2948: p_token2 => g_sqlerrm_token,
2949: p_token2_value => sqlerrm);
2950: l_msg_tbl(0).msg_text := 'populate_party_for_quote:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
2951: log_messages(log_msg_flag => 'V',
2952: msg_tbl => l_msg_tbl );
2953: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2954: END populate_party_for_quote;
2955: /*PARTY_LOGIC END*/
2956:
2957:
3033: ORDER BY CONTRACT_NUMBER;
3034:
3035: l_api_version CONSTANT NUMBER := 1;
3036: l_api_name CONSTANT VARCHAR2(30) := 'terminate_interface';
3037: l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3038: record_number NUMBER;
3039: x_installbase_id NUMBER;
3040: l_sys_date DATE;
3041: l_tif_tbl tif_tbl_type;
3046: tot_rec_processed NUMBER := 0;
3047: l_msg_tbl msg_tbl_type;
3048: BEGIN
3049:
3050: x_return_status := OKC_API.G_RET_STS_SUCCESS;
3051: --Check API version, initialize message list and create savepoint.
3052: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3053: G_PKG_NAME,
3054: p_init_msg_list,
3048: BEGIN
3049:
3050: x_return_status := OKC_API.G_RET_STS_SUCCESS;
3051: --Check API version, initialize message list and create savepoint.
3052: l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3053: G_PKG_NAME,
3054: p_init_msg_list,
3055: l_api_version,
3056: p_api_version,
3055: l_api_version,
3056: p_api_version,
3057: '_PVT',
3058: x_return_status);
3059: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3060: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3061: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3062: RAISE OKC_API.G_EXCEPTION_ERROR;
3063: END IF;
3056: p_api_version,
3057: '_PVT',
3058: x_return_status);
3059: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3060: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3061: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3062: RAISE OKC_API.G_EXCEPTION_ERROR;
3063: END IF;
3064: -- this retrives the sysdate and passes to a local variable
3057: '_PVT',
3058: x_return_status);
3059: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3060: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3061: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3062: RAISE OKC_API.G_EXCEPTION_ERROR;
3063: END IF;
3064: -- this retrives the sysdate and passes to a local variable
3065: SELECT trunc(SYSDATE) INTO l_sys_date FROM DUAL;
3058: x_return_status);
3059: IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3060: RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3061: ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3062: RAISE OKC_API.G_EXCEPTION_ERROR;
3063: END IF;
3064: -- this retrives the sysdate and passes to a local variable
3065: SELECT trunc(SYSDATE) INTO l_sys_date FROM DUAL;
3066: record_number:=0;
3122:
3123: tot_rec_processed := l_tif_tbl.COUNT;
3124: -- validates quote_type and quote_reason and populates WHO columns
3125: validate_quote_type_and_reason(p_api_version => l_api_version,
3126: p_init_msg_list => OKC_API.G_TRUE,
3127: x_msg_count => x_msg_count,
3128: x_msg_data => x_msg_data,
3129: x_return_status => x_return_status,
3130: p_tif_tbl => l_tif_tbl,
3133: l_tif_tbl := lx_tif_tbl;
3134: lx_tif_tbl.DELETE;
3135: -- validates contract and asset details entered, populates the remaining calls required
3136: validate_transaction(p_api_version => l_api_version,
3137: p_init_msg_list => OKC_API.G_FALSE,
3138: x_msg_count => x_msg_count,
3139: x_msg_data => x_msg_data,
3140: x_return_status => x_return_status,
3141: p_tif_tbl => l_tif_tbl,
3145: l_tif_tbl := lx_tif_tbl;
3146: lx_tif_tbl.DELETE;
3147: -- updates the values in database and gets records with status='WORKING'
3148: change_status(p_api_version => l_api_version,
3149: p_init_msg_list => OKC_API.G_FALSE,
3150: x_msg_count => x_msg_count,
3151: x_msg_data => x_msg_data,
3152: x_return_status => x_return_status,
3153: p_tif_tbl => l_tif_tbl,
3157: l_tif_tbl := lx_tif_tbl;
3158: lx_tif_tbl.DELETE;
3159: -- selects the party information and populates WHO columns in party table
3160: select_party_info(p_api_version => l_api_version,
3161: p_init_msg_list => OKC_API.G_FALSE,
3162: x_msg_count => x_msg_count,
3163: x_msg_data => x_msg_data,
3164: x_return_status => x_return_status,
3165: p_tip_tbl => l_tip_tbl,
3169: l_tip_tbl := lx_tip_tbl;
3170: lx_tip_tbl.DELETE;
3171: -- validates party information
3172: validate_party(p_api_version => l_api_version,
3173: p_init_msg_list => OKC_API.G_FALSE,
3174: x_msg_count => x_msg_count,
3175: x_msg_data => x_msg_data,
3176: x_return_status => x_return_status,
3177: p_tif_tbl => l_tif_tbl,
3186: l_tif_tbl := lx_tif_tbl;
3187: lx_tif_tbl.DELETE;
3188: -- updates values in database and gets records with status='WORKING'
3189: select_party_info(p_api_version => l_api_version,
3190: p_init_msg_list => OKC_API.G_FALSE,
3191: x_msg_count => x_msg_count,
3192: x_msg_data => x_msg_data,
3193: x_return_status => x_return_status,
3194: p_tip_tbl => l_tip_tbl,
3198: l_tip_tbl := lx_tip_tbl;
3199: lx_tip_tbl.DELETE;
3200: -- populates the fields required for quote and creates quote for entries in party table
3201: populate_party_for_quote(p_api_version => l_api_version,
3202: p_init_msg_list => OKC_API.G_FALSE,
3203: x_msg_count => x_msg_count,
3204: x_msg_data => x_msg_data,
3205: x_return_status => x_return_status,
3206: p_tip_tbl => l_tip_tbl,
3211: l_tif_tbl := lx_tif_tbl;
3212: lx_tif_tbl.DELETE;
3213: -- updates the values to database and removes the duplicates while grouping
3214: remove_duplicates(p_api_version => l_api_version,
3215: p_init_msg_list => OKC_API.G_FALSE,
3216: x_msg_count => x_msg_count,
3217: x_msg_data => x_msg_data,
3218: x_return_status => x_return_status,
3219: p_tif_tbl => l_tif_tbl,
3223: l_tif_tbl := lx_tif_tbl;
3224: lx_tif_tbl.DELETE;
3225: -- creates groups and calls create_quote
3226: populate_quote(p_api_version => l_api_version,
3227: p_init_msg_list => OKC_API.G_FALSE,
3228: x_msg_count => x_msg_count,
3229: x_msg_data => x_msg_data,
3230: x_return_status => x_return_status,
3231: p_tif_tbl => l_tif_tbl,
3231: p_tif_tbl => l_tif_tbl,
3232: x_tif_tbl => lx_tif_tbl,
3233: p_group_number => l_group_number);
3234:
3235: OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3236: log_messages(log_msg_flag => 'Y',
3237: p_quote_number => tot_rec_processed,
3238: msg_tbl => l_msg_tbl );
3239: log_messages(log_msg_flag => 'O',
3239: log_messages(log_msg_flag => 'O',
3240: p_quote_number => tot_rec_processed,
3241: msg_tbl => l_msg_tbl );
3242: EXCEPTION
3243: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3244: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
3245: G_PKG_NAME,
3246: 'OKC_API.G_RET_STS_ERROR',
3247: x_msg_count,
3240: p_quote_number => tot_rec_processed,
3241: msg_tbl => l_msg_tbl );
3242: EXCEPTION
3243: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3244: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
3245: G_PKG_NAME,
3246: 'OKC_API.G_RET_STS_ERROR',
3247: x_msg_count,
3248: x_msg_data,
3242: EXCEPTION
3243: WHEN OKC_API.G_EXCEPTION_ERROR THEN
3244: x_return_status := OKC_API.HANDLE_EXCEPTIONS(l_api_name,
3245: G_PKG_NAME,
3246: 'OKC_API.G_RET_STS_ERROR',
3247: x_msg_count,
3248: x_msg_data,
3249: '_PVT');
3250: -- unexpected error
3247: x_msg_count,
3248: x_msg_data,
3249: '_PVT');
3250: -- unexpected error
3251: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3252: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
3253: G_PKG_NAME,
3254: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3255: x_msg_count,
3248: x_msg_data,
3249: '_PVT');
3250: -- unexpected error
3251: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3252: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
3253: G_PKG_NAME,
3254: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3255: x_msg_count,
3256: x_msg_data,
3250: -- unexpected error
3251: WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3252: x_return_status :=OKC_API.HANDLE_EXCEPTIONS(l_api_name,
3253: G_PKG_NAME,
3254: 'OKC_API.G_RET_STS_UNEXP_ERROR',
3255: x_msg_count,
3256: x_msg_data,
3257: '_PVT');
3258: WHEN OTHERS THEN
3256: x_msg_data,
3257: '_PVT');
3258: WHEN OTHERS THEN
3259: -- store SQL error message on message stack for caller
3260: OKC_API.set_message(p_app_name => g_app_name,
3261: p_msg_name => g_unexpected_error,
3262: p_token1 => g_sqlcode_token,
3263: p_token1_value => sqlcode,
3264: p_token2 => g_sqlerrm_token,
3262: p_token1 => g_sqlcode_token,
3263: p_token1_value => sqlcode,
3264: p_token2 => g_sqlerrm_token,
3265: p_token2_value => sqlerrm);
3266: x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
3267: l_msg_tbl(0).msg_text := 'termination_interface:ended with unexpected error sqlcode: '||sqlcode||' sqlerrm: '||sqlerrm;
3268: log_messages(log_msg_flag => 'Y',
3269: p_quote_number => tot_rec_processed,
3270: msg_tbl => l_msg_tbl );