CREATE COLUMN TABLE "IMCYC"."INV1" ("DocEntry" INTEGER CS_INT NOT NULL , "LineNum" INTEGER CS_INT NOT NULL , "TargetType" INTEGER CS_INT DEFAULT -1, "TrgetEntry" INTEGER CS_INT, "BaseRef" NVARCHAR(16), "BaseType" INTEGER CS_INT DEFAULT -1, "BaseEntry" INTEGER CS_INT, "BaseLine" INTEGER CS_INT, "LineStatus" CHAR(1) CS_FIXEDSTRING DEFAULT 'O', "ItemCode" NVARCHAR(50), "Dscription" NVARCHAR(100), "Quantity" DECIMAL(21,6) CS_FIXED, "ShipDate" LONGDATE CS_LONGDATE, "OpenQty" DECIMAL(21,6) CS_FIXED, "Price" DECIMAL(21,6) CS_FIXED, "Currency" NVARCHAR(3), "Rate" DECIMAL(21,6) CS_FIXED, "DiscPrcnt" DECIMAL(21,6) CS_FIXED, "LineTotal" DECIMAL(21,6) CS_FIXED, "TotalFrgn" DECIMAL(21,6) CS_FIXED, "OpenSum" DECIMAL(21,6) CS_FIXED, "OpenSumFC" DECIMAL(21,6) CS_FIXED, "VendorNum" NVARCHAR(50), "SerialNum" NVARCHAR(17), "WhsCode" NVARCHAR(8), "SlpCode" INTEGER CS_INT DEFAULT -1, "Commission" DECIMAL(21,6) CS_FIXED, "TreeType" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "AcctCode" NVARCHAR(15), "TaxStatus" CHAR(1) CS_FIXEDSTRING, "GrossBuyPr" DECIMAL(21,6) CS_FIXED, "PriceBefDi" DECIMAL(21,6) CS_FIXED, "DocDate" LONGDATE CS_LONGDATE, "Flags" INTEGER CS_INT DEFAULT 0, "OpenCreQty" DECIMAL(21,6) CS_FIXED, "UseBaseUn" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "SubCatNum" NVARCHAR(50), "BaseCard" NVARCHAR(15), "TotalSumSy" DECIMAL(21,6) CS_FIXED, "OpenSumSys" DECIMAL(21,6) CS_FIXED, "InvntSttus" CHAR(1) CS_FIXEDSTRING DEFAULT 'O', "OcrCode" NVARCHAR(8), "Project" NVARCHAR(20), "CodeBars" NVARCHAR(254), "VatPrcnt" DECIMAL(21,6) CS_FIXED, "VatGroup" NVARCHAR(8), "PriceAfVAT" DECIMAL(21,6) CS_FIXED, "Height1" DECIMAL(21,6) CS_FIXED, "Hght1Unit" SMALLINT CS_INT, "Height2" DECIMAL(21,6) CS_FIXED, "Hght2Unit" SMALLINT CS_INT, "Width1" DECIMAL(21,6) CS_FIXED, "Wdth1Unit" SMALLINT CS_INT, "Width2" DECIMAL(21,6) CS_FIXED, "Wdth2Unit" SMALLINT CS_INT, "Length1" DECIMAL(21,6) CS_FIXED, "Len1Unit" SMALLINT CS_INT, "length2" DECIMAL(21,6) CS_FIXED, "Len2Unit" SMALLINT CS_INT, "Volume" DECIMAL(21,6) CS_FIXED, "VolUnit" SMALLINT CS_INT, "Weight1" DECIMAL(21,6) CS_FIXED, "Wght1Unit" SMALLINT CS_INT, "Weight2" DECIMAL(21,6) CS_FIXED, "Wght2Unit" SMALLINT CS_INT, "Factor1" DECIMAL(21,6) CS_FIXED, "Factor2" DECIMAL(21,6) CS_FIXED, "Factor3" DECIMAL(21,6) CS_FIXED, "Factor4" DECIMAL(21,6) CS_FIXED, "PackQty" DECIMAL(21,6) CS_FIXED, "UpdInvntry" CHAR(1) CS_FIXEDSTRING DEFAULT 'Y', "BaseDocNum" INTEGER CS_INT, "BaseAtCard" NVARCHAR(100), "SWW" NVARCHAR(16), "VatSum" DECIMAL(21,6) CS_FIXED, "VatSumFrgn" DECIMAL(21,6) CS_FIXED, "VatSumSy" DECIMAL(21,6) CS_FIXED, "FinncPriod" INTEGER CS_INT, "ObjType" NVARCHAR(20) DEFAULT '13', "LogInstanc" INTEGER CS_INT DEFAULT 0, "BlockNum" NVARCHAR(100), "ImportLog" NVARCHAR(20), "DedVatSum" DECIMAL(21,6) CS_FIXED, "DedVatSumF" DECIMAL(21,6) CS_FIXED, "DedVatSumS" DECIMAL(21,6) CS_FIXED, "IsAqcuistn" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "DistribSum" DECIMAL(21,6) CS_FIXED, "DstrbSumFC" DECIMAL(21,6) CS_FIXED, "DstrbSumSC" DECIMAL(21,6) CS_FIXED, "GrssProfit" DECIMAL(21,6) CS_FIXED, "GrssProfSC" DECIMAL(21,6) CS_FIXED, "GrssProfFC" DECIMAL(21,6) CS_FIXED, "VisOrder" INTEGER CS_INT, "INMPrice" DECIMAL(21,6) CS_FIXED, "PoTrgNum" INTEGER CS_INT, "PoTrgEntry" NVARCHAR(11), "DropShip" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "PoLineNum" INTEGER CS_INT, "Address" NVARCHAR(254), "TaxCode" NVARCHAR(8), "TaxType" CHAR(1) CS_FIXEDSTRING, "OrigItem" NVARCHAR(50), "BackOrdr" CHAR(1) CS_FIXEDSTRING, "FreeTxt" NVARCHAR(100), "PickStatus" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "PickOty" DECIMAL(21,6) CS_FIXED, "PickIdNo" INTEGER CS_INT, "TrnsCode" SMALLINT CS_INT DEFAULT -1, "VatAppld" DECIMAL(21,6) CS_FIXED, "VatAppldFC" DECIMAL(21,6) CS_FIXED, "VatAppldSC" DECIMAL(21,6) CS_FIXED, "BaseQty" DECIMAL(21,6) CS_FIXED, "BaseOpnQty" DECIMAL(21,6) CS_FIXED, "VatDscntPr" DECIMAL(21,6) CS_FIXED, "WtLiable" CHAR(1) CS_FIXEDSTRING, "DeferrTax" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "EquVatPer" DECIMAL(21,6) CS_FIXED, "EquVatSum" DECIMAL(21,6) CS_FIXED, "EquVatSumF" DECIMAL(21,6) CS_FIXED, "EquVatSumS" DECIMAL(21,6) CS_FIXED, "LineVat" DECIMAL(21,6) CS_FIXED, "LineVatlF" DECIMAL(21,6) CS_FIXED, "LineVatS" DECIMAL(21,6) CS_FIXED, "unitMsr" NVARCHAR(100), "NumPerMsr" DECIMAL(21,6) CS_FIXED, "CEECFlag" CHAR(1) CS_FIXEDSTRING DEFAULT 'S', "ToStock" DECIMAL(21,6) CS_FIXED, "ToDiff" DECIMAL(21,6) CS_FIXED, "ExciseAmt" DECIMAL(21,6) CS_FIXED, "TaxPerUnit" DECIMAL(21,6) CS_FIXED, "TotInclTax" DECIMAL(21,6) CS_FIXED, "CountryOrg" NVARCHAR(3), "StckDstSum" DECIMAL(21,6) CS_FIXED, "ReleasQtty" DECIMAL(21,6) CS_FIXED, "LineType" CHAR(1) CS_FIXEDSTRING DEFAULT 'R', "TranType" CHAR(1) CS_FIXEDSTRING, "Text" NCLOB MEMORY THRESHOLD 1000, "OwnerCode" INTEGER CS_INT, "StockPrice" DECIMAL(21,6) CS_FIXED, "ConsumeFCT" CHAR(1) CS_FIXEDSTRING, "LstByDsSum" DECIMAL(21,6) CS_FIXED, "StckINMPr" DECIMAL(21,6) CS_FIXED, "LstBINMPr" DECIMAL(21,6) CS_FIXED, "StckDstFc" DECIMAL(21,6) CS_FIXED, "StckDstSc" DECIMAL(21,6) CS_FIXED, "LstByDsFc" DECIMAL(21,6) CS_FIXED, "LstByDsSc" DECIMAL(21,6) CS_FIXED, "StockSum" DECIMAL(21,6) CS_FIXED, "StockSumFc" DECIMAL(21,6) CS_FIXED, "StockSumSc" DECIMAL(21,6) CS_FIXED, "StckSumApp" DECIMAL(21,6) CS_FIXED, "StckAppFc" DECIMAL(21,6) CS_FIXED, "StckAppSc" DECIMAL(21,6) CS_FIXED, "ShipToCode" NVARCHAR(50), "ShipToDesc" NVARCHAR(254), "StckAppD" DECIMAL(21,6) CS_FIXED, "StckAppDFC" DECIMAL(21,6) CS_FIXED, "StckAppDSC" DECIMAL(21,6) CS_FIXED, "BasePrice" CHAR(1) CS_FIXEDSTRING DEFAULT 'E', "GTotal" DECIMAL(21,6) CS_FIXED, "GTotalFC" DECIMAL(21,6) CS_FIXED, "GTotalSC" DECIMAL(21,6) CS_FIXED, "DistribExp" CHAR(1) CS_FIXEDSTRING, "DescOW" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "DetailsOW" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "GrossBase" SMALLINT CS_INT, "VatWoDpm" DECIMAL(21,6) CS_FIXED, "VatWoDpmFc" DECIMAL(21,6) CS_FIXED, "VatWoDpmSc" DECIMAL(21,6) CS_FIXED, "CFOPCode" NVARCHAR(6), "CSTCode" NVARCHAR(6), "Usage" INTEGER CS_INT, "TaxOnly" CHAR(1) CS_FIXEDSTRING, "WtCalced" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "QtyToShip" DECIMAL(21,6) CS_FIXED, "DelivrdQty" DECIMAL(21,6) CS_FIXED, "OrderedQty" DECIMAL(21,6) CS_FIXED, "CogsOcrCod" NVARCHAR(8), "CiOppLineN" INTEGER CS_INT DEFAULT -1, "CogsAcct" NVARCHAR(15), "ChgAsmBoMW" CHAR(1) CS_FIXEDSTRING, "ActDelDate" LONGDATE CS_LONGDATE, "OcrCode2" NVARCHAR(8), "OcrCode3" NVARCHAR(8), "OcrCode4" NVARCHAR(8), "OcrCode5" NVARCHAR(8), "TaxDistSum" DECIMAL(21,6) CS_FIXED, "TaxDistSFC" DECIMAL(21,6) CS_FIXED, "TaxDistSSC" DECIMAL(21,6) CS_FIXED, "PostTax" CHAR(1) CS_FIXEDSTRING DEFAULT 'Y', "Excisable" CHAR(1) CS_FIXEDSTRING, "AssblValue" DECIMAL(21,6) CS_FIXED, "RG23APart1" INTEGER CS_INT, "RG23APart2" INTEGER CS_INT, "RG23CPart1" INTEGER CS_INT, "RG23CPart2" INTEGER CS_INT, "CogsOcrCo2" NVARCHAR(8), "CogsOcrCo3" NVARCHAR(8), "CogsOcrCo4" NVARCHAR(8), "CogsOcrCo5" NVARCHAR(8), "LnExcised" CHAR(1) CS_FIXEDSTRING, "LocCode" INTEGER CS_INT, "StockValue" DECIMAL(21,6) CS_FIXED, "GPTtlBasPr" DECIMAL(21,6) CS_FIXED, "unitMsr2" NVARCHAR(100), "NumPerMsr2" DECIMAL(21,6) CS_FIXED, "SpecPrice" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "CSTfIPI" NVARCHAR(2), "CSTfPIS" NVARCHAR(2), "CSTfCOFINS" NVARCHAR(2), "ExLineNo" NVARCHAR(10), "isSrvCall" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "PQTReqQty" DECIMAL(21,6) CS_FIXED, "PQTReqDate" LONGDATE CS_LONGDATE, "PcDocType" INTEGER CS_INT DEFAULT -1, "PcQuantity" DECIMAL(21,6) CS_FIXED, "LinManClsd" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "VatGrpSrc" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "NoInvtryMv" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "ActBaseEnt" INTEGER CS_INT, "ActBaseLn" INTEGER CS_INT, "ActBaseNum" INTEGER CS_INT, "OpenRtnQty" DECIMAL(21,6) CS_FIXED, "AgrNo" INTEGER CS_INT, "AgrLnNum" INTEGER CS_INT, "CredOrigin" CHAR(1) CS_FIXEDSTRING, "Surpluses" DECIMAL(21,6) CS_FIXED, "DefBreak" DECIMAL(21,6) CS_FIXED, "Shortages" DECIMAL(21,6) CS_FIXED, "UomEntry" INTEGER CS_INT DEFAULT 0, "UomEntry2" INTEGER CS_INT DEFAULT 0, "UomCode" NVARCHAR(20), "UomCode2" NVARCHAR(20), "FromWhsCod" NVARCHAR(8), "NeedQty" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "PartRetire" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "RetireQty" DECIMAL(21,6) CS_FIXED, "RetireAPC" DECIMAL(21,6) CS_FIXED, "RetirAPCFC" DECIMAL(21,6) CS_FIXED, "RetirAPCSC" DECIMAL(21,6) CS_FIXED, "InvQty" DECIMAL(21,6) CS_FIXED, "OpenInvQty" DECIMAL(21,6) CS_FIXED, "EnSetCost" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "RetCost" DECIMAL(21,6) CS_FIXED, "Incoterms" INTEGER CS_INT DEFAULT 0, "TransMod" INTEGER CS_INT DEFAULT 0, "LineVendor" NVARCHAR(15), "DistribIS" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "ISDistrb" DECIMAL(21,6) CS_FIXED, "ISDistrbFC" DECIMAL(21,6) CS_FIXED, "ISDistrbSC" DECIMAL(21,6) CS_FIXED, "IsByPrdct" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "ItemType" INTEGER CS_INT DEFAULT 4, "PriceEdit" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "PrntLnNum" INTEGER CS_INT, "LinePoPrss" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "FreeChrgBP" CHAR(1) CS_FIXEDSTRING, "TaxRelev" CHAR(1) CS_FIXEDSTRING DEFAULT 'Y', "LegalText" NVARCHAR(254), "ThirdParty" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "LicTradNum" NVARCHAR(32), "InvQtyOnly" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "UnencReasn" INTEGER CS_INT, "ShipFromCo" NVARCHAR(50), "ShipFromDe" NVARCHAR(254), "FisrtBin" NVARCHAR(228), "AllocBinC" NVARCHAR(11), "ExpType" NVARCHAR(4), "ExpUUID" NVARCHAR(50), "ExpOpType" CHAR(1) CS_FIXEDSTRING, "DIOTNat" NVARCHAR(3), "MYFtype" NVARCHAR(2), "ItmTaxType" NVARCHAR(2), "SacEntry" INTEGER CS_INT, "NCMCode" INTEGER CS_INT DEFAULT -1, "HsnEntry" INTEGER CS_INT, "U_FOLIO" NVARCHAR(40), "U_RFC" NVARCHAR(50), "U_RAZON_SOCIAL" NVARCHAR(50), "U_BXP_U_CCO" NVARCHAR(3) NOT NULL , PRIMARY KEY INVERTED VALUE ("DocEntry", "LineNum")) UNLOAD PRIORITY 0  AUTO MERGE ;
ALTER TABLE "IMCYC"."INV1" WITH PARAMETERS ('CONCAT_ATTRIBUTE'=('$BaseEntry$BaseType$BaseLine$','BaseEntry','BaseType','BaseLine'));
ALTER TABLE "IMCYC"."INV1" WITH PARAMETERS ('CONCAT_ATTRIBUTE'=('$DocEntry$VisOrder$','DocEntry','VisOrder'));
ALTER TABLE "IMCYC"."INV1" WITH PARAMETERS ('CONCAT_ATTRIBUTE'=('$ItemCode$WhsCode$OpenQty$','ItemCode','WhsCode','OpenQty'));
CREATE INDEX "INV1_STATUS" ON "IMCYC"."INV1" ( "LineStatus" ASC );
CREATE INDEX "INV1_CURRENCY" ON "IMCYC"."INV1" ( "Currency" ASC );
CREATE INDEX "INV1_ACCOUNT" ON "IMCYC"."INV1" ( "AcctCode" ASC );
CREATE INDEX "INV1_BASE_ENTRY" ON "IMCYC"."INV1" ( "BaseEntry" ASC, "BaseType" ASC, "BaseLine" ASC );
CREATE INDEX "INV1_VIS_ORDER" ON "IMCYC"."INV1" ( "DocEntry" ASC, "VisOrder" ASC );
CREATE INDEX "INV1_OWNER_CODE" ON "IMCYC"."INV1" ( "OwnerCode" ASC );
CREATE INDEX "INV1_ITM_WHS_OQ" ON "IMCYC"."INV1" ( "ItemCode" ASC, "WhsCode" ASC, "OpenQty" ASC )