CREATE VIEW "SBODEMODE"."B1_PaymentMeansView" ( "PayObjType", "PayAbsEntry", "MeansType", "MeansLine", "MeansAbsEntry", "MeansID", "MeansStrID", "MeansDate", "MeansTotalSum", "DocTotalSum", "MeansPart" ) AS ((((((((((SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 3 AS "MeansType", 1 AS "MeansLine", -1 AS "MeansAbsEntry", -1 AS "MeansID", '' AS "MeansStrID", T0."DocDate" AS "MeansDate", T0."CashSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T0."CashSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."ORCT" T0  WHERE T0."CashSum" <> (0 )) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 1 AS "MeansType", T1."LineID" AS "MeansLine", T1."CheckAbs" AS "MeansAbsEntry", T1."CheckNum" AS "MeansID", '' AS "MeansStrID", T1."DueDate" AS "MeansDate", T1."CheckSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T1."CheckSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."ORCT" T0  INNER  JOIN "SBODEMODE"."RCT1" T1  ON  T1."DocNum" = T0."DocEntry"   WHERE T0."CheckSum" <> (0 ))) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 2 AS "MeansType", 1 AS "MeansLine", -1 AS "MeansAbsEntry", -1 AS "MeansID", T1."DflIBAN" AS "MeansStrID", T0."TrsfrDate" AS "MeansDate", T0."TrsfrSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T0."TrsfrSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."ORCT" T0  INNER  JOIN "SBODEMODE"."OCRD" T1  ON  T1."CardCode" = T0."CardCode"   WHERE T0."TrsfrSum" <> (0 ))) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 4 AS "MeansType", T1."LineID" AS "MeansLine", T1."CreditCard" AS "MeansAbsEntry", T0."DocEntry" AS "MeansID", T1."CrCardNum" AS "MeansStrID", T1."FirstDue" AS "MeansDate", T1."CreditSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T1."CreditSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."ORCT" T0  INNER  JOIN "SBODEMODE"."RCT3" T1  ON  T1."DocNum" = T0."DocEntry"   WHERE T0."CreditSum" <> (0 ))) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 5 AS "MeansType", 1 AS "MeansLine", T0."BoeAbs" AS "MeansAbsEntry", T0."BoeNum" AS "MeansID", '' AS "MeansStrID", T1."DueDate" AS "MeansDate", T0."BoeSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T0."BoeSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."ORCT" T0  INNER  JOIN "SBODEMODE"."OBOE" T1  ON  T1."BoeKey" = T0."BoeAbs"   WHERE T0."BoeSum" <> (0 ))) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 1 AS "MeansType", T1."LineID" AS "MeansLine", T1."CheckAbs" AS "MeansAbsEntry", T1."CheckNum" AS "MeansID", '' AS "MeansStrID", T1."DueDate" AS "MeansDate", T1."CheckSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T1."CheckSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."OVPM" T0  INNER  JOIN "SBODEMODE"."VPM1" T1  ON  T1."DocNum" = T0."DocEntry"   WHERE T0."CheckSum" <> (0 ))) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 2 AS "MeansType", 1 AS "MeansLine", -1 AS "MeansAbsEntry", -1 AS "MeansID", T1."DflIBAN" AS "MeansStrID", T0."TrsfrDate" AS "MeansDate", T0."TrsfrSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T0."TrsfrSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."OVPM" T0  INNER  JOIN "SBODEMODE"."OCRD" T1  ON  T1."CardCode" = T0."CardCode"   WHERE T0."TrsfrSum" <> (0 ))) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 3 AS "MeansType", 1 AS "MeansLine", -1 AS "MeansAbsEntry", -1 AS "MeansID", '' AS "MeansStrID", T0."DocDate" AS "MeansDate", T0."CashSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T0."CashSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."OVPM" T0  WHERE T0."CashSum" <> (0 ))) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 4 AS "MeansType", T1."LineID" AS "MeansLine", T1."CreditCard" AS "MeansAbsEntry", T0."DocEntry" AS "MeansID", T1."CrCardNum" AS "MeansStrID", T1."FirstDue" AS "MeansDate", T1."CreditSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T1."CreditSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."OVPM" T0  INNER  JOIN "SBODEMODE"."VPM3" T1  ON  T1."DocNum" = T0."DocEntry"   WHERE T0."CreditSum" <> (0 ))) UNION ALL (SELECT T0."ObjType" AS "PayObjType", T0."DocEntry" AS "PayAbsEntry", 5 AS "MeansType", 1 AS "MeansLine", T0."BoeAbs" AS "MeansAbsEntry", T0."BoeNum" AS "MeansID", '' AS "MeansStrID", T1."DueDate" AS "MeansDate", T0."BoeSum" AS "MeansTotalSum", T0."DocTotal" AS "DocTotalSum", (T0."BoeSum" / T0."DocTotal") AS "MeansPart" FROM  "SBODEMODE"."OVPM" T0  INNER  JOIN "SBODEMODE"."OBOE" T1  ON  T1."BoeKey" = T0."BoeAbs"   WHERE T0."BoeSum" <> (0 ))) WITH READ ONLY