CREATE COLUMN TABLE "SBODEMOPT"."AFAD" ("DocEntry" INTEGER CS_INT NOT NULL , "DocNum" INTEGER CS_INT NOT NULL , "Series" INTEGER CS_INT, "PeriodCat" NVARCHAR(10), "FinncPriod" INTEGER CS_INT, "PostDate" LONGDATE CS_LONGDATE, "DocDate" LONGDATE CS_LONGDATE, "DocStatus" NVARCHAR(1) DEFAULT 'P', "TransId" INTEGER CS_INT, "Comments" NVARCHAR(254), "Reference" NVARCHAR(32), "ObjType" NVARCHAR(20) NOT NULL , "Currency" NVARCHAR(3), "DocRate" DECIMAL(21,6) CS_FIXED, "SysRate" DECIMAL(21,6) CS_FIXED, "PIndicator" NVARCHAR(10) NOT NULL , "DocTotal" DECIMAL(21,6) CS_FIXED, "DocTotalFC" DECIMAL(21,6) CS_FIXED, "DocTotalSy" DECIMAL(21,6) CS_FIXED, "DataSource" NVARCHAR(1) DEFAULT 'N', "UserSign" SMALLINT CS_INT, "LogInstanc" INTEGER CS_INT DEFAULT 0 NOT NULL , "CreateDate" LONGDATE CS_LONGDATE, "UserSign2" SMALLINT CS_INT, "UpdateDate" LONGDATE CS_LONGDATE, "TransType" NVARCHAR(20) DEFAULT '-1', "CreatedBy" INTEGER CS_INT, "JrnlMemo" NVARCHAR(254), "AssetDate" LONGDATE CS_LONGDATE, "CurSource" NVARCHAR(1) DEFAULT 'L', "DocType" NVARCHAR(15) DEFAULT 'PL', "PrjSmarz" NVARCHAR(1) DEFAULT 'N', "DstRlSmarz" NVARCHAR(1) DEFAULT 'N', "ManDprType" NVARCHAR(15), "Handwrtten" NVARCHAR(1) DEFAULT 'N', "CancelDate" LONGDATE CS_LONGDATE, "DprArea" NVARCHAR(15), "BPLId" INTEGER CS_INT, "BaseRef" NVARCHAR(11), "LVARetire" NVARCHAR(1) DEFAULT 'N', "CancelOpt" SMALLINT CS_INT DEFAULT 1, "BPLName" NVARCHAR(100), "VatRegNum" NVARCHAR(32), "GdsMovType" NVARCHAR(2), PRIMARY KEY ("DocEntry", "ObjType", "LogInstanc")) UNLOAD PRIORITY 5  AUTO MERGE ;
CREATE UNIQUE INDEX "AFAD_INDEX" ON "SBODEMOPT"."AFAD" ( "DocNum" ASC, "ObjType" ASC, "LogInstanc" ASC, "PIndicator" ASC )