You are on page 1of 6

Business Events in Oracle Applications

http://oracleapps-atechniciansview.blogspot.com/

Ashish Harbhajanka

Email: ashish1234u@gmail.com

Hi, It is after a very long break that I am writing a post, this time about a very powerful and very lesser known feature namely Business Events System. Business Events are often confused with Oracle Workflow. There are almost 600 delivered Business Events in Oracle Applications in 11i and probably the number goes to 900 for R12. An event can be defined as any transaction activity having specific importance like employee creation, assignment update, gl period close, gl period reopened, fa asset creation, fa asset retire etc and many more. Now, since Oracle Application s has numerous forms and tables and so to keep the data in sync at time on performing a certain action child tables needs to be updated , this is usually done by calling the Business Events, Business Events ( referred as BE from here on) are capable of performing any of the below task : a) Call Custom PL/SQL Code b) Send Notification c) Call Workflow. They are usually embedded in seeded API and called as wf_raise.event(). Each Business Event can be have one or more Business Event Subscriptions. Whenever the Business Events gets called the business event subscriptions are executed. There are a lot of seeded Business Events which can be searched under Workflow Administrator-> Business Events. In 11i there are some business events which do not get fired from forms as they are using row and tale handlers and not seeded API. For example the people and assignment form uses row and table handlers in 11i and any event based on them does not gets automatically triggered, this limitation has anyhow overcome in R12. I will give a sample code along with implementation step of a Business Event Implementation for Ready Reference. Bye till then..... Do let me know how you feel about this article. In Order to give a demo of Business Events I would create a few database objects. A brief description is as follows : a) A custom sequence named xxc_test_event_seq b) A custom table named xxc_test_event_subscription_table c) A custom package xxc_test_event_subscription_pkg The script for sequence is as as ( I am creating this seq in apps, ideally it should be created in custom application,and given grants to apps also you should create a synonym in apps for easy use)

Business Events in Oracle Applications


http://oracleapps-atechniciansview.blogspot.com/

Ashish Harbhajanka

Email: ashish1234u@gmail.com

: CREATE SEQUENCE xxc_test_event_seq START WITH 1 INCREMENT BY 1 CACHE 20 NOCYCLE; The script for creating the table is as ( I am creating this table in apps, ideally it should be created in custom application, and given grants to apps also you should create a synonym in apps for easy use) CREATE TABLE xxc_test_event_subscription_table ( Seq NUMBER, data VARCHAR2(1000), created_on DATA ); The script for creating the package is : CREATE OR REPLACE PACKAGE xxc_test_event_subscription_pkg AS FUNCTION test_event_subscription_func (p_subscription_guid in raw, p_event in out WF_EVENT_T ) return varchar2; end xxc_test_event_subscription_pkg; Package Body is : CREATE OR REPLACE PACKAGE BODY xxc_test_event_subscription_pkg AS FUNCTION test_event_subscription_func (p_subscription_guid in raw, p_event in out WF_EVENT_T ) return varchar2 IS ln_number NUMBER; BEGIN IF (p_event.geteventname() = oracle.apps.fnd.lookup.code.insert) THEN INSERT INTO xxc_test_event_subscription_table(xxc_test_event_seq.nextval,p_event.EVENTDATA(),sysd ate); RETURN (SUCCESS);

Business Events in Oracle Applications


http://oracleapps-atechniciansview.blogspot.com/

Ashish Harbhajanka

Email: ashish1234u@gmail.com

END IF; EXCEPTION WHEN OTHERS THEN INSERT INTO xxc_test_event_subscription_table(xxc_test_event_seq.nextval,SQLERRM,sysdate); RETURN (ERROR); END; COMMIT; END test_event_subscription_func; END xxc_test_event_subscription_pkg; Next we should do some functional setup and try to raise a business event.

Business Events in Oracle Applications


http://oracleapps-atechniciansview.blogspot.com/

Ashish Harbhajanka

Email: ashish1234u@gmail.com

We do not have any subscription parameters for this event. Now you should run one concurrent program to ensure that your susbcriptions become active. Synchronize Product License and Workflow BES License

Business Events in Oracle Applications


http://oracleapps-atechniciansview.blogspot.com/

Ashish Harbhajanka

Email: ashish1234u@gmail.com

Now the event subscription is complete. We have raised this event on Lookup code which means that each time a new lookup code is inserted a record will be inserted in table. Table Status before adding Lookup

Adding Lookup Code :

Business Events in Oracle Applications


http://oracleapps-atechniciansview.blogspot.com/

Ashish Harbhajanka

Email: ashish1234u@gmail.com

Lookup code 170 has been added. Lets check the table now.

We see that the data is inserted into table. Similarly you can call your concurrent programs too to do any processing. Please let me know if you have any suggestions/ feedback.

You might also like