--ABS-87222 / ABS-88516

---------- PRODUCT --------------
ALTER TABLE PRODUCT ADD (MMPDEFAULTPERCENTAGE NUMBER NULL 
                         CONSTRAINT CHK_PRODUCT_MMPDEFAULTPERCENT CHECK (MMPDEFAULTPERCENTAGE BETWEEN 0 AND 100));
COMMENT ON COLUMN PRODUCT.MMPDEFAULTPERCENTAGE
IS 'Material Maintenance Protection (MMP) default percentage. Optional, so may be left empty. 
Must be filled with a value between 0.1 and 100.0 when MaterialMaintenanceProtection = 1 or must be filled with 0 or left empty (null) when MaterialMaintenanceProtection = 0
Only used for module BPMMPENHANCED';

UPDATE PRODUCT P
SET P.MMPDEFAULTPERCENTAGE=0.1
WHERE P.MATERIALMAINTENANCEPROTECTION=1;
COMMIT;

ALTER TABLE PRODUCT 
   ADD CONSTRAINT CHK_PRODUCT_MMP 
   CHECK ((MATERIALMAINTENANCEPROTECTION=0 AND NVL(MMPDEFAULTPERCENTAGE,0)=0) OR (MATERIALMAINTENANCEPROTECTION=1 AND NVL(MMPDEFAULTPERCENTAGE,0) BETWEEN 0.1 AND 100));
