Friday, November 2, 2018

Add Older revision numbers to an item

Add Older revision numbers to an item

The below script can be used to add Older revision numbers to an item.
Why we need to use this script: In Oracle standard functionality revisions need to be added in sequence like A, B, C….. It doesn’t allow us to add B after adding A and C. In that case this script can be used to add the missing revision from the backend.
DECLARE
item_revision_rec MTL_ITEM_REVISIONS_B%ROWTYPE;
l_revision_id mtl_item_revisions_b.revision_id%TYPE;
l_row_id VARCHAR2(100);
 
BEGIN
select mtl_item_revisions_b_s.nextval
into l_revision_id
from dual;
 
item_revision_rec.REVISION_ID := l_revision_id;
item_revision_rec.INVENTORY_ITEM_ID := &itemid ;
item_revision_rec.ORGANIZATION_ID := &organization_id;
item_revision_rec.REVISION := &revision;
item_revision_rec.LAST_UPDATE_DATE := SYSDATE;
item_revision_rec.LAST_UPDATED_BY := 1;
item_revision_rec.CREATION_DATE := SYSDATE;
item_revision_rec.CREATED_BY := 1;
item_revision_rec.EFFECTIVITY_DATE := to_date
('&effectivity_date','DD-MON-YYYY HH24:MI:SS') ;
item_revision_rec.IMPLEMENTATION_DATE:= to_date
('&effectivity_date','DD-MON-YYYY HH24:MI:SS') ;
item_revision_rec.revision_label := &revision;
 
MTL_ITEM_REVISIONS_UTIL.INSERT_ROW
(P_Item_Revision_Rec=>item_revision_rec, x_rowid => l_row_id);
 
END;

No comments:

Post a Comment

SQL Important Queries

  How to delete rows with no where clause The following example deletes  all rows  from the  Person.Person  the table in the AdventureWork...