create or replace
FUNCTION FN_ER6_SUM_WO_FG_QTY          ---CREATED BY ANAND DESAI ON 23/10/2012  FOR ER6 REPORT 
(FN_BOM_CODE   IN   BOM.BOM_CODE%TYPE,
 FROM_DATE    IN    DATE,
 TO_DATE      IN    DATE
)
RETURN NUMBER IS
QTY_FG_MANU    NUMBER(20,3);

begin
select SUM(quantity)  into  qty_fg_manu
from   workorder
where  bom_code = fn_bom_code 
AND    REL_DATE BETWEEN FROM_DATE AND TO_DATE;

RETURN(QTY_FG_MANU);

END;