CREATE COLUMN TABLE "SBODEMODE"."AJD1" ("TransId" INTEGER CS_INT NOT NULL , "Line_ID" INTEGER CS_INT DEFAULT 0 NOT NULL , "Account" NVARCHAR(15), "Debit" DECIMAL(21,6) CS_FIXED, "Credit" DECIMAL(21,6) CS_FIXED, "SYSCred" DECIMAL(21,6) CS_FIXED, "SYSDeb" DECIMAL(21,6) CS_FIXED, "FCDebit" DECIMAL(21,6) CS_FIXED, "FCCredit" DECIMAL(21,6) CS_FIXED, "FCCurrency" NVARCHAR(3), "DueDate" LONGDATE CS_LONGDATE, "SourceID" INTEGER CS_INT, "SourceLine" SMALLINT CS_INT, "ShortName" NVARCHAR(15), "IntrnMatch" INTEGER CS_INT DEFAULT 0, "ExtrMatch" INTEGER CS_INT DEFAULT 0, "ContraAct" NVARCHAR(15), "LineMemo" NVARCHAR(254), "Ref3Line" NVARCHAR(200), "TransType" NVARCHAR(20) DEFAULT '-1', "RefDate" LONGDATE CS_LONGDATE, "Ref2Date" LONGDATE CS_LONGDATE, "Ref1" NVARCHAR(200), "Ref2" NVARCHAR(200), "CreatedBy" INTEGER CS_INT, "BaseRef" NVARCHAR(11), "Project" NVARCHAR(20), "TransCode" NVARCHAR(4), "ProfitCode" NVARCHAR(8), "TaxDate" LONGDATE CS_LONGDATE, "SystemRate" DECIMAL(21,6) CS_FIXED, "MthDate" LONGDATE CS_LONGDATE, "ToMthSum" DECIMAL(21,6) CS_FIXED, "UserSign" SMALLINT CS_INT, "BatchNum" INTEGER CS_INT, "FinncPriod" INTEGER CS_INT, "RelTransId" INTEGER CS_INT DEFAULT -1, "RelLineID" INTEGER CS_INT DEFAULT -1, "RelType" NVARCHAR(1) DEFAULT 'N', "LogInstanc" INTEGER CS_INT DEFAULT 0 NOT NULL , "VatGroup" NVARCHAR(8), "BaseSum" DECIMAL(21,6) CS_FIXED, "VatRate" DECIMAL(21,6) CS_FIXED, "Indicator" NVARCHAR(2), "AdjTran" NVARCHAR(1) DEFAULT 'N', "RevSource" NVARCHAR(1) DEFAULT 'N', "ObjType" NVARCHAR(20) DEFAULT '30', "VatDate" LONGDATE CS_LONGDATE, "PaymentRef" NVARCHAR(27), "SYSBaseSum" DECIMAL(21,6) CS_FIXED, "MultMatch" INTEGER CS_INT DEFAULT 0, "VatLine" NVARCHAR(1) DEFAULT 'N', "VatAmount" DECIMAL(21,6) CS_FIXED, "SYSVatSum" DECIMAL(21,6) CS_FIXED, "Closed" NVARCHAR(1) DEFAULT 'N', "GrossValue" DECIMAL(21,6) CS_FIXED, "CheckAbs" INTEGER CS_INT, "LineType" INTEGER CS_INT DEFAULT 0, "DebCred" NVARCHAR(1), "SequenceNr" INTEGER CS_INT DEFAULT 0, "StornoAcc" NVARCHAR(15), "BalDueDeb" DECIMAL(21,6) CS_FIXED, "BalDueCred" DECIMAL(21,6) CS_FIXED, "BalFcDeb" DECIMAL(21,6) CS_FIXED, "BalFcCred" DECIMAL(21,6) CS_FIXED, "BalScDeb" DECIMAL(21,6) CS_FIXED, "BalScCred" DECIMAL(21,6) CS_FIXED, "IsNet" NVARCHAR(1) DEFAULT 'Y', "DunWizBlck" NVARCHAR(1) DEFAULT 'N', "DunnLevel" INTEGER CS_INT DEFAULT 0, "DunDate" LONGDATE CS_LONGDATE, "TaxType" SMALLINT CS_INT DEFAULT 0, "TaxPostAcc" NVARCHAR(1) DEFAULT 'N', "StaCode" NVARCHAR(8), "StaType" INTEGER CS_INT, "TaxCode" NVARCHAR(8), "ValidFrom" LONGDATE CS_LONGDATE DEFAULT '19000101', "GrossValFc" DECIMAL(21,6) CS_FIXED, "LvlUpdDate" LONGDATE CS_LONGDATE, "OcrCode2" NVARCHAR(8), "OcrCode3" NVARCHAR(8), "OcrCode4" NVARCHAR(8), "OcrCode5" NVARCHAR(8), "MIEntry" INTEGER CS_INT DEFAULT 0, "MIVEntry" INTEGER CS_INT DEFAULT 0, "ClsInTP" INTEGER CS_INT DEFAULT 0, "CenVatCom" INTEGER CS_INT DEFAULT -1, "MatType" INTEGER CS_INT DEFAULT -1, "PstngType" INTEGER CS_INT DEFAULT 0, "ValidFrom2" LONGDATE CS_LONGDATE DEFAULT '19000101', "ValidFrom3" LONGDATE CS_LONGDATE DEFAULT '19000101', "ValidFrom4" LONGDATE CS_LONGDATE DEFAULT '19000101', "ValidFrom5" LONGDATE CS_LONGDATE DEFAULT '19000101', "Location" INTEGER CS_INT, "WTaxCode" NVARCHAR(4), "EquVatRate" DECIMAL(21,6) CS_FIXED, "EquVatSum" DECIMAL(21,6) CS_FIXED, "SYSEquSum" DECIMAL(21,6) CS_FIXED, "TotalVat" DECIMAL(21,6) CS_FIXED, "SYSTVat" DECIMAL(21,6) CS_FIXED, "WTLiable" NVARCHAR(1) DEFAULT 'N', "WTLine" NVARCHAR(1) DEFAULT 'N', "WTApplied" DECIMAL(21,6) CS_FIXED, "WTAppliedS" DECIMAL(21,6) CS_FIXED, "WTAppliedF" DECIMAL(21,6) CS_FIXED, "WTSum" DECIMAL(21,6) CS_FIXED, "WTSumFC" DECIMAL(21,6) CS_FIXED, "WTSumSC" DECIMAL(21,6) CS_FIXED, "PayBlock" NVARCHAR(1) DEFAULT 'N', "PayBlckRef" INTEGER CS_INT, "LicTradNum" NVARCHAR(32), "InterimTyp" INTEGER CS_INT DEFAULT 0, "DprId" INTEGER CS_INT, "MatchRef" NVARCHAR(20), "Ordered" NVARCHAR(1) DEFAULT 'N', "CUP" INTEGER CS_INT, "CIG" INTEGER CS_INT, "BPLId" INTEGER CS_INT, "BPLName" NVARCHAR(200), "VatRegNum" NVARCHAR(32), "SLEDGERF" NVARCHAR(1), "InitRef2" NVARCHAR(100), "InitRef3Ln" NVARCHAR(27), "ExpUUID" NVARCHAR(50), "ExpOPType" NVARCHAR(1), "ExTransId" INTEGER CS_INT, "DocArr" SMALLINT CS_INT, "DocLine" INTEGER CS_INT, "MYFtype" NVARCHAR(2), "DocEntry" INTEGER CS_INT, "DocNum" INTEGER CS_INT, "DocType" NVARCHAR(20), "DocSubType" NVARCHAR(2), "RmrkTmpt" INTEGER CS_INT, "CemCode" NVARCHAR(20), "InClassCat" INTEGER CS_INT, "InClassTyp" INTEGER CS_INT, "ExClassCat" INTEGER CS_INT, "ExClassTyp" INTEGER CS_INT, "VATClassCa" INTEGER CS_INT, "VATClassTy" INTEGER CS_INT, "EVatCate" INTEGER CS_INT, "EWtPercCat" INTEGER CS_INT, "EWtAmount" DECIMAL(21,6) CS_FIXED, "EBVatExCau" INTEGER CS_INT, "OrgBPName" NVARCHAR(200), "OrgAccName" NVARCHAR(200), "AllocNum" NVARCHAR(50), "EncryptIV" NVARCHAR(100), "EnLicTradN" NCLOB MEMORY THRESHOLD 1000, PRIMARY KEY ("TransId", "Line_ID", "LogInstanc")) UNLOAD PRIORITY 5  AUTO MERGE ;
ALTER TABLE "SBODEMODE"."AJD1" WITH PARAMETERS ('CONCAT_ATTRIBUTE'=('$ShortName$IntrnMatch$','ShortName','IntrnMatch'));
ALTER TABLE "SBODEMODE"."AJD1" WITH PARAMETERS ('CONCAT_ATTRIBUTE'=('$Account$IntrnMatch$','Account','IntrnMatch'));
CREATE CPBTREE INDEX "AJD1_SHORT_NAME" ON "SBODEMODE"."AJD1" ( "ShortName" ASC, "IntrnMatch" ASC );
CREATE CPBTREE INDEX "AJD1_ACCOUNT" ON "SBODEMODE"."AJD1" ( "Account" ASC, "IntrnMatch" ASC );
CREATE CPBTREE INDEX "AJD1_TRANS_TYPE" ON "SBODEMODE"."AJD1" ( "TransType" ASC );
CREATE CPBTREE INDEX "AJD1_PROFIT_ID" ON "SBODEMODE"."AJD1" ( "ProfitCode" ASC );
CREATE CPBTREE INDEX "AJD1_CURRENCY" ON "SBODEMODE"."AJD1" ( "FCCurrency" ASC );
CREATE CPBTREE INDEX "AJD1_DUEDATE" ON "SBODEMODE"."AJD1" ( "DueDate" ASC );
CREATE CPBTREE INDEX "AJD1_REFDATE" ON "SBODEMODE"."AJD1" ( "RefDate" ASC )