CREATE VIEW "SBODEMODE"."B1_JrnlEntryFirstTaxIdOrBPView" ( "TransID", "LineID", "TaxID", "BPCode" ) AS SELECT T0."TransId" AS "TransID", T0."Line_ID" AS "LineID", T0."LicTradNum" AS "TaxID", T0."ShortName" AS "BPCode" FROM  "SBODEMODE"."JDT1" T0  WHERE T0."TransType" = ('30' )  AND  (T0."Line_ID" IN((SELECT MIN(U0."Line_ID") FROM  "SBODEMODE"."JDT1" U0  WHERE U0."TransId" = T0."TransId"  AND  U0."LicTradNum" IS NOT NULL   AND  U0."LicTradNum" <> ('' )  ))   OR  (T0."Line_ID" IN((SELECT MIN(U0."Line_ID") FROM  "SBODEMODE"."JDT1" U0  WHERE U0."TransId" = T0."TransId"  AND  U0."Account" <> U0."ShortName"  AND  (U0."LicTradNum" IS NULL   OR  U0."LicTradNum" = ('' ) ) ))   AND   NOT EXISTS (SELECT U0.*  FROM  "SBODEMODE"."JDT1" U0  WHERE U0."TransId" = T0."TransId"  AND  U0."LicTradNum" IS NOT NULL   AND  U0."LicTradNum" <> ('' )  ) ))