CREATE VIEW "SBODEMODE"."B1_ElectronicDocumentLogViewMX" ( "AbsEntry", "Code", "ActType", "ActStatus", "ActDesc", "ActMessage", "ActEnv", "SrcObjType", "SrcObjAbs", "Submits", "SendDate", "SendTime", "LogOpDate", "UserSign", "CreateDate", "UserSign2", "UpdateDate", "IsRemoved", "Cancelation", "SendData", "RecvData", "UUID", "DocNum", "Series", "DocCanceled", "CardCode", "CardName", "DocCreateDate", "DocCreateTime", "ReceptorRFC", "TestMode", "EmisorRFC", "GenType", "BPLId" ) AS (((SELECT T0."AbsEntry", T0."Code", T0."ActType", T0."ActStatus", T0."ActDesc", T0."ActMessage", T0."ActEnv", T0."SrcObjType", T0."SrcObjAbs", T0."Submits", T3."LogOpDate" AS "SendDate", T3."LogOpTS" AS "SendTime", T4."LogOpDate", T0."UserSign", T0."CreateDate", T0."UserSign2", T0."UpdateDate", T0."IsRemoved", T0."Cancel" AS "Cancelation", T3."LogData" AS "SendData", T4."LogData" AS "RecvData", T0."ReportID" AS "UUID", T1."DocNum", T1."Series", T1."CANCELED" AS "DocCanceled", T1."CardCode", T1."CardName", T1."CreateDate" AS "DocCreateDate", T1."CreateTS" AS "DocCreateTime", T1."LicTradNum" AS "ReceptorRFC", T0."TestMode", T2."TaxIdNum" AS "EmisorRFC", T0."GenType" AS "GenType", T0."BPLId" FROM  "SBODEMODE"."ECM2" T0   LEFT OUTER  JOIN "SBODEMODE"."B1_AllDocumentsView_EDF" T1  ON  T1."ObjType" = T0."SrcObjType"  AND  T1."DocEntry" = T0."SrcObjAbs"  AND  ((T1."IsDraft" = 'Y'  AND  T0."ActType" = 5 ) OR  (T1."IsDraft" = 'N'  AND  T0."ActType" IN(3 ,4 ,11 ,12 ,13 ,14 ,15 )  ))   LEFT OUTER  JOIN "SBODEMODE"."OADM" T2  ON  T2."Code" = 1    LEFT OUTER  JOIN "SBODEMODE"."B1_EDFLatestLogsView" T3  ON  T3."AbsEntry" = T0."AbsEntry"  AND  T3."LogType" = 'S'    LEFT OUTER  JOIN "SBODEMODE"."B1_EDFLatestLogsView" T4  ON  T4."AbsEntry" = T0."AbsEntry"  AND  T4."LogType" = 'R'   WHERE T0."SrcObjType" NOT IN('24' ,'321' )) UNION ALL (SELECT T0."AbsEntry", T0."Code", T0."ActType", T0."ActStatus", T0."ActDesc", T0."ActMessage", T0."ActEnv", T0."SrcObjType", T0."SrcObjAbs", T0."Submits", T3."LogOpDate" AS "SendDate", T3."LogOpTS" AS "SendTime", T4."LogOpDate", T0."UserSign", T0."CreateDate", T0."UserSign2", T0."UpdateDate", T0."IsRemoved", T0."Cancel" AS "Cancelation", T3."LogData" AS "SendData", T4."LogData" AS "RecvData", T0."ReportID" AS "UUID", T1."DocNum", T1."Series", T1."Canceled" AS "DocCanceled", T1."CardCode", T1."CardName", T1."CreateDate" AS "DocCreateDate", T1."CreateTS" AS "DocCreateTime", T1."Comments" AS "ReceptorRFC", T0."TestMode", T2."TaxIdNum" AS "EmisorRFC", T0."GenType" AS "GenType", T0."BPLId" FROM  "SBODEMODE"."ECM2" T0   LEFT OUTER  JOIN "SBODEMODE"."B1_PaymentsView" T1  ON  T1."ObjType" = T0."SrcObjType"  AND  T1."DocEntry" = T0."SrcObjAbs"    LEFT OUTER  JOIN "SBODEMODE"."OADM" T2  ON  T2."Code" = 1    LEFT OUTER  JOIN "SBODEMODE"."B1_EDFLatestLogsView" T3  ON  T3."AbsEntry" = T0."AbsEntry"  AND  T3."LogType" = 'S'    LEFT OUTER  JOIN "SBODEMODE"."B1_EDFLatestLogsView" T4  ON  T4."AbsEntry" = T0."AbsEntry"  AND  T4."LogType" = 'R'   WHERE T0."SrcObjType" = ('24' ))) UNION ALL (SELECT T0."AbsEntry", T0."Code", T0."ActType", T0."ActStatus", T0."ActDesc", T0."ActMessage", T0."ActEnv", T0."SrcObjType", T0."SrcObjAbs", T0."Submits", T5."LogOpDate" AS "SendDate", T5."LogOpTS" AS "SendTime", T6."LogOpDate", T0."UserSign", T0."CreateDate", T0."UserSign2", T0."UpdateDate", T0."IsRemoved", T0."Cancel" AS "Cancelation", T5."LogData" AS "SendData", T6."LogData" AS "RecvData", T0."ReportID" AS "UUID", T1."ReconNum" AS "DocNum", 0 AS "Series", T1."Canceled" AS "DocCanceled", T2."ShortName" AS "CardCode", T3."CardName", T1."CreateDate" AS "DocCreateDate", T1."CreateTS" AS "DocCreateTime", T3."LicTradNum" AS "ReceptorRFC", T0."TestMode", T4."TaxIdNum" AS "EmisorRFC", T0."GenType" AS "GenType", T0."BPLId" FROM  "SBODEMODE"."ECM2" T0   LEFT OUTER  JOIN "SBODEMODE"."OITR" T1  ON  T1."ReconNum" = T0."SrcObjAbs"  AND  T1."IsCard" = 'C'    LEFT OUTER  JOIN "SBODEMODE"."ITR1" T2  ON  T2."ReconNum" = T0."SrcObjAbs"  AND  T2."LineSeq" = 0    LEFT OUTER  JOIN "SBODEMODE"."OCRD" T3  ON  T3."CardCode" = T2."ShortName"    LEFT OUTER  JOIN "SBODEMODE"."OADM" T4  ON  T4."Code" = 1    LEFT OUTER  JOIN "SBODEMODE"."B1_EDFLatestLogsView" T5  ON  T5."AbsEntry" = T0."AbsEntry"  AND  T5."LogType" = 'S'    LEFT OUTER  JOIN "SBODEMODE"."B1_EDFLatestLogsView" T6  ON  T6."AbsEntry" = T0."AbsEntry"  AND  T6."LogType" = 'R'   WHERE T0."SrcObjType" = ('321' ))) WITH READ ONLY