CREATE VIEW "SBODEMODE"."OIBT" ( "ItemCode", "BatchNum", "WhsCode", "ItemName", "SuppSerial", "IntrSerial", "ExpDate", "PrdDate", "InDate", "Located", "Notes", "Quantity", "BaseType", "BaseEntry", "BaseNum", "BaseLinNum", "CardCode", "CardName", "CreateDate", "Status", "Direction", "IsCommited", "OnOrder", "Consig", "DataSource", "UserSign", "Transfered", "Instance", "SysNumber", "LogInstanc", "UserSign2", "UpdateDate" ) AS SELECT OBTN."ItemCode"	AS "ItemCode", OBTN."DistNumber"	AS "BatchNum", OBTQ."WhsCode"		AS "WhsCode", OITL."ItemName"	AS "ItemName", OBTN."MnfSerial"	AS "SuppSerial", OBTN."LotNumber"	AS "IntrSerial", OBTN."ExpDate"		AS "ExpDate", OBTN."MnfDate"		AS "PrdDate", OBTN."InDate"		AS "InDate", OBTW."Location"	AS "Located", OBTN."Notes"		AS "Notes", OBTQ."Quantity"	AS "Quantity", OITL."DocType"		AS "BaseType", OITL."DocEntry"	AS "BaseEntry", OITL."DocNum"		AS "BaseNum", OITL."DocLine"		AS "BaseLinNum", ( CASE WHEN OITL."DocType" = 59 OR OITL."DocType" = 60 		OR OITL."DocType" = 10000071 OR OITL."DocType" = 310000001 		OR OITL."DocType" = 58 THEN NULL ELSE OITL."CardCode" END )			AS "CardCode", ( 	CASE WHEN OITL."DocType" = 59 OR OITL."DocType" = 60 			OR OITL."DocType" = 10000071 OR OITL."DocType" = 310000001 			OR OITL."DocType" = 58 THEN NULL 	ELSE OITL."CardName" END )			AS "CardName", OBTN."CreateDate"	AS "CreateDate", OBTN."Status"		AS "Status", 0			AS "Direction", OBTQ."CommitQty"	AS "IsCommited", 0			AS "OnOrder", 0			AS "Consig", OBTN."DataSource"	AS "DataSource", OBTN."UserSign"	AS "UserSign", OBTN."Transfered"	AS "Transfered", OBTN."Instance"	AS "Instance", OBTN."SysNumber"	AS "SysNumber", OBTN."LogInstanc"	AS "LogInstanc", OBTN."UserSign2"	AS "UserSign2", OBTN."UpdateDate"	AS "UpdateDate" FROM		OBTN LEFT JOIN	OBTQ OBTQ ON OBTN."ItemCode" = OBTQ."ItemCode" AND OBTN."SysNumber" = OBTQ."SysNumber" INNER JOIN	OBTW OBTW ON OBTN."ItemCode" = OBTW."ItemCode" AND OBTN."SysNumber" = OBTW."SysNumber" AND OBTQ."WhsCode" = OBTW."WhsCode" INNER JOIN OITL ON OITL."LogEntry" IN ( SELECT MIN(T1."LogEntry") AS "LogEntry" FROM OITL T1 INNER JOIN ITL1 T2 ON T1."LogEntry" = T2."LogEntry" AND T1."ItemCode" = T2."ItemCode" AND T1."ItemCode" = OITL."ItemCode" AND T2."SysNumber" = OBTN."SysNumber" GROUP BY T1."ItemCode", T2."SysNumber" ) AND OITL."ItemCode" = OBTN."ItemCode" WITH READ ONLY