-- Order 20011454.60 (Market segments for internal PO)

-----------------------MARKETSEGMENT TABLE-------------------------

ALTER TABLE MARKETSEGMENT
	ADD (USEFORINTPO VARCHAR2(1)  DEFAULT 'N' NOT NULL CONSTRAINT USEFORINTPO_valid CHECK (USEFORINTPO IN ('Y', 'N')),
	     DEFAULTFORINTPO VARCHAR2(1)  DEFAULT 'N' NOT NULL CONSTRAINT DEFFORINTPO_valid CHECK (DEFAULTFORINTPO IN ('Y', 'N'))
	     );




-----------------------PURCHASEORDERLINE TABLE-------------------------


ALTER TABLE PURCHASEORDERLINE
	ADD (MARKETSEGMENT_ID NUMBER NULL);

COMMENT ON COLUMN PURCHASEORDERLINE.MARKETSEGMENT_ID IS 'Will only be filled when the module ERPINTEGRATION is active.';

CREATE  INDEX XIF7PURCHASEORDERLINE ON PURCHASEORDERLINE
(MARKETSEGMENT_ID   ASC);

ALTER TABLE PURCHASEORDERLINE
ADD CONSTRAINT PURCHASEORDERLINE_MARKETSEGM FOREIGN KEY (MARKETSEGMENT_ID) REFERENCES MARKETSEGMENT (MARKETSEGMENT_ID);








