34: i.inventory_item_id,
35: i.organization_id ,
36: i.revision,
37: rowid
38: from mtl_item_revisions_interface i
39: where i.process_flag = 2
40: and i.set_process_id = xset_id
41: and (i.organization_id = org_id or all_org = 1)
42: and not exists (select 'X'
71: inventory_item_id,
72: revision,
73: revision_id,
74: rowid
75: from mtl_item_revisions_interface
76: where set_process_id = xset_id
77: and process_flag = 2;
78: --2808277 : Above validation applicable to only CREATE
79: --Above cursor modified to check revision id uniqueness
85: i.organization_id,
86: i.inventory_item_id,
87: i.transaction_id,
88: i.created_by
89: from mtl_item_revisions_interface i
90: where i.set_process_id = xset_id
91: and i.process_flag = 2
92: and (i.transaction_type = 'UPDATE'
93: or exists (select null
108: m.organization_id,
109: m.inventory_item_id,
110: m.revision,
111: m.rowid
112: from mtl_item_revisions_interface m
113: where m.set_process_id = xset_id
114: and m.process_flag = 2;
115:
116: /*
131: m.effectivity_date,
132: m.ecn_initiation_date,
133: m.implementation_date,
134: m.revision_reason
135: from mtl_item_revisions_interface m
136: where m.set_process_id = xset_id
137: and m.process_flag = 2;
138:
139: /*NP 07SEP94 In cursor gg added an or clause here
147: select i.transaction_id,
148: i.organization_id,
149: i.rowid
150: from mtl_item_revisions_b m,
151: mtl_item_revisions_interface i
152: where m.organization_id = i.organization_id
153: and i.set_process_id = xset_id
154: and m.inventory_item_id = i.inventory_item_id
155: and ( (m.revision < i.revision and m.effectivity_date >=
173: transaction_id,
174: transaction_type,
175: revision,
176: revision_id
177: FROM mtl_item_revisions_interface i
178: WHERE set_process_id = xset_id
179: AND process_flag = 2
180: FOR UPDATE OF current_phase_id NOWAIT;
181:
253: --Start:3059993:Revision create should honour items phase policy
254: l_item_phase_id mtl_item_revisions_b.current_phase_id%TYPE;
255: l_item_lifecycle_id mtl_item_revisions_b.lifecycle_id%TYPE;
256: --End:3059993:Revision create should honour items phase policy
257: l_revision_id mtl_item_revisions_interface.revision_id%TYPE;
258: l_revid_error BOOLEAN := FALSE;
259:
260: l_item_approved mtl_system_items_b.approval_status%TYPE := NULL;
261: l_item_trans_type mtl_system_items_interface.transaction_type%TYPE := NULL;
272:
273: l_process_control := INV_EGO_REVISION_VALIDATE.Get_Process_Control;
274:
275: for cr in cc loop
276: update mtl_item_revisions_interface
277: set process_flag = l_process_flag_3
278: where rowid = cr.rowid ;
279:
280: status := INVPUOPI.mtl_log_interface_err(
286: request_id,
287: cr.TRANSACTION_ID,
288: error_msg,
289: 'ITEM_ID',
290: 'MTL_ITEM_REVISIONS_INTERFACE',
291: 'INV_IOI_REV_NO_ITEM',
292: err_text);
293: if status < 0 then
294: raise LOGGING_ERR;
315: l_revid_error := TRUE;
316: END IF;
317:
318: IF l_revid_error THEN
319: update mtl_item_revisions_interface
320: set process_flag = l_process_flag_3
321: where rowid = cr.rowid;
322:
323: status := INVPUOPI.mtl_log_interface_err(
329: request_id,
330: cr.TRANSACTION_ID,
331: error_msg,
332: 'REVISION_ID',
333: 'MTL_ITEM_REVISIONS_INTERFACE',
334: 'INV_IOI_INVALID_REVISION_ID',
335: err_text);
336: if status < 0 then
337: raise LOGGING_ERR;
349: AND cr.revision_id IS NULL THEN
350: l_revid_error := TRUE;
351: END IF;
352: IF l_revid_error THEN
353: update mtl_item_revisions_interface
354: set process_flag = l_process_flag_3
355: where rowid = cr.rowid;
356: status := INVPUOPI.mtl_log_interface_err(
357: cr.organization_id,
362: request_id,
363: cr.TRANSACTION_ID,
364: error_msg,
365: 'REVISION',
366: 'MTL_ITEM_REVISIONS_INTERFACE',
367: 'INV_IOI_INVALID_REVISION',
368: err_text);
369: if status < 0 then
370: raise LOGGING_ERR;
379: AND (revision = cr.revision OR revision_id = cr.revision_id);
380:
381: IF cr.transaction_type ='CREATE' AND l_row_count > 0 THEN
382:
383: update mtl_item_revisions_interface
384: set process_flag = l_process_flag_3
385: where rowid = cr.rowid;
386:
387: status := INVPUOPI.mtl_log_interface_err(
393: request_id,
394: cr.TRANSACTION_ID,
395: error_msg,
396: 'REVISION',
397: 'MTL_ITEM_REVISIONS_INTERFACE',
398: 'INV_IOI_REV_DUP_2',
399: err_text);
400: if status < 0 then
401: raise LOGGING_ERR;
400: if status < 0 then
401: raise LOGGING_ERR;
402: end if;
403: ELSIF cr.transaction_type ='UPDATE' AND l_row_count = 0 THEN
404: update mtl_item_revisions_interface
405: set process_flag = l_process_flag_3
406: where rowid = cr.rowid;
407: status := INVPUOPI.mtl_log_interface_err(
408: cr.organization_id,
413: request_id,
414: cr.TRANSACTION_ID,
415: error_msg,
416: 'REVISION',
417: 'MTL_ITEM_REVISIONS_INTERFACE',
418: 'INV_IOI_REV_NO_ITEM',
419: err_text);
420: if status < 0 then
421: raise LOGGING_ERR;
441: ,p_instance_pk2_value => cr.organization_id
442: ,P_User_Id => user_id);
443:
444: IF l_has_privilege <> 'T' THEN
445: update mtl_item_revisions_interface
446: set process_flag = l_process_flag_3
447: where rowid = cr.rowid;
448:
449: status := INVPUOPI.mtl_log_interface_err(
455: request_id,
456: cr.TRANSACTION_ID,
457: error_msg,
458: 'INVENTORY_ITEM_ID',
459: 'MTL_ITEM_REVISIONS_INTERFACE',
460: 'INV_IOI_ITEMREV_UPDATE_PRIV',
461: err_text);
462: if status < 0 then
463: raise LOGGING_ERR;
476: for cr in ee loop
477:
478: select count(*)
479: into temp_count
480: from mtl_item_revisions_interface i
481: where i.organization_id = cr.organization_id
482: and i.inventory_item_id = cr.inventory_item_id
483: and i.set_process_id + 0 = xset_id
484: and i.revision = cr.revision
494: Close is_gdsn_batch;
495:
496: if l_is_gdsn_batch <> 1 then
497:
498: update mtl_item_revisions_interface
499: set process_flag = l_process_flag_3
500: where transaction_id = cr.transaction_id
501: and set_process_id = xset_id
502: and revision = cr.revision;
529: request_id,
530: cr.TRANSACTION_ID,
531: error_msg,
532: 'DUP2',
533: 'MTL_ITEM_REVISIONS_INTERFACE',
534: 'INV_IOI_REV_DUP_1',
535: err_text);
536: if status < 0 then
537: raise LOGGING_ERR;
577: ,X_MSG_DATA => l_Msg_Data);
578:
579: IF l_Policy_Code <> 'ALLOWED' THEN
580:
581: UPDATE mtl_item_revisions_interface
582: SET process_flag = l_process_flag_3
583: WHERE rowid = cr.rowid;
584: status := INVPUOPI.mtl_log_interface_err(
585: cr.organization_id,
590: request_id,
591: cr.TRANSACTION_ID,
592: error_msg,
593: 'TRANSACTION_TYPE',
594: 'MTL_ITEM_REVISIONS_INTERFACE',
595: 'INV_IOI_REV_PHASE_CONFLICT',
596: err_text);
597: if status < 0 then
598: raise LOGGING_ERR;
605: --We allow only default revision
606: IF (l_item_trans_type = 'EXISTS' AND l_item_approved <> 'A')
607: OR (l_item_trans_type = 'CREATE' AND INVIDIT3.CHECK_NPR_CATALOG(l_item_catalog))
608: THEN
609: UPDATE mtl_item_revisions_interface
610: SET process_flag = l_process_flag_3
611: WHERE rowid = cr.rowid;
612: status := INVPUOPI.mtl_log_interface_err(
613: cr.organization_id,
618: request_id,
619: cr.TRANSACTION_ID,
620: error_msg,
621: 'TRANSACTION_TYPE',
622: 'MTL_ITEM_REVISIONS_INTERFACE',
623: 'INV_IOI_UNAPPROVED_ITEM_REV',
624: err_text);
625: if status < 0 then
626: raise LOGGING_ERR;
648: AND TRUNC(effectivity_date)<= TRUNC(sysdate)
649: AND TRUNC(effectivity_date) <> TRUNC(cr.effectivity_date);
650:
651: IF (l_row_count > 0) THEN
652: update mtl_item_revisions_interface
653: set process_flag = l_process_flag_3
654: where transaction_id = cr.transaction_id
655: and set_process_id = xset_id
656: and revision = cr.revision;--Bug: 2593490
664: request_id,
665: cr.TRANSACTION_ID,
666: error_msg,
667: 'REVISION',
668: 'MTL_ITEM_REVISIONS_INTERFACE',
669: 'INV_REV_DATE_CHANGE_NOTALLOWED',
670: err_text);
671: if status < 0 then
672: raise LOGGING_ERR;
684: OR(implementation_date <> cr.implementation_date)));
685:
686: IF (l_row_count > 0) THEN
687:
688: update mtl_item_revisions_interface
689: set process_flag = l_process_flag_3
690: where transaction_id = cr.transaction_id
691: and set_process_id = xset_id
692: and revision = cr.revision;--Bug: 2593490
700: request_id,
701: cr.TRANSACTION_ID,
702: error_msg,
703: 'REVISION',
704: 'MTL_ITEM_REVISIONS_INTERFACE',
705: 'INV_REV_ECO_CHANGE_NOTALLOWED',
706: err_text);
707: if status < 0 then
708: raise LOGGING_ERR;
713: END IF;
714:
715: select count(*)
716: into temp_count
717: from mtl_item_revisions_interface i
718: where i.organization_id = cr.organization_id
719: and i.inventory_item_id = cr.inventory_item_id
720: and i.set_process_id + 0 = xset_id
721: --and i.transaction_id = cr.transaction_id Commented for bug 5458317
733: and i.process_flag = 2 ;
734:
735: IF temp_count >= 1 THEN
736:
737: update mtl_item_revisions_interface
738: set process_flag = l_process_flag_3
739: where transaction_id = cr.transaction_id
740: and set_process_id = xset_id
741: and revision = cr.revision;--Bug: 2593490
752: request_id,
753: cr.TRANSACTION_ID,
754: error_msg,
755: 'EFF1',
756: 'MTL_ITEM_REVISIONS_INTERFACE',
757: 'INV_IOI_REV_BAD_ORDER',
758: err_text);
759: if status < 0 then
760: raise LOGGING_ERR;
772: CLOSE c_check_lookup;
773:
774: IF l_lookup_exist <> 'Y' THEN
775:
776: update mtl_item_revisions_interface
777: set process_flag = l_process_flag_3
778: where transaction_id = cr.transaction_id
779: and set_process_id = xset_id
780: and revision = cr.revision;
805: request_id,
806: cr.TRANSACTION_ID,
807: error_msg,
808: 'REVISION_REASON',
809: 'MTL_ITEM_REVISIONS_INTERFACE',
810: 'INV_IOI_INVALID_REV_REASON',
811: err_text);
812:
813: IF status < 0 THEN
821: end loop;
822:
823: for cr in gg loop
824:
825: update mtl_item_revisions_interface
826: set process_flag = l_process_flag_3
827: where rowid = cr.rowid;
828:
829: IF l_inv_debug_level IN(101, 102) THEN
839: request_id,
840: cr.TRANSACTION_ID,
841: error_msg,
842: 'EFF2',
843: 'MTL_ITEM_REVISIONS_INTERFACE',
844: 'INV_IOI_REV_BAD_ORDER',
845: err_text);
846:
847: if status < 0 then
877:
878: -- Bug: 3769153 - if lifecycle is not specified and phase is specified,
879: -- then update the lifecycle of item to the revision
880: IF cr.lifecycle_id IS NULL AND l_item_lifecycle_id IS NOT NULL THEN
881: update mtl_item_revisions_interface
882: set lifecycle_id = l_item_lifecycle_id
883: where rowid = cr.rowid;
884: END IF;
885:
884: END IF;
885:
886: -- 3624686 null check incorporated
887: IF cr.lifecycle_id <> NVL(l_item_lifecycle_id,-1) THEN
888: update mtl_item_revisions_interface
889: set process_flag = l_process_flag_3
890: where rowid = cr.rowid;
891:
892: l_lifecycle_error := TRUE;
900: request_id,
901: cr.TRANSACTION_ID,
902: error_msg,
903: 'LIFECYCLE_ID',
904: 'MTL_ITEM_REVISIONS_INTERFACE',
905: 'INV_IOI_REV_INVALID_LIFECYCLE',
906: err_text);
907: IF status < 0 THEN
908: raise LOGGING_ERR;
918: IF NOT INV_EGO_REVISION_VALIDATE.Check_LifeCycle_Phase
919: ( p_lifecycle_id => nvl(cr.lifecycle_id, l_item_lifecycle_id),
920: p_lifecycle_phase_id => cr.current_phase_id)
921: THEN
922: update mtl_item_revisions_interface
923: set process_flag = l_process_flag_3
924: where rowid = cr.rowid;
925:
926: l_lifecycle_error := TRUE;
934: request_id,
935: cr.TRANSACTION_ID,
936: error_msg,
937: 'CURRENT_PHASSE_ID',
938: 'MTL_ITEM_REVISIONS_INTERFACE',
939: 'INV_IOI_REV_INVALID_PHASE',
940: err_text);
941: IF status < 0 THEN
942: raise LOGGING_ERR;
947: OR (l_item_trans_type = 'CREATE' AND INVIDIT3.CHECK_NPR_CATALOG(l_item_catalog))
948: THEN
949: IF cr.current_phase_id <> INV_EGO_REVISION_VALIDATE.Get_Initial_Lifecycle_Phase(nvl(cr.lifecycle_id, l_item_lifecycle_id))
950: THEN
951: update mtl_item_revisions_interface
952: set process_flag = l_process_flag_3
953: where rowid = cr.rowid;
954:
955: l_lifecycle_error := TRUE;
963: request_id,
964: cr.TRANSACTION_ID,
965: error_msg,
966: 'CURRENT_PHASSE_ID',
967: 'MTL_ITEM_REVISIONS_INTERFACE',
968: 'INV_IOI_REV_UNAPPROVED_PHASE',
969: err_text);
970: IF status < 0 THEN
971: raise LOGGING_ERR;
976: END IF;
977: END IF;
978: ELSE --cr.current_phase_id IS NOT NULL THEN
979: --2891650 : Start IOI should not default LC phase.
980: update mtl_item_revisions_interface
981: set process_flag = l_process_flag_3
982: where rowid = cr.rowid;
983:
984: l_lifecycle_error := TRUE;
992: request_id,
993: cr.TRANSACTION_ID,
994: error_msg,
995: 'CURRENT_PHASSE_ID',
996: 'MTL_ITEM_REVISIONS_INTERFACE',
997: 'INV_IOI_PHASE_MANDATORY',
998: err_text);
999: IF status < 0 THEN
1000: raise LOGGING_ERR;
1025: ,X_MSG_DATA => l_Msg_Data);
1026:
1027: IF l_Policy_Code <> 'ALLOWED' THEN
1028:
1029: update mtl_item_revisions_interface
1030: set process_flag = l_process_flag_3
1031: where rowid = cr.rowid;
1032:
1033: status := INVPUOPI.mtl_log_interface_err(
1039: request_id,
1040: cr.TRANSACTION_ID,
1041: error_msg,
1042: 'CURRENT_PHASE_ID',
1043: 'MTL_ITEM_REVISIONS_INTERFACE',
1044: 'INV_IOI_PHASE_CHANGE_NOT_VALID',
1045: err_text);
1046: IF status < 0 THEN
1047: raise LOGGING_ERR;
1074: --2885843: End default revision error propagated to imported item
1075:
1076: END LOOP;
1077:
1078: update mtl_item_revisions_interface
1079: set process_flag = l_process_flag_4,
1080: revision_label = NVL(revision_label,revision),
1081: revision_id = NVL(revision_id,MTL_ITEM_REVISIONS_B_S.NEXTVAL) --2808277
1082: where process_flag = l_process_flag_2