ALTER TABLE USR_SAP_ITEMPROIMPOS MODIFY CDFISCALIT NULL
/

CREATE TABLE USR_SAP_DADOSADIC
(
   CDUNICO         VARCHAR2(14),
   NRDADOADIC      VARCHAR2(3),
   DSDADOSADIC     VARCHAR2(255),
   IDINTERFACE     NUMBER       NOT NULL,
   TPINTERFACE     VARCHAR2(01) NOT NULL
      CONSTRAINT CKC_TPINTERFACE_USR_DADOSADIC CHECK (TPINTERFACE IN ('I','A','E')),
   DTINTERFACEORI  DATE         NOT NULL,
   DTINTERFACEDEST DATE,
   STATUS          NUMBER       NOT NULL
      CONSTRAINT CKC_STATUS_USR_DADOSADIC CHECK (STATUS IN (0,1,2)),
   APPORIGEM       NUMBER       NOT NULL
      CONSTRAINT CKC_APPORIGEM_USR_DADOSADIC CHECK (APPORIGEM IN (1,2)),
   APPDESTINO      NUMBER       NOT NULL
      CONSTRAINT CKC_APPDESTINO_USR_DADOSADIC CHECK (APPDESTINO IN (1,2))
)
/

--Tabela USR_SAP_NOTAFISCAL
ALTER TABLE USR_SAP_NOTAFISCAL
ADD NRLANCTORIGNF VARCHAR2(20)
/

ALTER TABLE USR_SAP_NOTAFISCAL
ADD CDSERIEORIGNF VARCHAR2(5)
/

ALTER TABLE USR_SAP_NOTAFISCAL
ADD CDFILIORIG VARCHAR2(4)
/

ALTER TABLE USR_SAP_NOTAFISCAL
ADD CDFILIDEST VARCHAR2(4)
/

ALTER TABLE USR_SAP_NOTAFISCAL
ADD IDTPINSJURNF VARCHAR2(2)
   CONSTRAINT CKC_IDTPINSJURNF_SAP CHECK (IDTPINSJURNF IN ('C','F','CR'))
/

ALTER TABLE USR_SAP_NOTAFISCAL
ADD NRPROTOCOLONFE VARCHAR2(15)
/

ALTER TABLE USR_SAP_NOTAFISCAL
ADD DTAUTPROTOCOLO DATE
/

ALTER TABLE USR_SAP_NOTAFISCAL
ADD HRAUTPROTOCOLO VARCHAR2(8)
/

ALTER TABLE USR_SAP_NOTAFISCAL
ADD INCOTERM VARCHAR2(3)
/

--Tabela USR_SAP_ITEMPRODUTO
ALTER TABLE USR_SAP_ITEMPRODUTO
ADD CDNCM VARCHAR2(16)
/

--Tabela USR_SAP_ITAPURFATUR
ALTER TABLE USR_SAP_ITAPURFATUR
ADD CDNCM VARCHAR2(16)
/

ALTER TABLE USR_SAP_APURFATUR
ADD IDTPINSJURNF VARCHAR2(2)
   CONSTRAINT CKC_IDTPINSJURNF_APUFAT_SAP CHECK (IDTPINSJURNF IN ('C','F','CR'))
/

-- VERSAO --
BEGIN ATUVEROBJ('ATUALIZACAO_ESTRUTURA_BD','5.42.XXX'); END;
/
