--Order 20011793.70

ALTER TABLE REASONCODE
	ADD (DEFAULTREASONUNDORECEIVEPO VARCHAR2(1)  DEFAULT 'N' NOT NULL CONSTRAINT YN_ValidationField55 CHECK (DEFAULTREASONUNDORECEIVEPO IN ('Y', 'N')));

ALTER TABLE RAGREASON
	ADD (DEFAULTREASONUNDORECEIVEPO VARCHAR2(1)  DEFAULT 'N' NOT NULL CONSTRAINT YN_ValidationField56 CHECK (DEFAULTREASONUNDORECEIVEPO IN ('Y', 'N')));

ALTER TABLE SYSTEMUSER
	ADD (MAYUNDOSTOCKRECEPTION VARCHAR2(1)  DEFAULT 'N' NOT NULL CONSTRAINT YN_ValidationField57 CHECK (MAYUNDOSTOCKRECEPTION IN ('Y', 'N')));

COMMENT ON COLUMN REASONCODE.DEFAULTREASONUNDORECEIVEPO IS 'Defines which reason code will be used when creating a stocktransaction to register an Undo of received items for a PO.';

COMMENT ON COLUMN RAGREASON.DEFAULTREASONUNDORECEIVEPO IS 'Defines which reason code will be used when creating a stocktransaction to register an Undo of received items for a PO.';

COMMENT ON COLUMN SYSTEMUSER.MAYUNDOSTOCKRECEPTION IS 'Indicates whether the system user is authorized to undo the reception of received items on stock for Purchase Orders with status = ‘In progress’';

insert into transactiontype
  (transactiontype_id, factorydescription, systemuser_id, timestamp)
  select 102,
         'Undo Stock Reception from PO',
         getminsystemuser(),
         sysdate
    from dual;
commit;

insert into transactiontype_desc
  (transactiontype_id, language_id, description, systemuser_id, timestamp)
  select transactiontype_id,
         getminlanguage(),
         factorydescription,
         systemuser_id,
         timestamp
    from transactiontype
   where transactiontype.transactiontype_id = 102 ;
commit;