CREATE COLUMN TABLE "SBODEMOPT"."OIPF" ("DocEntry" INTEGER CS_INT NOT NULL , "DocNum" INTEGER CS_INT NOT NULL , "DocDate" LONGDATE CS_LONGDATE, "DocDueDate" LONGDATE CS_LONGDATE, "CardCode" NVARCHAR(15), "SuppName" NVARCHAR(100), "AgentCode" NVARCHAR(15), "AgentName" NVARCHAR(100), "DocStatus" NVARCHAR(1) DEFAULT 'O', "AgentNum" NVARCHAR(16), "Descr" NVARCHAR(250), "Ref1" NVARCHAR(11), "Ref2" NVARCHAR(11), "DocCur" NVARCHAR(3), "DocRate" DECIMAL(21,6) CS_FIXED, "ExpCustom" DECIMAL(21,6) CS_FIXED, "ActCustom" DECIMAL(21,6) CS_FIXED, "Vat1" DECIMAL(21,6) CS_FIXED, "Vat2" DECIMAL(21,6) CS_FIXED, "BeforeVat" DECIMAL(21,6) CS_FIXED, "DocTotal" DECIMAL(21,6) CS_FIXED, "CostSum" DECIMAL(21,6) CS_FIXED, "DocTime" SMALLINT CS_INT, "Canceled" NVARCHAR(1) DEFAULT 'N', "ExCustomFC" DECIMAL(21,6) CS_FIXED, "AcCustomFC" DECIMAL(21,6) CS_FIXED, "Vat1FC" DECIMAL(21,6) CS_FIXED, "Vat2FC" DECIMAL(21,6) CS_FIXED, "BeforVatFC" DECIMAL(21,6) CS_FIXED, "DocTotalFC" DECIMAL(21,6) CS_FIXED, "CostSumFC" DECIMAL(21,6) CS_FIXED, "CloseDate" LONGDATE CS_LONGDATE, "Cost_Match" DECIMAL(21,6) CS_FIXED, "C_Match_FC" DECIMAL(21,6) CS_FIXED, "BillOfLad" NVARCHAR(20), "TrnspCode" SMALLINT CS_INT, "CostFactor" DECIMAL(21,6) CS_FIXED, "UpdateDate" LONGDATE CS_LONGDATE, "CreateDate" LONGDATE CS_LONGDATE, "Transfered" NVARCHAR(1) DEFAULT 'N', "Instance" SMALLINT CS_INT DEFAULT 0 NOT NULL , "TaxDate" LONGDATE CS_LONGDATE, "Series" INTEGER CS_INT NOT NULL , "JdtNum" INTEGER CS_INT, "JdtMemo" NVARCHAR(254), "DataSource" NVARCHAR(1) DEFAULT 'N', "UserSign" SMALLINT CS_INT, "ObjType" NVARCHAR(20) DEFAULT '69', "ExCustomSC" DECIMAL(21,6) CS_FIXED, "ActCustSC" DECIMAL(21,6) CS_FIXED, "TtlCostSC" DECIMAL(21,6) CS_FIXED, "VersionNum" NVARCHAR(13), "OpenForLaC" NVARCHAR(1) DEFAULT 'Y', "incCustom" NVARCHAR(1) DEFAULT 'Y', "SeqCode" SMALLINT CS_INT, "Serial" INTEGER CS_INT, "SeriesStr" NVARCHAR(3), "SubStr" NVARCHAR(3), "BuildDesc" NVARCHAR(50), "SupplCode" NVARCHAR(254), "AtcEntry" INTEGER CS_INT, "CustDate" LONGDATE CS_LONGDATE, "BPLId" INTEGER CS_INT, "DPPStatus" NVARCHAR(1) DEFAULT 'N', "EncryptIV" NVARCHAR(100), PRIMARY KEY ("DocEntry")) UNLOAD PRIORITY 5  AUTO MERGE ;
ALTER TABLE "SBODEMOPT"."OIPF" WITH PARAMETERS ('CONCAT_ATTRIBUTE'=('$AgentCode$AgentNum$','AgentCode','AgentNum'));
CREATE UNIQUE INDEX "OIPF_NUM" ON "SBODEMOPT"."OIPF" ( "DocNum" ASC, "Instance" ASC, "Series" ASC );
CREATE INDEX "OIPF_SUPPLIER" ON "SBODEMOPT"."OIPF" ( "CardCode" ASC );
CREATE INDEX "OIPF_AGENT" ON "SBODEMOPT"."OIPF" ( "AgentCode" ASC, "AgentNum" ASC );
CREATE INDEX "OIPF_CURRENCY" ON "SBODEMOPT"."OIPF" ( "DocCur" ASC );
CREATE INDEX "OIPF_SERIES" ON "SBODEMOPT"."OIPF" ( "Series" ASC )