Apr 19, 2010

Report Triggers Coding...

How to do Report Triggers Coding?


How to write Formula Trigger in Reports? 

function STATUSFormula return Char is



Cursor lpn is


SELECT meaning from mfg_lookups where lookup_type = 'WIP_JOB_STATUS' and lookup_code = :status_type;


l_num_lpn varchar2(50);


begin


open lpn;


fetch lpn into l_num_lpn;


close lpn;


return(l_num_lpn);


end;




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



How to write Formula Trigger in Reports?


function CF_ORG_NAMEFormula return VARCHAR2 is


V_ORG_NAME VARCHAR2(100);


begin


SELECT organization_name


INTO V_ORG_NAME


FROM org_organization_definitions


WHERE organization_id = (fnd_profile.value('ORG_ID'));






return(V_ORG_NAME);


RETURN NULL;


exception


when others then


return(null);


end;






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How to write Function in Trigger in Reports?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~








function CF_UsernameFormula return VARCHAR2 is


uname VARCHAR2(100);






begin






select user_name into uname from fnd_user where user_id=(fnd_profile.value('USER_ID'));


return(uname);


RETURN NULL;








nd;




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~








function CF_trx_qtyFormula return Number is






v_Trx_quantity number;


v_lot_number number;


v_expiration_date date;


begin






Select moq.transaction_quantity


, mln.lot_number


, mln.expiration_date


into


v_Trx_quantity


, :cp_lot_number


, :cp_expiration_date






from mtl_onhand_quantities moq, mtl_lot_numbers mln






where MLN.INVENTORY_ITEM_ID = MOQ.INVENTORY_ITEM_ID


AND moq.organization_id = mln.organization_id


AND MOQ.ORGANIZATION_ID =:P_ORGANIZATION_ID


AND MOQ.INVENTORY_ITEM_ID =:INVENTORY_ITEM_ID;


--AND moq.locator_id =:locator_id1;






-- :cp_expiration_date :=v_expiration_date;


-- :cp_lot_number :=v_lot_number;


SRW.MESSAGE(021, v_Trx_quantity );


SRW.MESSAGE(022, :cp_lot_number );


SRW.MESSAGE(023, :cp_expiration_date );






return(v_Trx_quantity);




exception


when others then


return(null);


SRW.MESSAGE(024,'Error out!!!' );


end;

No comments:

OraApps Search

Custom Search

Search This Blog