-- B1 DEPENDS: AFTER:PT:PROCESS_END AFTER:SP:CFF_CREATEDBOBJECTS

CREATE PROCEDURE CFF_FILLBOEACCT () 
LANGUAGE SQLSCRIPT 
SQL SECURITY INVOKER
AS 

BEGIN 	
	
	DELETE FROM "CFF_TMP_BOEACCT";

	INSERT INTO "CFF_TMP_BOEACCT"

	SELECT "CBoERcvble" FROM "OACP" WHERE  "CBoERcvble" IS NOT NULL UNION
	SELECT "CBoEOnClct" FROM "OACP" WHERE  "CBoEOnClct" IS NOT NULL UNION
	SELECT "CBoEPresnt" FROM "OACP" WHERE  "CBoEPresnt" IS NOT NULL UNION
	SELECT "CBoEDiscnt" FROM "OACP" WHERE  "CBoEDiscnt" IS NOT NULL UNION
	SELECT "CUnpaidBoE" FROM "OACP" WHERE  "CUnpaidBoE" IS NOT NULL UNION
	SELECT "VBoEPayble" FROM "OACP" WHERE  "VBoEPayble" IS NOT NULL UNION
	SELECT "VAsstBoEPy" FROM "OACP" WHERE  "VAsstBoEPy" IS NOT NULL UNION
	SELECT DISTINCT "AcctCode" FROM "CRD3" WHERE "AcctType" IN ('R', 'P', 'C', 'S', 'Y', 'I', 'U') ;

END;