CREATE VIEW "SBODEMODE"."B1_PaymentLinesView" ( "ObjType", "DocNum", "LineId", "InvType", "DocEntry", "AcctCode", "BPLId" ) AS ((((((SELECT T0."ObjType", T0."DocNum", T0."InvoiceId" AS "LineId", T0."InvType", T0."DocEntry", '' AS "AcctCode", T1."BPLId" FROM  "SBODEMODE"."RCT2" T0  INNER  JOIN "SBODEMODE"."B1_MarketingDocumentsView" T1  ON  T1."ObjType" = T0."InvType"  AND  T1."DocEntry" = T0."DocEntry") UNION ALL (SELECT T0."ObjType", T0."DocNum", T0."InvoiceId" AS "LineId", T0."InvType", T0."DocEntry", '' AS "AcctCode", T1."BPLId" FROM  "SBODEMODE"."VPM2" T0  INNER  JOIN "SBODEMODE"."B1_MarketingDocumentsView" T1  ON  T1."ObjType" = T0."InvType"  AND  T1."DocEntry" = T0."DocEntry")) UNION ALL (SELECT T0."ObjType", T0."DocNum", T0."LineId", '' AS "InvType", 0 AS "DocEntry", T0."AcctCode", T1."BPLId" FROM  "SBODEMODE"."RCT4" T0  INNER  JOIN "SBODEMODE"."OACT" T1  ON  T1."AcctCode" = T0."AcctCode"  AND  T1."BPLId" IS NOT NULL   AND  T1."BPLId" > 0)) UNION ALL (SELECT T0."ObjType", T0."DocNum", T0."LineId", '' AS "InvType", 0 AS "DocEntry", T0."AcctCode", T1."BPLId" FROM  "SBODEMODE"."VPM4" T0  INNER  JOIN "SBODEMODE"."OACT" T1  ON  T1."AcctCode" = T0."AcctCode"  AND  T1."BPLId" IS NOT NULL   AND  T1."BPLId" > 0)) UNION ALL (SELECT T0."ObjType", T0."DocNum", T0."LineId", '' AS "InvType", 0 AS "DocEntry", T0."AcctCode", T2."BPLId" FROM  "SBODEMODE"."RCT4" T0  INNER  JOIN "SBODEMODE"."OACT" T1  ON  T1."AcctCode" = T0."AcctCode"  AND  (T1."BPLId" IS NULL   OR  T1."BPLId" <= 0 )  INNER  JOIN "SBODEMODE"."ORCT" T2  ON  T2."DocEntry" = T0."DocNum")) UNION ALL (SELECT T0."ObjType", T0."DocNum", T0."LineId", '' AS "InvType", 0 AS "DocEntry", T0."AcctCode", T2."BPLId" FROM  "SBODEMODE"."VPM4" T0  INNER  JOIN "SBODEMODE"."OACT" T1  ON  T1."AcctCode" = T0."AcctCode"  AND  (T1."BPLId" IS NULL   OR  T1."BPLId" <= 0 )  INNER  JOIN "SBODEMODE"."OVPM" T2  ON  T2."DocEntry" = T0."DocNum")) WITH READ ONLY